-
Notifications
You must be signed in to change notification settings - Fork 6
Description
Currently when a user kicks off an image download (for either a single site, or an entire model run), the endpoint simply places a message on the queue for the celery worker to pick up. Then, the celery worker creates a SatelliteFetching row once the task starts to signal that the image generation is running. This results in a race condition where, if the celery worker is preoccupied with another task or not up, the SatelliteFetching row will not be created. This means the UI will not update to let the user know the imagery task has started.
The easiest way to observe this is to run the app locally, stop your celery worker, and then kick off an image fetch task. Notice, the UI does not update or indicate anything is happening.
I can think of two ways to fix this -
- Add a
PENDINGstatus to theSatelliteFetchingmodel and set it in the endpoint prior to dispatching the task. Once the task begins, set it toRUNNING. - Just create the
SatelliteFetchingrow in the endpoint with a status ofRUNNINGprior to dispatching the task.
I think option 2 makes more sense. Not only is it simpler to implement, but I don't see any value in distinguishing between a PENDING and RUNNING task in the UI. Either way the user is waiting, so it doesn't seem like it would offer any useful information.