Example #1
0
def listen_for_course_publish(sender, course_key, **kwargs):  # pylint: disable=unused-argument
    """
    Receives publishing signal and performs publishing related workflows, such as
    registering proctored exams, building up credit requirements, and performing
    search indexing
    """
    # import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
    from cms.djangoapps.contentstore.tasks import (
        update_outline_from_modulestore_task,
        update_search_index,
        update_special_exams_and_publish
    )

    # register special exams asynchronously
    course_key_str = str(course_key)
    update_special_exams_and_publish.delay(course_key_str)

    if key_supports_outlines(course_key):
        # Push the course outline to learning_sequences asynchronously.
        update_outline_from_modulestore_task.delay(course_key_str)

    # Finally call into the course search subsystem
    # to kick off an indexing action
    if CoursewareSearchIndexer.indexing_is_enabled() and CourseAboutSearchIndexer.indexing_is_enabled():
        update_search_index.delay(course_key_str, datetime.now(UTC).isoformat())
Example #2
0
def listen_for_course_publish(sender, course_key, **kwargs):  # pylint: disable=unused-argument
    """
    Receives publishing signal and performs publishing related workflows, such as
    registering proctored exams, building up credit requirements, and performing
    search indexing
    """

    # first is to registered exams, the credit subsystem will assume that
    # all proctored exams have already been registered, so we have to do that first
    try:
        register_special_exams(course_key)
    # pylint: disable=broad-except
    except Exception as exception:
        log.exception(exception)

    # then call into the credit subsystem (in /openedx/djangoapps/credit)
    # to perform any 'on_publish' workflow
    on_course_publish(course_key)

    # Finally call into the course search subsystem
    # to kick off an indexing action
    if CoursewareSearchIndexer.indexing_is_enabled():
        # import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
        from cms.djangoapps.contentstore.tasks import update_search_index

        update_search_index.delay(six.text_type(course_key),
                                  datetime.now(UTC).isoformat())
Example #3
0
def listen_for_course_publish(sender, course_key, **kwargs):  # pylint: disable=unused-argument
    """
    Receives publishing signal and performs publishing related workflows, such as
    registering proctored exams, building up credit requirements, and performing
    search indexing
    """
    is_enabled = ENABLE_ASYNC_REGISTER_EXAMS.is_enabled(course_key)
    if is_enabled:
        from cms.djangoapps.contentstore.tasks import update_special_exams_and_publish
        course_key_str = str(course_key)
        update_special_exams_and_publish.delay(course_key_str)
    else:
        # first is to registered exams, the credit subsystem will assume that
        # all proctored exams have already been registered, so we have to do that first
        try:
            register_special_exams(course_key)
        # pylint: disable=broad-except
        except Exception as exception:
            log.exception(exception)

        # then call into the credit subsystem (in /openedx/djangoapps/credit)
        # to perform any 'on_publish' workflow
        on_course_publish(course_key)

    # import here, because signal is registered at startup, but items in tasks are not yet able to be loaded
    from cms.djangoapps.contentstore.tasks import update_outline_from_modulestore_task, update_search_index
    if key_supports_outlines(course_key):
        # Push the course outline to learning_sequences asynchronously.
        update_outline_from_modulestore_task.delay(str(course_key))

    # Finally call into the course search subsystem
    # to kick off an indexing action
    if CoursewareSearchIndexer.indexing_is_enabled(
    ) and CourseAboutSearchIndexer.indexing_is_enabled():
        update_search_index.delay(str(course_key),
                                  datetime.now(UTC).isoformat())