Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
Base Worker
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container 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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Workers
Base Worker
Commits
2f0cf175
Commit
2f0cf175
authored
1 year ago
by
Eva Bardou
Committed by
Yoann Schneider
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Log a message when everything went well as well
parent
d5ad952d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!504
Log a message when everything went well as well
Pipeline
#162742
passed
1 year ago
Stage: release
Changes
3
Pipelines
6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arkindex_worker/worker/__init__.py
+8
-6
8 additions, 6 deletions
arkindex_worker/worker/__init__.py
tests/test_dataset_worker.py
+10
-6
10 additions, 6 deletions
tests/test_dataset_worker.py
tests/test_elements_worker/test_worker.py
+1
-1
1 addition, 1 deletion
tests/test_elements_worker/test_worker.py
with
19 additions
and
13 deletions
arkindex_worker/worker/__init__.py
+
8
−
6
View file @
2f0cf175
...
...
@@ -230,12 +230,13 @@ class ElementsWorker(
with
contextlib
.
suppress
(
Exception
):
self
.
update_activity
(
element
.
id
,
ActivityState
.
Error
)
message
=
f
'
Ran on
{
count
}
element
{
"
s
"
[
:
count
>
1
]
}
:
{
count
-
failed
}
completed,
{
failed
}
failed
'
if
failed
:
logger
.
error
(
f
"
Ran on
{
count
}
elements:
{
count
-
failed
}
completed,
{
failed
}
failed
"
)
logger
.
error
(
message
)
if
failed
>=
count
:
# Everything failed!
sys
.
exit
(
1
)
else
:
logger
.
info
(
message
)
def
process_element
(
self
,
element
:
Element
|
CachedElement
):
"""
...
...
@@ -505,9 +506,10 @@ class DatasetWorker(BaseWorker, DatasetMixin, TaskMixin):
if
dataset_artifact
:
dataset_artifact
.
unlink
(
missing_ok
=
True
)
message
=
f
'
Ran on
{
count
}
dataset
{
"
s
"
[
:
count
>
1
]
}
:
{
count
-
failed
}
completed,
{
failed
}
failed
'
if
failed
:
logger
.
error
(
f
"
Ran on
{
count
}
datasets:
{
count
-
failed
}
completed,
{
failed
}
failed
"
)
logger
.
error
(
message
)
if
failed
>=
count
:
# Everything failed!
sys
.
exit
(
1
)
else
:
logger
.
info
(
message
)
This diff is collapsed.
Click to expand it.
tests/test_dataset_worker.py
+
10
−
6
View file @
2f0cf175
...
...
@@ -512,7 +512,7 @@ def test_run_initial_dataset_state_error(
if
generator
else
[]
)
+
[
(
logging
.
ERROR
,
"
Ran on 1 dataset
s
: 0 completed, 1 failed
"
),
(
logging
.
ERROR
,
"
Ran on 1 dataset: 0 completed, 1 failed
"
),
]
...
...
@@ -577,7 +577,7 @@ def test_run_update_dataset_state_api_error(
],
(
logging
.
ERROR
,
"
Ran on 1 dataset
s
: 0 completed, 1 failed
"
,
"
Ran on 1 dataset: 0 completed, 1 failed
"
,
),
]
...
...
@@ -639,7 +639,7 @@ def test_run_download_dataset_artifact_api_error(
),
(
logging
.
ERROR
,
"
Ran on 1 dataset
s
: 0 completed, 1 failed
"
,
"
Ran on 1 dataset: 0 completed, 1 failed
"
,
),
]
...
...
@@ -690,7 +690,7 @@ def test_run_no_downloaded_artifact_error(
),
(
logging
.
ERROR
,
"
Ran on 1 dataset
s
: 0 completed, 1 failed
"
,
"
Ran on 1 dataset: 0 completed, 1 failed
"
,
),
]
...
...
@@ -792,7 +792,9 @@ def test_run(
assert
[(
level
,
message
)
for
_
,
level
,
message
in
caplog
.
record_tuples
]
==
[
(
logging
.
INFO
,
"
Loaded Worker Fake worker @ 123412 from API
"
),
(
logging
.
INFO
,
"
Processing Dataset (dataset_id) (1/1)
"
),
]
+
extra_logs
*
extra_logs
,
(
logging
.
INFO
,
"
Ran on 1 dataset: 1 completed, 0 failed
"
),
]
@pytest.mark.parametrize
(
...
...
@@ -890,4 +892,6 @@ def test_run_read_only(
assert
[(
level
,
message
)
for
_
,
level
,
message
in
caplog
.
record_tuples
]
==
[
(
logging
.
WARNING
,
"
Running without any extra configuration
"
),
(
logging
.
INFO
,
"
Processing Dataset (dataset_id) (1/1)
"
),
]
+
extra_logs
*
extra_logs
,
(
logging
.
INFO
,
"
Ran on 1 dataset: 1 completed, 0 failed
"
),
]
This diff is collapsed.
Click to expand it.
tests/test_elements_worker/test_worker.py
+
1
−
1
View file @
2f0cf175
...
...
@@ -310,7 +310,7 @@ def test_start_activity_error(
),
]
assert
logger
.
error
.
call_args_list
==
[
mocker
.
call
(
"
Ran on 1 element
s
: 0 completed, 1 failed
"
)
mocker
.
call
(
"
Ran on 1 element: 0 completed, 1 failed
"
)
]
...
...
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