Codestyle enhancements

This commit is contained in:
Patrick Jentsch
2021-12-08 14:45:05 +01:00
parent 1fd7a2e38c
commit 3d99b8770c
10 changed files with 44 additions and 41 deletions

View File

@ -48,10 +48,10 @@ def download_job_input(job_id, job_input_id):
def restart(job_id):
job = Job.query.get_or_404(job_id)
if job.status not in ['complete', 'failed']:
flash('Can not restart job "{}": Status is not "complete/failed"'.format(job.title), 'error') # noqa
flash(f'Can not restart job "{job.title}": Status is not "complete/failed"', 'error') # noqa
else:
tasks.restart_job(job_id)
flash('Job "{}" has been marked to get restarted!'.format(job.title), 'job') # noqa
flash(f'Job "{job.title}" marked to get restarted!', 'job')
return redirect(url_for('.job', job_id=job_id))

View File

@ -8,7 +8,7 @@ def delete_job(job_id, *args, **kwargs):
with kwargs['app'].app_context():
job = Job.query.get(job_id)
if job is None:
raise Exception('Job {} not found'.format(job_id))
raise Exception(f'Job {job_id} not found')
job.delete()
db.session.commit()
@ -18,7 +18,7 @@ def restart_job(job_id, *args, **kwargs):
with kwargs['app'].app_context():
job = Job.query.get(job_id)
if job is None:
raise Exception('Job {} not found'.format(job_id))
raise Exception(f'Job {job_id} not found')
try:
job.restart()
except Exception: