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
1c04f391
Commit
1c04f391
authored
5 years ago
by
Valentin Rigal
Committed by
Erwan Rouchet
5 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Skip children fetching parameter for thumbnails generation only
parent
f996e579
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
arkindex/dataimport/models.py
+5
-0
5 additions, 0 deletions
arkindex/dataimport/models.py
arkindex/dataimport/tests/test_workflows_api.py
+28
-0
28 additions, 0 deletions
arkindex/dataimport/tests/test_workflows_api.py
with
33 additions
and
0 deletions
arkindex/dataimport/models.py
+
5
−
0
View file @
1c04f391
...
...
@@ -122,6 +122,11 @@ class DataImport(IndexableModel):
if
elements
:
command
=
'
'
.
join
([
command
,
'
--dataimport-id {}
'
.
format
(
str
(
self
.
id
))])
# Do not retrieve elements children in case there of thumbnails generation only
thumbnails
=
self
.
payload
.
get
(
'
thumbnails
'
)
if
thumbnails
and
len
(
self
.
ml_tools
)
==
0
:
command
=
'
'
.
join
([
command
,
'
--skip-children
'
.
format
(
str
(
self
.
id
))])
tasks
=
{
import_task_name
:
{
'
image
'
:
settings
.
ARKINDEX_TASKS_IMAGE
,
...
...
This diff is collapsed.
Click to expand it.
arkindex/dataimport/tests/test_workflows_api.py
+
28
−
0
View file @
1c04f391
...
...
@@ -499,3 +499,31 @@ class TestWorkflows(FixtureAPITestCase):
'
python -m arkindex_tasks.init_elements --corpus-id {} --chunks-number 1 --dataimport-id {}
'
.
format
(
str
(
self
.
corpus
.
id
),
str
(
dataimport
.
id
))
)
def
test_thumbnails_generation_only
(
self
,
ml_get_mock
):
"""
Generating thumbnails without any workflow must generate an import task
which do not to retrieve filtered elements children
"""
self
.
client
.
force_login
(
self
.
user
)
corpus_type
=
self
.
corpus
.
types
.
first
()
response
=
self
.
client
.
post
(
reverse
(
'
api:corpus-workflow
'
),
{
'
ml_tools
'
:
[],
'
corpus
'
:
str
(
self
.
corpus
.
id
),
'
chunks
'
:
3
,
'
type
'
:
corpus_type
.
slug
,
'
thumbnails
'
:
True
},
format
=
'
json
'
)
self
.
assertEqual
(
response
.
status_code
,
status
.
HTTP_201_CREATED
)
data
=
response
.
json
()
dataimport
=
DataImport
.
objects
.
get
(
id
=
data
[
'
id
'
])
workflow
=
dataimport
.
workflow
self
.
assertEqual
(
workflow
.
recipes
[
'
initialisation
'
].
command
,
'
python -m arkindex_tasks.init_elements --corpus-id {} --chunks-number 3 --type {} --skip-children
'
.
format
(
str
(
self
.
corpus
.
id
),
corpus_type
.
slug
)
)
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