Create a new Scheduled or Repeatable job filling all the required data
Current behavior:
A Django exception is thrown adding a new scheduled or repeatable job
Internal Server Error: /admin/scheduler/repeatablejob/add/
Traceback (most recent call last):
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/core/handlers/exception.py", line 35, in inner
response = get_response(request)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/core/handlers/base.py", line 128, in _get_response
response = self.process_exception_by_middleware(e, request)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/core/handlers/base.py", line 126, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/contrib/admin/options.py", line 575, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/utils/decorators.py", line 142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/contrib/admin/sites.py", line 223, in inner
return view(request, *args, **kwargs)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/contrib/admin/options.py", line 1554, in add_view
return self.changeform_view(request, None, form_url, extra_context)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/utils/decorators.py", line 62, in _wrapper
return bound_func(*args, **kwargs)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/utils/decorators.py", line 142, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/utils/decorators.py", line 58, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/contrib/admin/options.py", line 1451, in changeform_view
return self._changeform_view(request, object_id, form_url, extra_context)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/contrib/admin/options.py", line 1491, in _changeform_view
self.save_model(request, new_object, form, not add)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/django/contrib/admin/options.py", line 1027, in save_model
obj.save()
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/scheduler/models.py", line 77, in save
self.unschedule()
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/scheduler/models.py", line 104, in unschedule
if self.is_scheduled():
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/scheduler/models.py", line 72, in is_scheduled
return self.job_id in self.scheduler()
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/rq_scheduler/scheduler.py", line 260, in __contains__
return self.connection.zscore(self.scheduled_jobs_key, job_id) is not None
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/redis/client.py", line 2593, in zscore
return self.execute_command('ZSCORE', name, value)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/redis/client.py", line 774, in execute_command
connection.send_command(*args)
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/redis/connection.py", line 620, in send_command
self.send_packed_command(self.pack_command(*args))
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/redis/connection.py", line 663, in pack_command
for arg in imap(self.encoder.encode, args):
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/redis/connection.py", line 125, in encode
"byte, string or number first." % typename)
redis.exceptions.DataError: Invalid input of type: 'NoneType'. Convert to a byte, string or number first.
"POST /admin/scheduler/repeatablejob/add/ HTTP/1.1" 500 181002
Expected behavior: The scheduled/repeatable job is created
I've been checking the value of job_id was None when calling to contains function and this could potentially the reason of the failure:
File "/home/jescalona/virtualenvs/bighaiku/lib/python3.7/site-packages/rq_scheduler/scheduler.py", line 260, in __contains__
return self.connection.zscore(self.scheduled_jobs_key, job_id) is not None
Will investigate more and open a PR if i find the solution. Thanks
Step to reproduce:
Current behavior:
Expected behavior: The scheduled/repeatable job is created
I've been checking the value of job_id was None when calling to contains function and this could potentially the reason of the failure:
Will investigate more and open a PR if i find the solution. Thanks