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
c6407758
Commit
c6407758
authored
1 year ago
by
Eva Bardou
Browse files
Options
Downloads
Patches
Plain Diff
Properly handle pluralization
parent
a2f8c49b
No related branches found
No related tags found
1 merge request
!504
Log a message when everything went well as well
Pipeline
#162408
passed
1 year ago
Stage: test
Stage: build
Stage: release
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
arkindex_worker/worker/__init__.py
+2
-6
2 additions, 6 deletions
arkindex_worker/worker/__init__.py
tests/test_dataset_worker.py
+6
-6
6 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
9 additions
and
13 deletions
arkindex_worker/worker/__init__.py
+
2
−
6
View file @
c6407758
...
...
@@ -230,9 +230,7 @@ class ElementsWorker(
with
contextlib
.
suppress
(
Exception
):
self
.
update_activity
(
element
.
id
,
ActivityState
.
Error
)
message
=
(
f
"
Ran on
{
count
}
elements:
{
count
-
failed
}
completed,
{
failed
}
failed
"
)
message
=
f
'
Ran on
{
count
}
element
{
"
s
"
[
:
count
>
1
]
}
:
{
count
-
failed
}
completed,
{
failed
}
failed
'
if
failed
:
logger
.
error
(
message
)
if
failed
>=
count
:
# Everything failed!
...
...
@@ -508,9 +506,7 @@ class DatasetWorker(BaseWorker, DatasetMixin, TaskMixin):
if
dataset_artifact
:
dataset_artifact
.
unlink
(
missing_ok
=
True
)
message
=
(
f
"
Ran on
{
count
}
datasets:
{
count
-
failed
}
completed,
{
failed
}
failed
"
)
message
=
f
'
Ran on
{
count
}
dataset
{
"
s
"
[
:
count
>
1
]
}
:
{
count
-
failed
}
completed,
{
failed
}
failed
'
if
failed
:
logger
.
error
(
message
)
if
failed
>=
count
:
# Everything failed!
...
...
This diff is collapsed.
Click to expand it.
tests/test_dataset_worker.py
+
6
−
6
View file @
c6407758
...
...
@@ -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
"
,
),
]
...
...
@@ -793,7 +793,7 @@ def test_run(
(
logging
.
INFO
,
"
Loaded Worker Fake worker @ 123412 from API
"
),
(
logging
.
INFO
,
"
Processing Dataset (dataset_id) (1/1)
"
),
*
extra_logs
,
(
logging
.
INFO
,
"
Ran on 1 dataset
s
: 1 completed, 0 failed
"
),
(
logging
.
INFO
,
"
Ran on 1 dataset: 1 completed, 0 failed
"
),
]
...
...
@@ -893,5 +893,5 @@ def test_run_read_only(
(
logging
.
WARNING
,
"
Running without any extra configuration
"
),
(
logging
.
INFO
,
"
Processing Dataset (dataset_id) (1/1)
"
),
*
extra_logs
,
(
logging
.
INFO
,
"
Ran on 1 dataset
s
: 1 completed, 0 failed
"
),
(
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 @
c6407758
...
...
@@ -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