Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Management command autostart not working from admin panel #12538

Open
pchevali opened this issue Aug 29, 2024 · 2 comments
Open

Management command autostart not working from admin panel #12538

pchevali opened this issue Aug 29, 2024 · 2 comments
Labels
needs further investigation Issue or reason for specific behaviour needs further investigation

Comments

@pchevali
Copy link

Expected Behavior

Triggering a Management Commands Over HTTP job with autostart should run the task

Actual Behavior

The task is marked as Queued, there is an error in celery task result with the following error :
{"exc_type": "NotFound", "exc_message": ["ManagementCommandJob with id 1 was not found."], "exc_module": "rest_framework.exceptions"}

Steps to Reproduce the Problem

  1. Open admin panel
  2. Create a management command job over http ( ping_mngmt_commands_http for exemple)
  3. Check autostart
  4. Click save

Specifications

  • GeoNode version: 4.3
  • Installation type (vanilla, geonode-project): geonode project
  • Installation method (manual, docker): Docker
  • Additional details: Creating the management command with api works well.
@pchevali pchevali changed the title Maanagement command autostart not working from admin panel Management command autostart not working from admin panel Sep 3, 2024
@mattiagiupponi
Copy link
Contributor

HI @pchevali
I tried a couple of times on development demo and the async is correctly started and celery is logging the execution as expected

[2024-09-06 09:03:15,267: INFO/MainProcess] Task geonode.management_commands_http.tasks.run_management_command_async[e9218e9b-b534-423e-a33a-d86fc51c1801] received
[2024-09-06 09:03:15,268: DEBUG/MainProcess] TaskPool: Apply <function fast_trace_task at 0x7f3aa1103130> (args:('geonode.management_commands_http.tasks.run_management_command_async', 'e9218e9b-b534-423e-a33a-d86fc51c1801', {'lang': 'py', 'task': 'geonode.management_commands_http.tasks.run_management_command_async', 'id': 'e9218e9b-b534-423e-a33a-d86fc51c1801', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 0, 'timelimit': [None, None], 'root_id': 'e9218e9b-b534-423e-a33a-d86fc51c1801', 'parent_id': None, 'argsrepr': '()', 'kwargsrepr': "{'job_id': 3}", 'origin': 'gen80004@d3626ae4f8dc', 'ignore_result': False, 'replaced_task_nesting': 0, 'stamped_headers': None, 'stamps': {}, 'properties': {'content_type': 'application/json', 'content_encoding': 'utf-8', 'application_headers': {'lang': 'py', 'task': 'geonode.management_commands_http.tasks.run_management_command_async', 'id': 'e9218e9b-b534-423e-a33a-d86fc51c1801', 'shadow': None, 'eta': None, 'expires': None, 'group': None, 'group_index': None, 'retries': 0, 'timelimit': [None, None], 'root_id':... kwargs:{})
[2024-09-06 09:03:15,308: INFO/ForkPoolWorker-2855] Task geonode.management_commands_http.tasks.run_management_command_async[e9218e9b-b534-423e-a33a-d86fc51c1801] succeeded in 0.03869563527405262s: None

image

Can you try again from the master branch?

@mattiagiupponi mattiagiupponi added the needs further investigation Issue or reason for specific behaviour needs further investigation label Sep 6, 2024
@pchevali
Copy link
Author

pchevali commented Sep 6, 2024

Hi,

Actually it fails randomly on my production setup. Sometimes it works and sometimes no.
I noticed that it has more probability to fail just after a restart of the docker compose stack.
Locally it always works for me, but maybe it's due to the fact that the celery setup is not the same ( synchronous calls ?)
I tried to dig into the django admin part as it is not the same path for creating the job in the admin page ( in admin.py) and in the api ( mixins.py:CreateJobMixin), but didn't find an answer.
By any chance can the obj.save() call in admin.py at line 77 be an asynchronous call ? I supposed that it was a direct save call to the model ManagementCommandJob but cannot confirm that.

I will try to test with master branch when I find the time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs further investigation Issue or reason for specific behaviour needs further investigation
Projects
None yet
Development

No branches or pull requests

2 participants