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

Run Immediate Job once approved is stuck when Scheduled #7038

Open
LochieP opened this issue Mar 17, 2025 · 1 comment
Open

Run Immediate Job once approved is stuck when Scheduled #7038

LochieP opened this issue Mar 17, 2025 · 1 comment
Labels
type: bug Something isn't working as expected

Comments

@LochieP
Copy link
Contributor

LochieP commented Mar 17, 2025

Sorry about the title, unsure how to summarise this problem into a brief sentence!

Environment

  • Nautobot version (Docker tag too if applicable): v2.4.4
  • Python version: 3.11
  • Database platform, version: Postgres
  • Middleware(s): Redis

Steps to Reproduce

  1. Create a Job, make this Job Approval Required
  2. Run the Job, set it to be "run immediately"
  3. Approve the Job, no pop up will occur even though the Job scheduled run time is in the past
  4. Observe that the Job is set to run in the past, as the run time is determined when the original request to run the job is created
  5. Observe that the Job is "one off" false
  6. The job is stuck in Scheduled Jobs and will never run

Expected Behavior

A job that is sent for approval that is set to be "run immediately" should be correctly flagged as one off, so that the pop up is received when approval is attempted, and ran once approved.

Additionally, if run immediately, the job should ideally not be scheduled, but instead triggered to be ran as it is successfully approved (this would somewhat mimic the dry run logic of a job to be approved, where it is enqueued). However, if scheduled, it should be scheduled in such a way that it will run once approved.

Observed Behavior

Job is approved with no pop up even though it is in the past, and it is stuck in the Scheduled jobs queue. This results in Jobs that follow the process of Creation -> Approval -> Approve -> Scheduled, when set to be "Run Immeditately" are never actually ran and lost.

Additionally, it also looks to always show an empty job queue value in the approval screen for the job, even if a default job queue is selected or a job queue value is provided in the jobs run creation.

Note: Celery-beat is confirmed to be on, and other Scheduled Jobs are being triggered daily while this problem is being observed.

The requirement for "one off" for the pop up about job time being in the past can be seen here;
https://github.com/nautobot/nautobot/blob/develop/nautobot/extras/api/views.py#L965

Courtesy of @joewesch for also highlighting that one_off seems to be restricted to type future here: https://github.com/nautobot/nautobot/blob/develop/nautobot/extras/models/jobs.py#L1375

@LochieP LochieP added triage This issue is new and has not been reviewed. type: bug Something isn't working as expected labels Mar 17, 2025
@mateusz-lachowski-codilime mateusz-lachowski-codilime removed the triage This issue is new and has not been reviewed. label Mar 19, 2025
@mateusz-lachowski-codilime
Copy link
Contributor

Hi :) Thanks for reporting this bug! I was able to reproduce this locally. The same goes to the missing job queue selected, but I decided to split this into separate issue #7043

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

2 participants