Skip to content
Snippets Groups Projects
Commit 5f5c034c authored by Tamas Gal's avatar Tamas Gal :speech_balloon:
Browse files

Deamonize

parent bce7119c
No related branches found
No related tags found
No related merge requests found
...@@ -36,8 +36,6 @@ from km3modules.plot import plot_dom_parameters ...@@ -36,8 +36,6 @@ from km3modules.plot import plot_dom_parameters
VERSION = "1.0" VERSION = "1.0"
km3pipe.style.use('km3pipe')
class DOMActivityPlotter(kp.Module): class DOMActivityPlotter(kp.Module):
"Creates a plot with dots for each DOM, coloured based in their activity" "Creates a plot with dots for each DOM, coloured based in their activity"
...@@ -99,6 +97,8 @@ class DOMActivityPlotter(kp.Module): ...@@ -99,6 +97,8 @@ class DOMActivityPlotter(kp.Module):
def main(chpump_kwargs={}, plotter_kwargs={}): def main(chpump_kwargs={}, plotter_kwargs={}):
km3pipe.style.use('km3pipe')
pipe = kp.Pipeline() pipe = kp.Pipeline()
pipe.attach(kp.io.ch.CHPump, pipe.attach(kp.io.ch.CHPump,
name="DOMActivityPlotter_CHPump", name="DOMActivityPlotter_CHPump",
...@@ -127,9 +127,15 @@ if __name__ == '__main__': ...@@ -127,9 +127,15 @@ if __name__ == '__main__':
main(chpump_kwargs, plotter_kwargs) main(chpump_kwargs, plotter_kwargs)
else: else:
from daemonize import Daemonize from daemonize import Daemonize
workdir = os.path.realpath(
os.path.join(os.path.dirname(__file__), '..'))
process_name = os.path.basename(__file__) process_name = os.path.basename(__file__)
pid_file = os.path.join("pids", process_name + ".pid") pid_file = os.path.join("pids", process_name + ".pid")
print(process_name, pid_file)
daemon = Daemonize(app=process_name, pid=pid_file, action=main) daemon = Daemonize(app=process_name,
pid=pid_file,
action=main,
chdir=workdir)
daemon.start() daemon.start()
print("Process started with PID {}".format(pid_file)) print("Process started with PID {}".format(pid_file))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment