Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Roman Karwacik
website
Commits
40459a09
Unverified
Commit
40459a09
authored
Jul 18, 2018
by
Andreas Valder
Browse files
throw exception if the video hash missmatches and log exceptions to mail
parent
50ac6417
Changes
2
Hide whitespace changes
Inline
Side-by-side
jobmanagement.py
View file @
40459a09
from
server
import
modify
,
query
,
date_json_handler
,
sched_func
from
server
import
modify
,
query
,
date_json_handler
,
sched_func
,
notify_admins
from
datetime
import
datetime
,
timedelta
import
traceback
import
json
...
...
@@ -22,6 +22,7 @@ def job_handler_handle(id, state):
try
:
func
(
id
,
job
[
'type'
],
json
.
loads
(
job
[
'data'
]),
state
,
json
.
loads
(
job
[
'status'
]))
except
Exception
:
notify_admins
(
'scheduler_exception'
,
name
=
func
.
__name__
,
traceback
=
traceback
.
format_exc
())
traceback
.
print_exc
()
@
sched_func
(
10
)
...
...
sorter.py
View file @
40459a09
...
...
@@ -35,8 +35,7 @@ def update_video_metadata(jobid, jobtype, data, state, status):
if
jobtype
not
in
[
'remux'
,
'transcode'
]:
video
=
query
(
'SELECT * FROM videos WHERE id = ?'
,
data
[
'video_id'
])[
0
]
if
video
[
'hash'
]
and
video
[
'hash'
]
!=
status
[
'hash'
]:
print
(
'Hash mismatch for video'
,
data
[
'video_id'
])
return
raise
Exception
(
'Hash mismatch for video {}'
.
format
(
data
[
'video_id'
]))
modify
(
'UPDATE videos_data SET hash = ?, file_size = ?, duration = ? WHERE id = ?'
,
status
[
'hash'
],
status
[
'filesize'
],
status
[
'duration'
],
data
[
'video_id'
])
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment