Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
workspaces
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ssa
workspaces
Commits
e91a0f3c
Commit
e91a0f3c
authored
4 years ago
by
Nathan Hertz
Browse files
Options
Downloads
Patches
Plain Diff
Small formatting things
parent
0eed3cb3
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/cli/utilities/wf_monitor/src/wf_monitor/monitor.py
+8
-5
8 additions, 5 deletions
apps/cli/utilities/wf_monitor/src/wf_monitor/monitor.py
with
8 additions
and
5 deletions
apps/cli/utilities/wf_monitor/src/wf_monitor/monitor.py
+
8
−
5
View file @
e91a0f3c
...
...
@@ -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
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment