Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions geonode/management_commands_http/utils/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ def stop_task(job: ManagementCommandJob):
def get_celery_task_meta(job: ManagementCommandJob):
if not job.celery_result_id or celery_app.conf.task_always_eager:
return {}
async_result = run_management_command_async.AsyncResult(job.celery_result_id)
task_meta = async_result.backend.get_task_meta(job.celery_result_id)
celery_result_id = str(job.celery_result_id)
async_result = run_management_command_async.AsyncResult(celery_result_id)
task_meta = async_result.backend.get_task_meta(celery_result_id)
Comment on lines +42 to +44
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The explicit conversion of job.celery_result_id to a string is crucial here. As celery_result_id is a UUIDField in the ManagementCommandJob model, it is retrieved as a UUID object. Celery's AsyncResult and backend.get_task_meta expect a string representation of the task ID, so this conversion correctly handles the type, preventing potential TypeError exceptions and ensuring reliable task status retrieval.

return task_meta
Loading