You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Immediate jobs need to be set to one_off=True and the extras.JobResult model schedule property needs to be updated to recognize immediate jobs as using the django-celery-beat clocked schedule instead of cron.
diff --git a/nautobot/extras/api/views.py b/nautobot/extras/api/views.py@@ -361,11 +361,10 @@ def _create_schedule(serializer, data, commit, job, job_model, request):
description=f"Nautobot job {name} scheduled by {request.user} on {time}",
kwargs=job_kwargs,
interval=type_,
- one_off=(type_ == JobExecutionType.TYPE_FUTURE),+ one_off=(type_ not in JobExecutionType.RECURRING_CHOICES),
user=request.user,
approval_required=job_model.approval_required,
)
diff --git a/nautobot/extras/models/jobs.py b/nautobot/extras/models/jobs.py@@ -805,7 +807,7 @@ class ScheduledJob(BaseModel):
@property
def schedule(self):
- if self.interval == JobExecutionType.TYPE_FUTURE:+ if self.interval not in JobExecutionType.RECURRING_CHOICES:
# This is one-time clocked task
return clocked(clocked_time=self.start_time)
diff --git a/nautobot/extras/views.py b/nautobot/extras/views.py@@ -1021,11 +1021,10 @@ class JobView(ObjectPermissionRequiredMixin, View):
description=f"Nautobot job {schedule_name} scheduled by {request.user} for {schedule_datetime}",
kwargs=job_kwargs,
interval=schedule_type,
- one_off=schedule_type == JobExecutionType.TYPE_FUTURE,+ one_off=(schedule_type not in JobExecutionType.RECURRING_CHOICES),
user=request.user,
approval_required=job_model.approval_required,
)
The text was updated successfully, but these errors were encountered:
Close#1845
* Honor `has_sensitive_variables` when storing kwargs for re-run
* Update Job class docstring
* Add test for not storing kwargs on rerun for sensitive variable jobs
* Fix#1845 to suppor testing
* Update job sensitive variables messaging
…mmediate job schedule in API (#2196)
* Honor `has_sensitive_variables` when storing kwargs for re-run
* Update Job class docstring
* Add test for not storing kwargs on rerun for sensitive variable jobs
* Fix#1845 to suppor testing
* Update job sensitive variables messaging
Co-authored-by: Gary Snider <75227981+gsnider2195@users.noreply.github.com>
Environment
Steps to Reproduce
/api/extras/jobs/{job id}/run/
with the following data in the body:Expected Behavior
Job runs immediately
Observed Behavior
Job is scheduled but never runs
Immediate jobs need to be set to
one_off=True
and theextras.JobResult
modelschedule
property needs to be updated to recognize immediate jobs as using the django-celery-beatclocked
schedule instead ofcron
.The text was updated successfully, but these errors were encountered: