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
Admin message
Looking for advice? Join the
Matrix channel for GitLab users in Bielefeld
!
Show more breadcrumbs
SFB 1288 - INF
nopaque
Commits
bb2b0294
Commit
bb2b0294
authored
5 years ago
by
Patrick Jentsch
Browse files
Options
Downloads
Patches
Plain Diff
Add rudimentary job handler
parent
c2139500
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/scheduler/views.py
+19
-2
19 additions, 2 deletions
app/scheduler/views.py
with
19 additions
and
2 deletions
app/scheduler/views.py
+
19
−
2
View file @
bb2b0294
...
...
@@ -3,6 +3,7 @@ from . import scheduler
from
flask_login
import
current_user
,
login_required
from
..
import
background_scheduler
import
json
import
subprocess
@scheduler.route
(
'
/
'
)
...
...
@@ -17,6 +18,22 @@ def scheduler():
},
'
status
'
:
'
queued
'
}
job
=
background_scheduler
.
add_job
(
print
,
trigger
=
'
date
'
,
args
=
[
job
])
print
(
background_scheduler
.
get_jobs
())
job
=
background_scheduler
.
add_job
(
process_job
,
trigger
=
'
date
'
,
args
=
[
job
])
print
(
'
### New job added for scheduling ###
'
)
print
(
job
)
return
render_template
(
'
scheduler/index.html.j2
'
,
title
=
'
Scheduler
'
)
def
process_job
(
job
):
input_dir
=
'
/home/pjentsch/%s/input
'
%
job
[
'
service
'
]
output_dir
=
'
/home/pjentsch/%s/output
'
%
job
[
'
service
'
]
job
[
'
status
'
]
=
'
running
'
print
(
'
### Job status changed ###
'
)
print
(
job
)
subprocess
.
run
([
job
[
'
service
'
],
'
-i
'
,
input_dir
,
'
-l
'
,
job
[
'
service_args
'
][
'
lang
'
],
'
-o
'
,
output_dir
,
'
--keep-intermediates
'
])
job
[
'
status
'
]
=
'
finished
'
print
(
'
### Job status changed ###
'
)
print
(
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