Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Jannik Hellenkamp
website
Commits
900b4718
Unverified
Commit
900b4718
authored
6 years ago
by
Andreas Valder
Browse files
Options
Downloads
Patches
Plain Diff
cleaned up schedule functions
parent
40459a09
No related branches found
No related tags found
Loading
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
jobmanagement.py
+4
-4
4 additions, 4 deletions
jobmanagement.py
jobtypes.py
+2
-2
2 additions, 2 deletions
jobtypes.py
with
6 additions
and
6 deletions
jobmanagement.py
+
4
−
4
View file @
900b4718
...
@@ -51,11 +51,11 @@ def schedule_job(jobtype, data=None, priority=0, queue="default"):
...
@@ -51,11 +51,11 @@ def schedule_job(jobtype, data=None, priority=0, queue="default"):
return
modify
(
'
INSERT INTO jobs (type, priority, queue, data, time_created) VALUES (?, ?, ?, ?, ?)
'
,
return
modify
(
'
INSERT INTO jobs (type, priority, queue, data, time_created) VALUES (?, ?, ?, ?, ?)
'
,
jobtype
,
priority
,
queue
,
json
.
dumps
(
data
,
default
=
date_json_handler
),
datetime
.
now
())
jobtype
,
priority
,
queue
,
json
.
dumps
(
data
,
default
=
date_json_handler
),
datetime
.
now
())
def
cancel_job
(
job_id
):
def
cancel_job
(
job_id
):
modif
y
(
'
UPDATE jobs SET state =
"
deleted
"
WHERE id = ? AND state =
"
ready
"'
,
job_id
)
quer
y
(
'
UPDATE jobs SET state =
"
deleted
"
WHERE id = ? AND state =
"
ready
"'
,
job_id
)
modif
y
(
'
UPDATE jobs SET canceled = 1 WHERE id = ?
'
,
job_id
)
quer
y
(
'
UPDATE jobs SET canceled = 1 WHERE id = ?
'
,
job_id
)
def
restart_job
(
job_id
,
canceled
=
False
):
def
restart_job
(
job_id
,
canceled
=
False
):
if
canceled
:
if
canceled
:
modif
y
(
'
UPDATE jobs SET state =
"
ready
"
, canceled = 0 WHERE id = ? AND state =
"
failed
"'
,
job_id
)
quer
y
(
'
UPDATE jobs SET state =
"
ready
"
, canceled = 0 WHERE id = ? AND state =
"
failed
"'
,
job_id
)
else
:
else
:
modif
y
(
'
UPDATE jobs SET state =
"
ready
"
WHERE id = ? AND state =
"
failed
"
AND NOT canceled
'
,
job_id
)
quer
y
(
'
UPDATE jobs SET state =
"
ready
"
WHERE id = ? AND state =
"
failed
"
AND NOT canceled
'
,
job_id
)
This diff is collapsed.
Click to expand it.
jobtypes.py
+
2
−
2
View file @
900b4718
...
@@ -19,7 +19,7 @@ def schedule_thumbnail(lectureid):
...
@@ -19,7 +19,7 @@ def schedule_thumbnail(lectureid):
JOIN formats ON (videos.video_format = formats.id)
JOIN formats ON (videos.video_format = formats.id)
WHERE videos.lecture_id = ?
WHERE videos.lecture_id = ?
ORDER BY formats.prio DESC
'''
,
lectureid
)
ORDER BY formats.prio DESC
'''
,
lectureid
)
schedule_job
(
'
thumbnail
'
,
{
'
lectureid
'
:
str
(
lectureid
),
'
path
'
:
videos
[
0
][
'
path
'
]})
return
schedule_job
(
'
thumbnail
'
,
{
'
lectureid
'
:
str
(
lectureid
),
'
path
'
:
videos
[
0
][
'
path
'
]})
def
schedule_remux
(
lectureid
,
videoid
=
None
):
def
schedule_remux
(
lectureid
,
videoid
=
None
):
...
@@ -73,5 +73,5 @@ def schedule_transcode(source, fmt_id=None, video=None):
...
@@ -73,5 +73,5 @@ def schedule_transcode(source, fmt_id=None, video=None):
data
[
'
lecture_id
'
]
=
lecture
[
'
id
'
]
data
[
'
lecture_id
'
]
=
lecture
[
'
id
'
]
data
[
'
format_id
'
]
=
fmt
[
'
id
'
]
data
[
'
format_id
'
]
=
fmt
[
'
id
'
]
data
[
'
source_id
'
]
=
source
[
'
id
'
]
data
[
'
source_id
'
]
=
source
[
'
id
'
]
schedule_job
(
'
transcode
'
,
data
,
queue
=
"
background
"
)
return
schedule_job
(
'
transcode
'
,
data
,
queue
=
"
background
"
)
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