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
c4827e63
Commit
c4827e63
authored
3 months ago
by
ml bonhomme
Committed by
Yoann Schneider
3 months ago
Browse files
Options
Downloads
Patches
Plain Diff
Export process elements listing
parent
3986cd1f
Branches
bump-mkdocs-material
No related tags found
1 merge request
!606
Export process elements listing
Pipeline
#202660
passed
3 months ago
Stage: test
Stage: build
Stage: release
Stage: deploy
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex_worker/worker/__init__.py
+3
-0
3 additions, 0 deletions
arkindex_worker/worker/__init__.py
tests/test_elements_worker/test_worker.py
+46
-0
46 additions, 0 deletions
tests/test_elements_worker/test_worker.py
with
49 additions
and
0 deletions
arkindex_worker/worker/__init__.py
+
3
−
0
View file @
c4827e63
...
...
@@ -120,6 +120,9 @@ class ElementsWorker(
return
list
(
chain
.
from_iterable
(
map
(
self
.
list_set_elements
,
self
.
list_sets
()))
)
elif
self
.
process_mode
==
ProcessMode
.
Export
:
# For export mode processes, use list_process_elements and return element IDs
return
{
item
[
"
id
"
]
for
item
in
self
.
list_process_elements
()}
invalid_element_ids
=
list
(
filter
(
invalid_element_id
,
out
))
assert
(
...
...
This diff is collapsed.
Click to expand it.
tests/test_elements_worker/test_worker.py
+
46
−
0
View file @
c4827e63
...
...
@@ -16,6 +16,7 @@ from arkindex_worker.models import Element
from
arkindex_worker.worker
import
ActivityState
,
ElementsWorker
from
arkindex_worker.worker.dataset
import
DatasetState
from
arkindex_worker.worker.process
import
ProcessMode
from
tests
import
PROCESS_ID
from
.
import
BASE_API_CALLS
...
...
@@ -523,6 +524,51 @@ def test_get_elements_both_args_error(mocker, mock_elements_worker, tmp_path):
worker
.
get_elements
()
def
test_get_elements_export_process
(
mock_elements_worker
,
responses
):
responses
.
add
(
responses
.
GET
,
f
"
http://testserver/api/v1/process/
{
PROCESS_ID
}
/elements/?page_size=500&with_count=true&with_image=False
"
,
status
=
200
,
json
=
{
"
count
"
:
2
,
"
next
"
:
None
,
"
results
"
:
[
{
"
id
"
:
"
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
"
,
"
type_id
"
:
"
baaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
"
,
"
name
"
:
"
element 1
"
,
"
confidence
"
:
1
,
"
image_id
"
:
None
,
"
image_width
"
:
None
,
"
image_height
"
:
None
,
"
image_url
"
:
None
,
"
polygon
"
:
None
,
"
rotation_angle
"
:
0
,
"
mirrored
"
:
False
,
},
{
"
id
"
:
"
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa0
"
,
"
type_id
"
:
"
baaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
"
,
"
name
"
:
"
element 2
"
,
"
confidence
"
:
1
,
"
image_id
"
:
None
,
"
image_width
"
:
None
,
"
image_height
"
:
None
,
"
image_url
"
:
None
,
"
polygon
"
:
None
,
"
rotation_angle
"
:
0
,
"
mirrored
"
:
False
,
},
],
},
)
mock_elements_worker
.
process_information
[
"
mode
"
]
=
"
export
"
assert
set
(
mock_elements_worker
.
get_elements
())
==
{
"
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa
"
,
"
aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaa0
"
,
}
@pytest.mark.usefixtures
(
"
_mock_worker_run_api
"
)
def
test_activities_disabled
(
responses
,
monkeypatch
):
"""
Test worker process elements without updating activities when they are disabled for the process
"""
...
...
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