Skip to content

Commit 541afe0

Browse files
committed
fix:get_many return nones #285
1 parent 6708db6 commit 541afe0

File tree

2 files changed

+20
-22
lines changed

2 files changed

+20
-22
lines changed

scheduler/helpers/queues/queue_logic.py

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -182,23 +182,23 @@ def get_all_jobs(self) -> List[JobModel]:
182182
return JobModel.get_many(job_names, connection=self.connection)
183183

184184
def create_and_enqueue_job(
185-
self,
186-
func: FunctionReferenceType,
187-
args: Union[Tuple[Any, ...], List[Any], None] = None,
188-
kwargs: Optional[Dict[str, Any]] = None,
189-
when: Optional[datetime] = None,
190-
timeout: Optional[int] = None,
191-
result_ttl: Optional[int] = None,
192-
job_info_ttl: Optional[int] = None,
193-
description: Optional[str] = None,
194-
name: Optional[str] = None,
195-
at_front: bool = False,
196-
meta: Optional[Dict[str, Any]] = None,
197-
on_success: Optional[Callback] = None,
198-
on_failure: Optional[Callback] = None,
199-
on_stopped: Optional[Callback] = None,
200-
task_type: Optional[str] = None,
201-
scheduled_task_id: Optional[int] = None,
185+
self,
186+
func: FunctionReferenceType,
187+
args: Union[Tuple[Any, ...], List[Any], None] = None,
188+
kwargs: Optional[Dict[str, Any]] = None,
189+
when: Optional[datetime] = None,
190+
timeout: Optional[int] = None,
191+
result_ttl: Optional[int] = None,
192+
job_info_ttl: Optional[int] = None,
193+
description: Optional[str] = None,
194+
name: Optional[str] = None,
195+
at_front: bool = False,
196+
meta: Optional[Dict[str, Any]] = None,
197+
on_success: Optional[Callback] = None,
198+
on_failure: Optional[Callback] = None,
199+
on_stopped: Optional[Callback] = None,
200+
task_type: Optional[str] = None,
201+
scheduled_task_id: Optional[int] = None,
202202
) -> JobModel:
203203
"""Creates a job to represent the delayed function call and enqueues it.
204204
:param when: When to schedule the job (None to enqueue immediately)
@@ -249,7 +249,7 @@ def create_and_enqueue_job(
249249
return job_model
250250

251251
def job_handle_success(
252-
self, job: JobModel, result: Any, job_info_ttl: int, result_ttl: int, connection: ConnectionType
252+
self, job: JobModel, result: Any, job_info_ttl: int, result_ttl: int, connection: ConnectionType
253253
) -> None:
254254
"""Saves and cleanup job after successful execution"""
255255
job.after_execution(
@@ -308,7 +308,7 @@ def run_sync(self, job: JobModel) -> JobModel:
308308

309309
@classmethod
310310
def dequeue_any(
311-
cls, queues: List[Self], timeout: Optional[int], connection: ConnectionType
311+
cls, queues: List[Self], timeout: Optional[int], connection: ConnectionType
312312
) -> Tuple[Optional[JobModel], Optional[Self]]:
313313
"""Class method returning a Job instance at the front of the given set of Queues, where the order of the queues
314314
is important.
@@ -411,7 +411,7 @@ def delete_job(self, job_name: str, expire_job_model: bool = True) -> None:
411411
pass
412412

413413
def enqueue_job(
414-
self, job_model: JobModel, pipeline: Optional[PipelineType] = None, at_front: bool = False
414+
self, job_model: JobModel, pipeline: Optional[PipelineType] = None, at_front: bool = False
415415
) -> JobModel:
416416
"""Enqueues a job for delayed execution without checking dependencies.
417417

scheduler/tests/test_task_types/test_once_task.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ def test_admin_change_view__has_execution_list(self):
3939
# arrange
4040
self.client.login(username="admin", password="admin")
4141
task = task_factory(self.task_type)
42-
queue = get_queue(self.queue_name)
43-
job = JobModel.get(task.job_name, connection=queue.connection)
4442
url = reverse("admin:scheduler_task_change", args=(task.id,))
4543
# act
4644
res = self.client.get(url)

0 commit comments

Comments
 (0)