Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Analyze
Contributor analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Arkindex
Backend
Commits
2c9109e6
Commit
2c9109e6
authored
2 years ago
by
Erwan Rouchet
Committed by
Bastien Abadie
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Allow Workers processes on non-folder elements without an image
parent
fd2d5f97
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1946
Allow Workers processes on non-folder elements without an image
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
arkindex/process/serializers/imports.py
+0
-4
0 additions, 4 deletions
arkindex/process/serializers/imports.py
arkindex/process/tests/test_workflows_api.py
+51
-12
51 additions, 12 deletions
arkindex/process/tests/test_workflows_api.py
with
51 additions
and
16 deletions
arkindex/process/serializers/imports.py
+
0
−
4
View file @
2c9109e6
...
...
@@ -381,10 +381,6 @@ class ElementsWorkflowSerializer(serializers.Serializer):
elt_type
=
data
.
get
(
'
element_type
'
)
selection
=
data
.
get
(
'
selection
'
)
# Ensure element is a folder or has a zone
if
element
and
element
.
type
.
folder
is
False
and
(
element
.
image_id
is
None
or
element
.
polygon
is
None
):
raise
ValidationError
({
'
element
'
:
[
'
Element has to be a folder or an element with a zone.
'
]})
if
selection
and
not
settings
.
ARKINDEX_FEATURES
[
'
selection
'
]:
raise
ValidationError
({
'
selection
'
:
[
'
Selection is not available on this instance.
'
]})
...
...
This diff is collapsed.
Click to expand it.
arkindex/process/tests/test_workflows_api.py
+
51
−
12
View file @
2c9109e6
...
...
@@ -345,21 +345,60 @@ class TestWorkflows(FixtureAPITestCase):
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
def
test_create_element_workflow_non_folder_no_zone
(
self
):
"""
An element that is not of a folder type and has no image or polygon
should still be usable to create a process
"""
self
.
client
.
force_login
(
self
.
user
)
element
=
self
.
corpus
.
elements
.
create
(
type
=
self
.
pages
.
first
().
type
,
name
=
'
Kill me please
'
)
response
=
self
.
client
.
post
(
reverse
(
'
api:corpus-workflow
'
),
{
'
corpus
'
:
str
(
self
.
corpus
.
id
),
'
element
'
:
str
(
element
.
id
),
with
self
.
assertNumQueries
(
12
):
response
=
self
.
client
.
post
(
reverse
(
'
api:corpus-workflow
'
),
{
'
corpus
'
:
str
(
self
.
corpus
.
id
),
'
element
'
:
str
(
element
.
id
),
},
format
=
'
json
'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
process
=
Process
.
objects
.
get
(
element
=
element
,
mode
=
ProcessMode
.
Workers
)
self
.
assertDictEqual
(
response
.
json
(),
{
'
name
'
:
None
,
'
id
'
:
str
(
process
.
id
),
'
state
'
:
'
unscheduled
'
,
'
corpus
'
:
str
(
self
.
volume
.
corpus
.
id
),
'
files
'
:
[],
'
mode
'
:
'
workers
'
,
'
revision
'
:
process
.
revision
,
'
workflow
'
:
None
,
'
folder_type
'
:
None
,
'
element_type
'
:
None
,
'
element
'
:
{
'
id
'
:
str
(
element
.
id
),
'
name
'
:
'
Kill me please
'
,
'
type
'
:
'
page
'
,
'
zone
'
:
None
,
'
corpus
'
:
{
'
id
'
:
str
(
self
.
corpus
.
id
),
'
name
'
:
'
Unit Tests
'
,
'
public
'
:
True
,
},
'
rotation_angle
'
:
0
,
'
mirrored
'
:
False
,
'
thumbnail_url
'
:
None
,
'
thumbnail_put_url
'
:
None
,
},
format
=
'
json
'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_400_BAD_REQUEST
)
self
.
assertDictEqual
(
response
.
json
(),
{
'
element
'
:
[
'
Element has to be a folder or an element with a zone.
'
]}
)
'
template_id
'
:
None
,
'
load_children
'
:
False
,
'
use_cache
'
:
False
,
'
use_gpu
'
:
False
,
'
activity_state
'
:
ActivityState
.
Disabled
.
value
,
'
element_name_contains
'
:
None
,
'
model_id
'
:
None
,
'
train_folder_id
'
:
None
,
'
validation_folder_id
'
:
None
,
'
test_folder_id
'
:
None
,
})
def
test_create_element_workflow_mixed_selection_filters
(
self
):
"""
...
...
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