Skip to content
Snippets Groups Projects

Remove thumbnail generation from process

Merged Theo Lesage requested to merge remove-thumbnail-gen into master
All threads resolved!
1 file
+ 1
1
Compare changes
  • Side-by-side
  • Inline
@@ -117,10 +117,14 @@ class TestCreateProcess(FixtureAPITestCase):
})
# The process needs to be started to produce a workflow
process.worker_runs.create(
version=self.version_1
)
response = self.client.post(
reverse("api:process-start", kwargs={"pk": str(process.id)}),
# The process needs a worker run or thumbnails generation to start
{"thumbnails": "true"}
{}
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
process.refresh_from_db()
@@ -487,10 +491,13 @@ class TestCreateProcess(FixtureAPITestCase):
self.assertEqual(process.elements.get(), page)
# The process needs to be started to produce a workflow
process.worker_runs.create(
version=self.version_1
)
response = self.client.post(
reverse("api:process-start", kwargs={"pk": str(process.id)}),
# The process needs a worker run or thumbnails generation to start
{"thumbnails": "true"}
{}
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
process.refresh_from_db()
@@ -533,46 +540,6 @@ class TestCreateProcess(FixtureAPITestCase):
process = Process.objects.get(id=data["id"])
self.assertEqual(process.name, "blah")
def test_thumbnails_generation_only(self):
"""
Generating thumbnails without any worker must generate a process task
and a thumbnails task, when the process is started
"""
self.client.force_login(self.user)
corpus_type = self.corpus.types.first()
response = self.client.post(
reverse("api:corpus-process"),
{
"corpus": str(self.corpus.id),
"element_type": corpus_type.slug,
},
format="json"
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
data = response.json()
process = Process.objects.get(id=data["id"])
self.assertFalse(process.tasks.exists())
response = self.client.post(
reverse("api:process-start", kwargs={"pk": str(process.id)}),
{
"chunks": 3,
"thumbnails": True,
}
)
self.assertEqual(response.status_code, status.HTTP_201_CREATED)
process.refresh_from_db()
self.assertEqual(process.tasks.count(), 4)
init_task = process.tasks.get(slug="initialisation")
self.assertEqual(init_task.command, f"python -m arkindex_tasks.init_elements {process.id} --chunks-number 3")
for i in range(1, 4):
self.assertEqual(
process.tasks.get(slug=f"thumbnails_{i}").command,
f"python3 -m arkindex_tasks.generate_thumbnails /data/initialisation/elements_chunk_{i}.json"
)
@override_settings(
ARKINDEX_TASKS_IMAGE="registry.teklia.com/tasks",
PONOS_DEFAULT_ENV={}
Loading