Skip to content

Commit 72766a3

Browse files
committed
format
1 parent 1f8439f commit 72766a3

File tree

7 files changed

+63
-62
lines changed

7 files changed

+63
-62
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
test-regular:
3131
needs: [ 'ruff' ]
3232
runs-on: ubuntu-latest
33-
name: "Run tests ${{ matrix.python-version }}/${{ matrix.django-version }}/${{ matrix.broker }}"
33+
name: "Tests py${{ matrix.python-version }}/dj${{ matrix.django-version }}/${{ matrix.broker }}"
3434
strategy:
3535
max-parallel: 6
3636
matrix:

scheduler/helpers/queues/queue_logic.py

+24-24
Original file line numberDiff line numberDiff line change
@@ -176,24 +176,24 @@ def get_all_jobs(self) -> List[JobModel]:
176176
return JobModel.get_many(job_names, connection=self.connection)
177177

178178
def create_and_enqueue_job(
179-
self,
180-
func: FunctionReferenceType,
181-
args: Union[Tuple, List, None] = None,
182-
kwargs: Optional[Dict] = None,
183-
when: Optional[datetime] = None,
184-
timeout: Optional[int] = None,
185-
result_ttl: Optional[int] = None,
186-
job_info_ttl: Optional[int] = None,
187-
description: Optional[str] = None,
188-
name: Optional[str] = None,
189-
at_front: bool = False,
190-
meta: Optional[Dict] = None,
191-
on_success: Optional[Callback] = None,
192-
on_failure: Optional[Callback] = None,
193-
on_stopped: Optional[Callback] = None,
194-
task_type: Optional[str] = None,
195-
scheduled_task_id: Optional[int] = None,
196-
pipeline: Optional[ConnectionType] = None,
179+
self,
180+
func: FunctionReferenceType,
181+
args: Union[Tuple, List, None] = None,
182+
kwargs: Optional[Dict] = None,
183+
when: Optional[datetime] = None,
184+
timeout: Optional[int] = None,
185+
result_ttl: Optional[int] = None,
186+
job_info_ttl: Optional[int] = None,
187+
description: Optional[str] = None,
188+
name: Optional[str] = None,
189+
at_front: bool = False,
190+
meta: Optional[Dict] = None,
191+
on_success: Optional[Callback] = None,
192+
on_failure: Optional[Callback] = None,
193+
on_stopped: Optional[Callback] = None,
194+
task_type: Optional[str] = None,
195+
scheduled_task_id: Optional[int] = None,
196+
pipeline: Optional[ConnectionType] = None,
197197
) -> JobModel:
198198
"""Creates a job to represent the delayed function call and enqueues it.
199199
:param when: When to schedule the job (None to enqueue immediately)
@@ -245,7 +245,7 @@ def create_and_enqueue_job(
245245
return job_model
246246

247247
def job_handle_success(
248-
self, job: JobModel, result: Any, job_info_ttl: int, result_ttl: int, connection: ConnectionType
248+
self, job: JobModel, result: Any, job_info_ttl: int, result_ttl: int, connection: ConnectionType
249249
):
250250
"""Saves and cleanup job after successful execution"""
251251
job.after_execution(
@@ -304,10 +304,10 @@ def run_sync(self, job: JobModel) -> JobModel:
304304

305305
@classmethod
306306
def dequeue_any(
307-
cls,
308-
queues: List[Self],
309-
timeout: Optional[int],
310-
connection: Optional[ConnectionType] = None,
307+
cls,
308+
queues: List[Self],
309+
timeout: Optional[int],
310+
connection: Optional[ConnectionType] = None,
311311
) -> Tuple[Optional[JobModel], Optional[Self]]:
312312
"""Class method returning a Job instance at the front of the given set of Queues, where the order of the queues
313313
is important.
@@ -410,7 +410,7 @@ def delete_job(self, job_name: str, expire_job_model: bool = True) -> None:
410410
pass
411411

412412
def enqueue_job(
413-
self, job_model: JobModel, connection: Optional[ConnectionType] = None, at_front: bool = False
413+
self, job_model: JobModel, connection: Optional[ConnectionType] = None, at_front: bool = False
414414
) -> JobModel:
415415
"""Enqueues a job for delayed execution without checking dependencies.
416416

scheduler/redis_models/job.py

+27-27
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,12 @@ def prepare_for_execution(self, worker_name: str, registry: JobNamesRegistry, co
125125
self.save(connection=connection)
126126

127127
def after_execution(
128-
self,
129-
job_info_ttl: int,
130-
status: JobStatus,
131-
connection: ConnectionType,
132-
prev_registry: Optional[JobNamesRegistry] = None,
133-
new_registry: Optional[JobNamesRegistry] = None,
128+
self,
129+
job_info_ttl: int,
130+
status: JobStatus,
131+
connection: ConnectionType,
132+
prev_registry: Optional[JobNamesRegistry] = None,
133+
new_registry: Optional[JobNamesRegistry] = None,
134134
) -> None:
135135
"""After the job is executed, update the status, heartbeat, and other metadata."""
136136
self.status = status
@@ -168,26 +168,26 @@ def get_call_string(self):
168168

169169
@classmethod
170170
def create(
171-
cls,
172-
connection: ConnectionType,
173-
func: FunctionReferenceType,
174-
queue_name: str,
175-
args: Union[List[Any], Optional[Tuple]] = None,
176-
kwargs: Optional[Dict[str, Any]] = None,
177-
result_ttl: Optional[int] = None,
178-
job_info_ttl: Optional[int] = None,
179-
status: Optional[JobStatus] = None,
180-
description: Optional[str] = None,
181-
timeout: Optional[int] = None,
182-
name: Optional[str] = None,
183-
task_type: Optional[str] = None,
184-
scheduled_task_id: Optional[int] = None,
185-
meta: Optional[Dict[str, Any]] = None,
186-
*,
187-
on_success: Optional[Callback] = None,
188-
on_failure: Optional[Callback] = None,
189-
on_stopped: Optional[Callback] = None,
190-
at_front: Optional[bool] = None,
171+
cls,
172+
connection: ConnectionType,
173+
func: FunctionReferenceType,
174+
queue_name: str,
175+
args: Union[List[Any], Optional[Tuple]] = None,
176+
kwargs: Optional[Dict[str, Any]] = None,
177+
result_ttl: Optional[int] = None,
178+
job_info_ttl: Optional[int] = None,
179+
status: Optional[JobStatus] = None,
180+
description: Optional[str] = None,
181+
timeout: Optional[int] = None,
182+
name: Optional[str] = None,
183+
task_type: Optional[str] = None,
184+
scheduled_task_id: Optional[int] = None,
185+
meta: Optional[Dict[str, Any]] = None,
186+
*,
187+
on_success: Optional[Callback] = None,
188+
on_failure: Optional[Callback] = None,
189+
on_stopped: Optional[Callback] = None,
190+
at_front: Optional[bool] = None,
191191
) -> Self:
192192
"""Creates a new job-model for the given function, arguments, and keyword arguments.
193193
:returns: A job-model instance.
@@ -261,7 +261,7 @@ def create(
261261

262262

263263
def _get_call_string(
264-
func_name: Optional[str], args: Any, kwargs: Dict[Any, Any], max_length: Optional[int] = None
264+
func_name: Optional[str], args: Any, kwargs: Dict[Any, Any], max_length: Optional[int] = None
265265
) -> Optional[str]:
266266
"""
267267
Returns a string representation of the call, formatted as a regular

scheduler/redis_models/registry/base_registry.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def key(self) -> str:
8686

8787
@classmethod
8888
def pop(
89-
cls, connection: ConnectionType, registries: Sequence[Self], timeout: Optional[int]
89+
cls, connection: ConnectionType, registries: Sequence[Self], timeout: Optional[int]
9090
) -> Tuple[Optional[str], Optional[str]]:
9191
"""Helper method to abstract away from some Redis API details
9292

scheduler/redis_models/result.py

+8-8
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ class Result(StreamModel):
3131

3232
@classmethod
3333
def create(
34-
cls,
35-
connection: ConnectionType,
36-
job_name: str,
37-
worker_name: str,
38-
_type: ResultType,
39-
ttl: int,
40-
return_value: Any = None,
41-
exc_string: Optional[str] = None,
34+
cls,
35+
connection: ConnectionType,
36+
job_name: str,
37+
worker_name: str,
38+
_type: ResultType,
39+
ttl: int,
40+
return_value: Any = None,
41+
exc_string: Optional[str] = None,
4242
) -> Self:
4343
result = cls(
4444
parent=job_name,

scheduler/redis_models/worker.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,4 +118,4 @@ def _split_list(a_list: List[str], segment_size: int) -> Generator[list[str], An
118118
:returns: The list split into smaller lists
119119
"""
120120
for i in range(0, len(a_list), segment_size):
121-
yield a_list[i: i + segment_size]
121+
yield a_list[i : i + segment_size]

scheduler/views/job_views.py

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class JobDetailAction(str, Enum):
2020
ENQUEUE = "enqueue"
2121
CANCEL = "cancel"
2222

23+
2324
@never_cache
2425
@staff_member_required
2526
def job_detail(request: HttpRequest, job_name: str) -> HttpResponse:

0 commit comments

Comments
 (0)