Skip to content

Commit 8cd41d8

Browse files
committed
black
1 parent f72b398 commit 8cd41d8

File tree

6 files changed

+27
-20
lines changed

6 files changed

+27
-20
lines changed

scheduler/admin/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
from .task_models import TaskAdmin as OldTaskAdmin # noqa: F401
22
from .ephemeral_models import QueueAdmin, WorkerAdmin # noqa: F401
3-
from .task_admin import TaskAdmin # noqa: F401
3+
from .task_admin import TaskAdmin # noqa: F401

scheduler/management/commands/rqworker.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,7 @@ def handle(self, **options):
118118

119119
try:
120120
# Instantiate a worker
121-
w = create_worker(
122-
*queues,
123-
**init_options
124-
)
121+
w = create_worker(*queues, **init_options)
125122

126123
# Close any opened DB connection before any fork
127124
reset_db_connections()

scheduler/models/scheduled_task.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ class ScheduledTask(ScheduledTimeMixin, BaseTask):
395395

396396
def ready_for_schedule(self) -> bool:
397397
return super(ScheduledTask, self).ready_for_schedule() and (
398-
self.scheduled_time is None or self.scheduled_time >= timezone.now()
398+
self.scheduled_time is None or self.scheduled_time >= timezone.now()
399399
)
400400

401401
class Meta:

scheduler/models/task.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,7 @@ class TimeUnits(models.TextChoices):
9393
)
9494
queue = models.CharField(_("queue"), max_length=255, choices=get_queue_choices, help_text=_("Queue name"))
9595
job_id = models.CharField(
96-
_("job id"), max_length=128, editable=False, blank=True, null=True,
97-
help_text=_("Current job_id on queue")
96+
_("job id"), max_length=128, editable=False, blank=True, null=True, help_text=_("Current job_id on queue")
9897
)
9998
at_front = models.BooleanField(
10099
_("At front"),
@@ -147,10 +146,18 @@ class TimeUnits(models.TextChoices):
147146
help_text=_("Last time the task has failed"),
148147
)
149148
interval = models.PositiveIntegerField(
150-
_("interval"), blank=True, null=True,
151-
help_text=_("Interval for repeatable task"), )
149+
_("interval"),
150+
blank=True,
151+
null=True,
152+
help_text=_("Interval for repeatable task"),
153+
)
152154
interval_unit = models.CharField(
153-
_("interval unit"), max_length=12, choices=TimeUnits.choices, default=TimeUnits.HOURS, blank=True, null=True,
155+
_("interval unit"),
156+
max_length=12,
157+
choices=TimeUnits.choices,
158+
default=TimeUnits.HOURS,
159+
blank=True,
160+
null=True,
154161
)
155162
repeat = models.PositiveIntegerField(
156163
_("repeat"),
@@ -161,7 +168,9 @@ class TimeUnits(models.TextChoices):
161168
scheduled_time = models.DateTimeField(_("scheduled time"))
162169
cron_string = models.CharField(
163170
_("cron string"),
164-
max_length=64, blank=True, null=True,
171+
max_length=64,
172+
blank=True,
173+
null=True,
165174
help_text=mark_safe(
166175
"""Define the schedule in a crontab like syntax.
167176
Times are in UTC. Use <a href="https://crontab.guru/">crontab.guru</a> to create a cron string."""

scheduler/queues.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ def get_connection(queue_settings, use_strict_redis=False):
8787

8888

8989
def get_queue(
90-
name="default", default_timeout=None, is_async=None, autocommit=None, connection=None, **kwargs
90+
name="default", default_timeout=None, is_async=None, autocommit=None, connection=None, **kwargs
9191
) -> DjangoQueue:
9292
"""Returns an DjangoQueue using parameters defined in `SCHEDULER_QUEUES`"""
9393
from .settings import QUEUES

scheduler/rq_classes.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,9 @@ def is_scheduled_task(self) -> bool:
6262
return self.meta.get("scheduled_task_id", None) is not None
6363

6464
def is_execution_of(self, task: "ScheduledTask") -> bool: # noqa: F821
65-
return (self.meta.get("task_type", None) == task.TASK_TYPE
66-
and self.meta.get("scheduled_task_id", None) == task.id)
65+
return (
66+
self.meta.get("task_type", None) == task.TASK_TYPE and self.meta.get("scheduled_task_id", None) == task.id
67+
)
6768

6869
def stop_execution(self, connection: ConnectionType):
6970
send_stop_job_command(connection, self.id)
@@ -91,11 +92,11 @@ def __str__(self):
9192
return f"{self.name}/{','.join(self.queue_names())}"
9293

9394
def _start_scheduler(
94-
self,
95-
burst: bool = False,
96-
logging_level: str = "INFO",
97-
date_format: str = "%H:%M:%S",
98-
log_format: str = "%(asctime)s %(message)s",
95+
self,
96+
burst: bool = False,
97+
logging_level: str = "INFO",
98+
date_format: str = "%H:%M:%S",
99+
log_format: str = "%(asctime)s %(message)s",
99100
) -> None:
100101
"""Starts the scheduler process.
101102
This is specifically designed to be run by the worker when running the `work()` method.

0 commit comments

Comments
 (0)