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
246ac12c
Commit
246ac12c
authored
4 years ago
by
Nathan Hertz
Browse files
Options
Downloads
Patches
Plain Diff
Small changes to monitor and test_monitor
parent
7926ea30
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
apps/cli/utilities/wf_monitor/src/wf_monitor/monitor.py
+3
-22
3 additions, 22 deletions
apps/cli/utilities/wf_monitor/src/wf_monitor/monitor.py
apps/cli/utilities/wf_monitor/test/test_wf_monitor.py
+4
-4
4 additions, 4 deletions
apps/cli/utilities/wf_monitor/test/test_wf_monitor.py
with
7 additions
and
26 deletions
apps/cli/utilities/wf_monitor/src/wf_monitor/monitor.py
+
3
−
22
View file @
246ac12c
...
...
@@ -239,26 +239,7 @@ def main():
# Parse command-line args
args
=
make_arg_parser
().
parse_args
()
monitor
=
WorkflowMonitor
(
args
.
log_path
)
with
workflow_events
as
wfe
:
decorated_send
=
log_decorator_factory
(
'
Sending event...
'
)(
workflow_events
.
send
)
with
workflow_events
:
for
event
in
monitor
.
events
:
wfe
.
send
(
event
,
WORKFLOW_STATUS_EXCH
)
# # Probably want to refactor this so that it doesn't create its own connection just for this,
# # since creating connections is expensive
# decorated_connect = log_decorator_factory('Making connection...')(make_amqp_connection)
# decorated_config_channel = log_decorator_factory('Configuring channel...')(configure_amqp_channel)
# decorated_emit = log_decorator_factory('Emitting message...')(emit_amqp_message)
#
# with decorated_connect(args.profile) as connection:
# with decorated_config_channel(
# connection=connection,
# exchange=WORKFLOW_STATUS_EXCH,
# exchange_type='topic'
# ) as channel:
# for event in monitor.events:
# decorated_emit(
# channel=channel,
# exchange=WORKFLOW_STATUS_EXCH,
# routing_key=f'{event.job_name}.{event.job_id}.{event.type.name.lower()}',
# msg=event.json()
# )
decorated_send
(
event
,
WORKFLOW_STATUS_EXCH
)
This diff is collapsed.
Click to expand it.
apps/cli/utilities/wf_monitor/test/test_wf_monitor.py
+
4
−
4
View file @
246ac12c
...
...
@@ -80,8 +80,8 @@ def test_monitor_events(mocker: MockerFixture):
]
[
mocker
.
patch
(
mock
)
for
mock
in
mock_list
]
channel
=
workflow_events
for
event
in
WorkflowMonitor
(
log_path
).
events
:
channel
.
send
(
event
,
WORKFLOW_STATUS_EXCH
)
with
workflow_events
as
wfe
:
for
event
in
WorkflowMonitor
(
log_path
).
events
:
wfe
.
send
(
event
,
WORKFLOW_STATUS_EXCH
)
assert
channel
.
send
.
call_count
==
8
assert
wfe
.
send
.
call_count
==
8
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