mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2025-01-31 11:59:02 +00:00
23 lines
591 B
Python
23 lines
591 B
Python
from ..decorators import background
|
|
from ..models import Job
|
|
|
|
|
|
@background
|
|
def delete_job(job_id, *args, **kwargs):
|
|
app = kwargs['app']
|
|
with app.app_context():
|
|
job = Job.query.get(job_id)
|
|
if job is None:
|
|
raise Exception('Could not find job with id {}'.format(job_id))
|
|
job.delete()
|
|
|
|
|
|
@background
|
|
def restart_job(job_id, *args, **kwargs):
|
|
app = kwargs['app']
|
|
with app.app_context():
|
|
job = Job.query.get(job_id)
|
|
if job is None:
|
|
raise Exception('Could not find job with id {}'.format(job_id))
|
|
job.restart()
|