2019-07-10 11:41:48 +00:00
|
|
|
from flask import render_template
|
|
|
|
from . import scheduler
|
|
|
|
from flask_login import current_user, login_required
|
|
|
|
from .. import background_scheduler
|
|
|
|
import json
|
|
|
|
|
|
|
|
|
|
|
|
@scheduler.route('/')
|
|
|
|
@login_required
|
2019-07-10 12:20:22 +00:00
|
|
|
def scheduler():
|
2019-07-10 11:41:48 +00:00
|
|
|
job = {
|
|
|
|
'creator': current_user.id,
|
|
|
|
'files': ['file_1', 'file_2', 'file_3'],
|
|
|
|
'service': 'ocr',
|
2019-07-10 12:37:31 +00:00
|
|
|
'service_args': {
|
2019-07-10 11:41:48 +00:00
|
|
|
'lang': 'deu'
|
2019-07-10 12:37:31 +00:00
|
|
|
},
|
|
|
|
'status': 'queued'
|
2019-07-10 11:41:48 +00:00
|
|
|
}
|
|
|
|
job = background_scheduler.add_job(print, trigger='date', args=[job])
|
2019-07-10 12:37:31 +00:00
|
|
|
print(background_scheduler.get_jobs())
|
2019-07-10 12:20:22 +00:00
|
|
|
return render_template('scheduler/index.html.j2', title='Scheduler')
|