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

Small formatting things

parent 0eed3cb3
No related branches found
No related tags found
No related merge requests found
......@@ -6,7 +6,6 @@ import signal
import logging
import argparse
import functools
import subprocess
import tracemalloc
from typing import List, Union, Dict, Callable, Tuple, Any
from pathlib import Path
......@@ -131,6 +130,9 @@ def get_retval(body: str) -> Union[int, None]:
class WorkflowMonitor:
"""
Class that monitors the events in a given workflow via the log file produced by it
"""
def __init__(self, logfile_path: str, timeout: int = 60):
self.logfile_path = Path(logfile_path)
......@@ -170,13 +172,14 @@ class WorkflowMonitor:
"""
# Regex that matches an event entry in the HTCondor log file.
r_htc_event = r'(?P<eventnum>[0-9]{3}) \((?P<jobnum>[0-9]{4})\.[0-9]{3}\.[0-9]{3}\) ' \
r'(?P<timestamp>[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}) ' \
r'(?P<desc>[a-zA-Z0-9 ?&:=<>\-._]+)\n' \
r'(?P<body>[\t ]+[^\.]*\n)*' \
r'...'
r'(?P<timestamp>[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2}) ' \
r'(?P<desc>[a-zA-Z0-9 ?&:=<>\-._]+)\n' \
r'(?P<body>[\t ]+[^\.]*\n)*' \
r'...'
jobs = {}
events = []
if sum(1 for _ in re.finditer(r_htc_event, self.log)) == 0:
# Regex didn't return any matches
raise ValueError('HTCondor log file not well-formatted. Was the file edited?')
for match in re.finditer(r_htc_event, self.log):
job_id = match.group('jobnum')
......
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