@@ -191,7 +191,7 @@ def is_scheduled(self) -> bool:
191191 self .rqueue .queued_job_registry .exists (pipeline , self .job_name )
192192 self .rqueue .active_job_registry .exists (pipeline , self .job_name )
193193 results = pipeline .execute ()
194- res = any ([ item is not None for item in results ] )
194+ res = any (item is not None for item in results )
195195
196196 # If the job_name is not scheduled/queued/started,
197197 # update the job_id to None. (The job_id belongs to a previous run which is completed)
@@ -230,14 +230,14 @@ def _enqueue_args(self) -> Dict[str, Any]:
230230 - Set job-id to proper format
231231 - set job meta
232232 """
233- res = dict (
234- meta = dict () ,
235- task_type = self .task_type ,
236- scheduled_task_id = self .id ,
237- on_success = Callback (success_callback ),
238- on_failure = Callback (failure_callback ),
239- name = self ._next_job_id (),
240- )
233+ res = {
234+ " meta" : {} ,
235+ " task_type" : self .task_type ,
236+ " scheduled_task_id" : self .id ,
237+ " on_success" : Callback (success_callback ),
238+ " on_failure" : Callback (failure_callback ),
239+ " name" : self ._next_job_id (),
240+ }
241241 if self .at_front :
242242 res ["at_front" ] = self .at_front
243243 if self .timeout :
@@ -287,29 +287,29 @@ def _schedule_time(self) -> datetime:
287287 def to_dict (self ) -> Dict [str , Any ]:
288288 """Export model to dictionary, so it can be saved as external file backup"""
289289 interval_unit = str (self .interval_unit ) if self .interval_unit else None
290- res = dict (
291- model = str (self .task_type ),
292- name = self .name ,
293- callable = self .callable ,
294- callable_args = [ dict ( arg_type = arg .arg_type , val = arg .val ) for arg in self .callable_args .all ()],
295- callable_kwargs = [
296- dict ( arg_type = arg .arg_type , key = arg .key , val = arg .val ) for arg in self .callable_kwargs .all ()
290+ res = {
291+ " model" : str (self .task_type ),
292+ " name" : self .name ,
293+ " callable" : self .callable ,
294+ " callable_args" : [{ " arg_type" : arg .arg_type , " val" : arg .val } for arg in self .callable_args .all ()],
295+ " callable_kwargs" : [
296+ { " arg_type" : arg .arg_type , " key" : arg .key , " val" : arg .val } for arg in self .callable_kwargs .all ()
297297 ],
298- enabled = self .enabled ,
299- queue = self .queue ,
300- repeat = getattr (self , "repeat" , None ),
301- at_front = self .at_front ,
302- timeout = self .timeout ,
303- result_ttl = self .result_ttl ,
304- cron_string = getattr (self , "cron_string" , None ),
305- scheduled_time = self ._schedule_time ().isoformat (),
306- interval = getattr (self , "interval" , None ),
307- interval_unit = interval_unit ,
308- successful_runs = getattr (self , "successful_runs" , None ),
309- failed_runs = getattr (self , "failed_runs" , None ),
310- last_successful_run = getattr (self , "last_successful_run" , None ),
311- last_failed_run = getattr (self , "last_failed_run" , None ),
312- )
298+ " enabled" : self .enabled ,
299+ " queue" : self .queue ,
300+ " repeat" : getattr (self , "repeat" , None ),
301+ " at_front" : self .at_front ,
302+ " timeout" : self .timeout ,
303+ " result_ttl" : self .result_ttl ,
304+ " cron_string" : getattr (self , "cron_string" , None ),
305+ " scheduled_time" : self ._schedule_time ().isoformat (),
306+ " interval" : getattr (self , "interval" , None ),
307+ " interval_unit" : interval_unit ,
308+ " successful_runs" : getattr (self , "successful_runs" , None ),
309+ " failed_runs" : getattr (self , "failed_runs" , None ),
310+ " last_successful_run" : getattr (self , "last_successful_run" , None ),
311+ " last_failed_run" : getattr (self , "last_failed_run" , None ),
312+ }
313313 return res
314314
315315 def get_absolute_url (self ) -> str :
0 commit comments