Commit 49b7295d authored by Alexandre Boyer's avatar Alexandre Boyer
Browse files

fix monitor

parent d6210f98
......@@ -14,7 +14,7 @@ import os
import psutil
import datetime, time
import logging
import signal
from multiprocessing import *
from diva_evaluation_cli.bin.private_src.implementation.resources_monitoring.nvml_handler import NvmlHandler
......@@ -68,6 +68,8 @@ class Monitor():
self.main_process = Process(target=self.main_function, kwargs=self.args.__dict__)
# Instruction to listen to the signals
signal.signal(signal.SIGINT, self.signal_int_handler)
self.monitor = Process(target=self.monitor_resources)
......@@ -87,7 +89,7 @@ class Monitor():
The existing `log_file` will be overwritten it it fails to load using JSON.load()
log_dict (:obj:`dict`) A new dictionary to increment the existing log_file
log_dict (:obj:`dict`): A new dictionary to increment the existing log_file
......@@ -132,3 +134,14 @@ class Monitor():
except Exception as e:
logger.debug('PID {} not available for monitoring'.format(
def signal_int_handler(self, signal, frame):
This function is called when using Ctrl-C,
it will kill the main subprocess
signal (:obj:`signal`): The signal that triggered the execution of this function
frame (:obj:`frame`): Stack frame
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment