Use an async task to create a process from failed activities
https://redmine.teklia.com/issues/7593
The CreateProcessFailures
endpoint needs to be able to handle processes with hundreds of thousands of failed WorkerActivities. This clearly won't be possible without timing out, so we need to use an asynchronous task.
-
CreateProcessFailures
now returns an HTTP 202 status code. The response is completely empty. -
Instead of creating a process directly,
CreateProcessFailures
calls a newcreate_process_failures
trigger inarkindex.project.triggers
, passing the original process and a user as a parameter. -
The trigger schedules a new RQ task,
arkindex.process.tasks.create_process_failures
, on thedefault
queue. -
A new setting in the YAML configuration,
job_timeouts.create_process_failures
, controls the timeout for this task. It defaults to 3600 seconds. -
In a single transaction, the task must:
- create the new process just like
CreateProcessFailures
does now, assigning the request's user as the process' creator; - add the elements from the failures of the original process;
-
start the process.
- create the new process just like
-
The task must then send an email to the process' user, containing a URL to the process configuration page for this new process. If this fails, the task should crash so the error gets reported, but the process should still be saved.