1
0
Fork 0

formatting and pylint fixes

This commit is contained in:
Hugh Rundle 2023-10-22 16:52:29 +11:00
parent b34a491172
commit fd1ebf5f71
No known key found for this signature in database
GPG key ID: A7E35779918253F9
11 changed files with 91 additions and 63 deletions

View file

@ -31,6 +31,8 @@ class Job(models.Model):
)
class Meta:
"""Make it abstract"""
abstract = True
def complete_job(self):
@ -119,7 +121,7 @@ class ParentJob(Job):
if not self.complete and self.has_completed:
self.complete_job()
def __terminate_job(self):
def __terminate_job(self): # pylint: disable=unused-private-member
"""Tell workers to ignore and not execute this task
& pending child tasks. Extend.
"""
@ -183,7 +185,9 @@ class ParentTask(app.Task):
Usage e.g. @app.task(base=ParentTask)
"""
def before_start(self, task_id, args, kwargs):
def before_start(
self, task_id, args, kwargs
): # pylint: disable=no-self-use, unused-argument
"""Handler called before the task starts. Override.
Prepare ParentJob before the task starts.
@ -208,7 +212,9 @@ class ParentTask(app.Task):
if kwargs["no_children"]:
job.set_status(ChildJob.Status.ACTIVE)
def on_success(self, retval, task_id, args, kwargs):
def on_success(
self, retval, task_id, args, kwargs
): # pylint: disable=no-self-use, unused-argument
"""Run by the worker if the task executes successfully. Override.
Update ParentJob on Task complete.
@ -241,7 +247,9 @@ class SubTask(app.Task):
Usage e.g. @app.task(base=SubTask)
"""
def before_start(self, task_id, args, kwargs):
def before_start(
self, task_id, args, kwargs
): # pylint: disable=no-self-use, unused-argument
"""Handler called before the task starts. Override.
Prepare ChildJob before the task starts.
@ -263,7 +271,9 @@ class SubTask(app.Task):
child_job.save(update_fields=["task_id"])
child_job.set_status(ChildJob.Status.ACTIVE)
def on_success(self, retval, task_id, args, kwargs):
def on_success(
self, retval, task_id, args, kwargs
): # pylint: disable=no-self-use, unused-argument
"""Run by the worker if the task executes successfully. Override.
Notify ChildJob of task completion.