Skip to content
Snippets Groups Projects
Commit 2146d721 authored by irfanuddinahmad's avatar irfanuddinahmad Committed by M. Rehan
Browse files

fixed migrate command's aws settings issues

parent c02283b4
No related merge requests found
......@@ -228,13 +228,18 @@ class TestMigrateTranscripts(ModuleStoreTestCase):
'[Transcript migration] Migrating 2 transcripts'),
(LOGGER_NAME,
'INFO',
u'[Transcript migration] process for course {} ended. Processed 2 transcripts'.format(
'[Transcript migration] Result: Language hr transcript of video test_edx_video_id will be migrated'),
(LOGGER_NAME,
'INFO',
'[Transcript migration] Result: Language ge transcript of video test_edx_video_id will be migrated'),
(LOGGER_NAME,
'INFO',
u'[Transcript migration] task submission for course {} ended.'.format(
unicode(self.course.id)
)),
(LOGGER_NAME,
'INFO',
'[Transcript migration] Result: Language hr transcript of video test_edx_video_id will be migrated'
'\nLanguage ge transcript of video test_edx_video_id will be migrated')
"[Transcript migration] Result: None")
)
with LogCapture(LOGGER_NAME, level=logging.INFO) as logger:
......@@ -264,13 +269,16 @@ class TestMigrateTranscripts(ModuleStoreTestCase):
"[Transcript migration] Exception: u'No transcript for `ge` language'"),
(LOGGER_NAME,
'INFO',
u'[Transcript migration] process for course {} ended. Processed 1 transcripts'.format(
"[Transcript migration] Result: Failed: language ge of video test_edx_video_id_2 with exception "
"No transcript for `ge` language"),
(LOGGER_NAME,
'INFO',
u'[Transcript migration] task submission for course {} ended.'.format(
unicode(self.course_2.id)
)),
(LOGGER_NAME,
'INFO',
"[Transcript migration] Result: Failed: language ge of video test_edx_video_id_2 with exception "
"No transcript for `ge` language")
"[Transcript migration] Result: None")
)
with LogCapture(LOGGER_NAME, level=logging.INFO) as logger:
......
......@@ -26,7 +26,7 @@ from django.utils.text import get_valid_filename
from django.utils.translation import ugettext as _
from djcelery.common import respect_language
from opaque_keys.edx.keys import CourseKey
from opaque_keys.edx.locator import LibraryLocator
from opaque_keys.edx.locator import LibraryLocator, BlockUsageLocator
from organizations.models import OrganizationCourse
from path import Path as path
from pytz import UTC
......@@ -106,9 +106,7 @@ def enqueue_async_migrate_transcripts_tasks(
) for course_key in course_keys
]
callback = task_status_callback.s()
status = chord(tasks)(callback)
for res in status.get():
LOGGER.info("[Transcript migration] Result: %s", '\n'.join(res))
chord(tasks)(callback)
@chord_task
......@@ -116,7 +114,11 @@ def task_status_callback(results):
"""
Callback for collating the results of chord.
"""
return results
try:
for res in results:
LOGGER.info("[Transcript migration] Result: %s", res)
except TypeError:
pass
@chord_task(
......@@ -161,21 +163,19 @@ def async_migrate_transcript(self, course_key, **kwargs):
)
if transcript_already_present and force_update:
sub_tasks.append(async_migrate_transcript_subtask.s(
video, lang, True, **kwargs
unicode(video.location), lang, True, **kwargs
))
elif not transcript_already_present:
sub_tasks.append(async_migrate_transcript_subtask.s(
video, lang, False, **kwargs
unicode(video.location), lang, False, **kwargs
))
LOGGER.info("[Transcript migration] Migrating %s transcripts", len(sub_tasks))
callback = task_status_callback.s()
status = chord(sub_tasks)(callback)
chord(sub_tasks)(callback)
LOGGER.info(
"[Transcript migration] process for course %s ended. Processed %s transcripts",
course_key,
len(status.get())
"[Transcript migration] task submission for course %s ended.",
course_key
)
return status.get()
def get_videos_from_store(course_key):
......@@ -210,7 +210,9 @@ def async_migrate_transcript_subtask(self, *args, **kwargs):
"""
Migrates a transcript of a given video in a course as a new celery task.
"""
video, language_code, force_update = args
video_location, language_code, force_update = args
store = modulestore()
video = store.get_item(usage_key=BlockUsageLocator.from_string(video_location))
commit = kwargs['commit']
result = None
if commit is not True:
......
......@@ -869,6 +869,9 @@ WEBPACK_CONFIG_PATH = 'webpack.prod.config.js'
################################# CELERY ######################################
# Auto discover tasks fails to detect contentstore tasks
CELERY_IMPORTS = ('cms.djangoapps.contentstore.tasks')
# Message configuration
CELERY_TASK_SERIALIZER = 'json'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment