Skip to content
This repository has been archived by the owner on Oct 1, 2020. It is now read-only.

Commit

Permalink
Merge pull request #79 from edx/mrehan/improve-logging
Browse files Browse the repository at this point in the history
Improve logging and add an option to run 3play translations.
  • Loading branch information
Qubad786 authored Dec 20, 2017
2 parents e86f0a8 + b7a9eaf commit d7d046f
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
10 changes: 10 additions & 0 deletions VEDA_OS01/transcripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,11 @@ def handle_video_translations(video, translations, file_id, api_key, log_prefix)
translation_state = translation_metadata['state']
target_language = translation_metadata['target_language_iso_639_1_code']

LOGGER.info(
'[3PlayMedia Task] Translation metadata retrieved -- video=%s, translation_id=%s, language=%s, status=%s.',
video.studio_id, translation_id, target_language, translation_state
)

if translation_state == COMPLETE:
# Fetch the corresponding tracking process.
translation_process = get_in_progress_translation_process(
Expand Down Expand Up @@ -1016,6 +1021,11 @@ def handle_video_translations(video, translations, file_id, api_key, log_prefix)
provider=TranscriptProvider.THREE_PLAY,
)

LOGGER.info(
'[3PlayMedia Task] Translation retrieval was successful -- video=%s, translation_id=%s, language=%s.',
video.studio_id, translation_id, target_language
)

# 5 - if all the processes for this video are complete, update transcript status
# for video in edx-val as well as edx-video-pipeline.
video_jobs = TranscriptProcessMetadata.objects.filter(video=video)
Expand Down
18 changes: 17 additions & 1 deletion bin/heal
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,8 @@ def main():
{cmd} -i veda_id
{cmd} -c course_id
{cmd} -s schedule
[-i -c -s]
{cmd} --process-translations
[-i -c -s --process-translations]
Use --help to see all options.
'''.format(cmd=sys.argv[0])

Expand All @@ -71,12 +72,27 @@ def main():
action='store_true'
)

parser.add_argument(
'--process-translations',
dest='process_translations',
help='Retrieves completed 3PlayMedia translations for the videos.',
action='store_true'
)

args = parser.parse_args()

veda_id = args.veda_id
course_id = args.course_id
schedule = args.schedule

process_translations = args.process_translations
if process_translations:
# Only kick off a round of retrieving successful
# translations from 3Play Media
os.environ['DJANGO_SETTINGS_MODULE'] = 'VEDA.settings.production'
retrieve_three_play_translations()
return

print '%s - %s: %s' % ('Healing', 'VEDA ID', veda_id)
print '%s - %s: %s' % ('Healing', 'Course', course_id)

Expand Down

0 comments on commit d7d046f

Please sign in to comment.