Skip to content

Commit

Permalink
do not raise exception if recording is disabled (#558)
Browse files Browse the repository at this point in the history
  • Loading branch information
lilachmaliniak authored and kalturaguy committed Nov 22, 2017
1 parent 823e840 commit 67acc91
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions liveRecorder/Tasks/UploadTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ def upload_file(self, file_name, flavor_id, is_first_flavor):
job_result = threadWorkers.wait_jobs_done()
failed_jobs.extend(job_result)
self.check_stamp()

upload_session_json = str(vars(upload_session))

if len(failed_jobs) == 0:
Expand Down Expand Up @@ -98,6 +99,7 @@ def run(self):
mode = get_config('mode')
is_first_flavor = True
count_uploaded_mp4 = 0
code = ''
for mp4 in self.mp4_files_list:
try:
result = re.search(self.mp4_filename_pattern, mp4)
Expand All @@ -114,20 +116,26 @@ def run(self):
is_first_flavor = False
count_uploaded_mp4 += 1
except KalturaException as e:
code = e.code
if e.code == 'FLAVOR_PARAMS_ID_NOT_FOUND':
self.logger.warn('{}, failed to upload {}, flavor id {}'.format(e.message, mp4, flavor_id))
else:
raise e
if count_uploaded_mp4 == 0:
if len(self.mp4_files_list) > 0:
mp4_files = str(self.mp4_files_list)
err = Exception('failed to upload any of {} check log errors'.format(mp4_files))
err.code = code
raise err
else:
self.logger.warn('there were no mp4 files to upload. check {}'.format(self.recording_path))
except KalturaException as e:
self.logger.error('failed to upload VOD with error {}, exception details: {}'.format(e.code, e.message))
if e.code == 'KALTURA_RECORDING_DISABLED':
self.logger.warn("%s, move it to done directory", e.message)
elif e.code == 'ENTRY_ID_NOT_FOUND':
self.logger.warn("%s, move it to done directory", e.message)
else:
raise e
if count_uploaded_mp4 == 0:
mp4_files = str(self.mp4_files_list)
err = Exception('failed to upload any of [{}] check log errors'.format(mp4_files))
raise err


0 comments on commit 67acc91

Please sign in to comment.