Skip to content
Snippets Groups Projects
Commit 6d231627 authored by Nathan Hertz's avatar Nathan Hertz
Browse files

vulture: Added the ability to specify where the log is created (defaults

to CWD/condor.log)
parent 66d44a8f
No related branches found
No related tags found
No related merge requests found
......@@ -13,12 +13,10 @@ class MockLogger:
Class representing a logger for Vulture that will simulate HTCondor logs
"""
def __init__(self):
log_dir = "logs"
log_filename = f"vulture_{pendulum.now().to_iso8601_string()}.log"
def __init__(self, log_path: Path):
self.logger = logging.getLogger("vulture")
self.logger.setLevel(logging.INFO)
self.logger.addHandler(logging.FileHandler(f"{log_dir}/{log_filename}", mode="w+"))
self.logger.addHandler(logging.FileHandler(f"{log_path}", mode="a+"))
def log_event(self, event_type: WorkflowEventType, event_body: str = None):
"""
......@@ -71,7 +69,7 @@ class Job:
self.fields, self.command = self.parse(file)
self.write_log = write_log
if self.write_log:
self.logger = MockLogger()
self.logger = MockLogger(self.fields.get('log', "./condor.log"))
self.logger.log_event(WorkflowEventType.SUBMITTED, f"Job node: {self.fields['executable']}")
def parse(self, file: Path) -> NamedTuple:
......
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