def __init__( self, db_url: str = 'sqlite:///monitoring.db', logdir: str = '.', logging_level: int = logging.INFO, batching_interval: float = 1, batching_threshold: float = 99999, ): self.workflow_end = False self.workflow_start_message = None # type: Optional[Dict[str, Any]] self.logdir = logdir os.makedirs(self.logdir, exist_ok=True) set_file_logger( "{}/database_manager.log".format(self.logdir), level=logging_level, format_string= "%(asctime)s.%(msecs)03d %(name)s:%(lineno)d [%(levelname)s] [%(threadName)s %(thread)d] %(message)s", name="database_manager") logger.debug("Initializing Database Manager process") self.db = Database(db_url) self.batching_interval = batching_interval self.batching_threshold = batching_threshold self.pending_priority_queue = queue.Queue( ) # type: queue.Queue[Tuple[MessageType, Dict[str, Any]]] self.pending_node_queue = queue.Queue( ) # type: queue.Queue[Dict[str, Any]] self.pending_block_queue = queue.Queue( ) # type: queue.Queue[Dict[str, Any]] self.pending_resource_queue = queue.Queue( ) # type: queue.Queue[Dict[str, Any]]
def __init__(self, db_url='sqlite:///monitoring.db', logdir='.', logging_level=logging.INFO, batching_interval=1, batching_threshold=99999, ): self.workflow_end = False self.workflow_start_message = None self.logdir = logdir os.makedirs(self.logdir, exist_ok=True) set_file_logger("{}/database_manager.log".format(self.logdir), level=logging_level, name="database_manager") logger.debug("Initializing Database Manager process") self.db = Database(db_url) self.batching_interval = batching_interval self.batching_threshold = batching_threshold self.pending_priority_queue = queue.Queue() self.pending_node_queue = queue.Queue() self.pending_resource_queue = queue.Queue()