python - Django: Know when a file is already saved after usign storage.save() -


so i've django model has filefield. filefield, contains image. after receipt picture request, need run picture analysis processes.

the problem sometimes, need rotate picture before running analysis (which runs in celery, loading model again getting instance id). picture, rotate , save with:

storage.save(image_name, new_image_file), storage django default storage (using aws s3)

the problem in minor cases (lets 1 in 1000), picture not rotated when running analysis process in celery, after rotation process executed, after that, if open image, rotated, seems save method taking time update file in storage, (asynchronously)...

have had similar issue? there way check if file updated, callback or kind of handler?

many thanks!

no magic solution here. have manage states on model, specially when working celery tasks. might need field called state states: none (no action beeing done), processing (task sent celery process) , done (image rotated)

none default state. should set pocessing state before calling celery task (and not inside celery task, had bugs because of that) , celery task should set status done when finished.

when task fast user not see difference when takes time might want add message "image being processed, please try again" or that

at least that's how it... hope helps


Comments