Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nopaque
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
9679ef80
Commit
9679ef80
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Add scheduler.
parent
0158f5be
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
app/__init__.py
+10
-1
10 additions, 1 deletion
app/__init__.py
app/scheduler/__init__.py
+5
-0
5 additions, 0 deletions
app/scheduler/__init__.py
app/scheduler/forms.py
+0
-0
0 additions, 0 deletions
app/scheduler/forms.py
app/scheduler/views.py
+21
-0
21 additions, 0 deletions
app/scheduler/views.py
with
36 additions
and
1 deletion
app/__init__.py
+
10
−
1
View file @
9679ef80
from
apscheduler.schedulers.background
import
BackgroundScheduler
from
config
import
config
from
flask
import
Flask
from
flask_login
import
LoginManager
...
...
@@ -6,11 +7,14 @@ from flask_sqlalchemy import SQLAlchemy
db
=
SQLAlchemy
()
mail
=
Mail
()
login_manager
=
LoginManager
()
login_manager
.
login_view
=
'
auth.login
'
mail
=
Mail
()
background_scheduler
=
BackgroundScheduler
()
def
create_app
(
config_name
):
app
=
Flask
(
__name__
)
...
...
@@ -27,4 +31,9 @@ def create_app(config_name):
from
.main
import
main
as
main_blueprint
app
.
register_blueprint
(
main_blueprint
)
from
.scheduler
import
scheduler
as
scheduler_blueprint
app
.
register_blueprint
(
scheduler_blueprint
,
url_prefix
=
'
/scheduler
'
)
background_scheduler
.
start
()
return
app
This diff is collapsed.
Click to expand it.
app/scheduler/__init__.py
0 → 100644
+
5
−
0
View file @
9679ef80
from
flask
import
Blueprint
scheduler
=
Blueprint
(
'
scheduler
'
,
__name__
)
from
.
import
views
This diff is collapsed.
Click to expand it.
app/scheduler/forms.py
0 → 100644
+
0
−
0
View file @
9679ef80
This diff is collapsed.
Click to expand it.
app/scheduler/views.py
0 → 100644
+
21
−
0
View file @
9679ef80
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
def
schedule
():
job
=
{
'
creator
'
:
current_user
.
id
,
'
files
'
:
[
'
file_1
'
,
'
file_2
'
,
'
file_3
'
],
'
service
'
:
'
ocr
'
,
'
args
'
:
{
'
lang
'
:
'
deu
'
}
}
job
=
background_scheduler
.
add_job
(
print
,
trigger
=
'
date
'
,
args
=
[
job
])
print
(
job
)
return
'
job
'
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment