Custom Script Scheduling Broken #10434

Closed
opened 2025-12-29 21:31:23 +01:00 by adam · 3 comments
Owner

Originally created by @wz4 on GitHub (Nov 2, 2024).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.6

Python Version

3.10

Steps to Reproduce

In Netbox v4.1.6 schedule a recurring custom script. The first job will get scheduled, but subsequent jobs are not.

Test Script

from extras.scripts import Script

class TestScript(Script):
    class Meta:
        name = "Test Script"
        description = "Hello"
        scheduling_enabled = True

    def run(self, data, commit):

        return "HELLO"

Expected Behavior

After a scheduled job completes, the next scheduled job should appear with a status of 'Scheduled'.

Observed Behavior

No observed error

Originally created by @wz4 on GitHub (Nov 2, 2024). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type Self-hosted ### Triage priority N/A ### NetBox Version v4.1.6 ### Python Version 3.10 ### Steps to Reproduce In Netbox v4.1.6 schedule a recurring custom script. The first job will get scheduled, but subsequent jobs are not. Test Script ``` from extras.scripts import Script class TestScript(Script): class Meta: name = "Test Script" description = "Hello" scheduling_enabled = True def run(self, data, commit): return "HELLO" ``` ### Expected Behavior After a scheduled job completes, the next scheduled job should appear with a status of 'Scheduled'. ### Observed Behavior No observed error
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:31:23 +01:00
adam closed this issue 2025-12-29 21:31:24 +01:00
Author
Owner

@arthanson commented on GitHub (Nov 4, 2024):

@alehaa can you comment on this and I can assign your.

@arthanson commented on GitHub (Nov 4, 2024): @alehaa can you comment on this and I can assign your.
Author
Owner

@alehaa commented on GitHub (Nov 4, 2024):

I can take a look at it.

@alehaa commented on GitHub (Nov 4, 2024): I can take a look at it.
Author
Owner

@alehaa commented on GitHub (Nov 4, 2024):

I believe this is related to #17923, as I get this error on the worker console:

Traceback (most recent call last):
  File "/opt/netbox/venv/lib/python3.12/site-packages/rq/worker.py", line 1430, in perform_job
    rv = job.perform()
         ^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/rq/job.py", line 1280, in perform
    self._result = self._execute()
                   ^^^^^^^^^^^^^^^
  File "/opt/netbox/venv/lib/python3.12/site-packages/rq/job.py", line 1317, in _execute
    result = self.func(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/netbox/jobs.py", line 73, in handle
    cls.enqueue(
  File "/opt/netbox/netbox/netbox/jobs.py", line 106, in enqueue
    return Job.enqueue(cls.handle, name=name, *args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/netbox/netbox/core/models/jobs.py", line 236, in enqueue
    job.full_clean()
  File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/base.py", line 1561, in full_clean
    raise ValidationError(errors)
django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']}

After applying the patch for #17923 jobs will be scheduled as expected again.

@alehaa commented on GitHub (Nov 4, 2024): I believe this is related to #17923, as I get this error on the worker console: ``` Traceback (most recent call last): File "/opt/netbox/venv/lib/python3.12/site-packages/rq/worker.py", line 1430, in perform_job rv = job.perform() ^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/rq/job.py", line 1280, in perform self._result = self._execute() ^^^^^^^^^^^^^^^ File "/opt/netbox/venv/lib/python3.12/site-packages/rq/job.py", line 1317, in _execute result = self.func(*self.args, **self.kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/netbox/jobs.py", line 73, in handle cls.enqueue( File "/opt/netbox/netbox/netbox/jobs.py", line 106, in enqueue return Job.enqueue(cls.handle, name=name, *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/opt/netbox/netbox/core/models/jobs.py", line 236, in enqueue job.full_clean() File "/opt/netbox/venv/lib/python3.12/site-packages/django/db/models/base.py", line 1561, in full_clean raise ValidationError(errors) django.core.exceptions.ValidationError: {'name': ['This field cannot be blank.']} ``` After applying the patch for #17923 jobs will be scheduled as expected again.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10434