Skip to content

Commit

Permalink
Nominate release candidate
Browse files Browse the repository at this point in the history
* origin/master:
  ginkgo!
  • Loading branch information
stvstnfrd committed Sep 29, 2018
2 parents 83c661a + 8488000 commit b3bc433
Show file tree
Hide file tree
Showing 2,658 changed files with 132,681 additions and 80,533 deletions.
16 changes: 16 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"presets": [
[
"env",
{
"targets": {
"browsers": [
"last 2 versions",
"IE >= 11"
]
},
"modules": false
}
]
]
}
2 changes: 1 addition & 1 deletion .coveragerc
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ source =
common/lib/capa
common/lib/xmodule
lms
openedx/core/djangoapps
openedx
pavelib

omit =
Expand Down
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,5 @@ common/lib/xmodule/xmodule/js/src/vertical/edit.js

# This file is responsible for almost half of the repo's total issues.
common/lib/xmodule/xmodule/js/src/capa/schematic.js

!**/.eslintrc.js
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": "eslint-config-edx",
"extends": "eslint-config-edx-es5",
"globals": { // Try to avoid adding any new globals.
// Old compatibility things and hacks
"edx": true,
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ jscover.log.*
.tddium*
common/test/data/test_unicode/static/
test_root/courses/
test_root/data/test_bare.git/
test_root/export_course_repos/
test_root/paver_logs/
test_root/uploads/
django-pyfs

### Installation artifacts
Expand All @@ -91,6 +95,8 @@ lms/static/css/
lms/static/certificates/css/
cms/static/css/
common/static/common/js/vendor/
common/static/bundles
webpack-stats.json

### Styling generated from templates
lms/static/sass/*.css
Expand Down
18 changes: 6 additions & 12 deletions .tx/config
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ source_file = conf/locale/en/LC_MESSAGES/wiki.po
source_lang = en
type = PO

[open-edx-releases.release-ficus]
[open-edx-releases.release-ginkgo]
file_filter = conf/locale/<lang>/LC_MESSAGES/django.po
source_file = conf/locale/en/LC_MESSAGES/django.po
source_lang = en
type = PO
[open-edx-releases.release-ficus-js]

[open-edx-releases.release-ginkgo-js]
file_filter = conf/locale/<lang>/LC_MESSAGES/djangojs.po
source_file = conf/locale/en/LC_MESSAGES/djangojs.po
source_lang = en
Expand Down Expand Up @@ -97,9 +97,9 @@ source_file = conf/locale/en/LC_MESSAGES/theme.po
source_lang = en
type = PO

[stanford-openedx.tos]
file_filter = conf/locale/<lang>/LC_MESSAGES/tos.po
source_file = conf/locale/en/LC_MESSAGES/tos.po
[stanford-openedx.tos_and_honor]
file_filter = conf/locale/<lang>/LC_MESSAGES/tos_and_honor.po
source_file = conf/locale/en/LC_MESSAGES/tos_and_honor.po
source_lang = en
type = PO

Expand All @@ -109,12 +109,6 @@ source_file = conf/locale/en/LC_MESSAGES/privacy.po
source_lang = en
type = PO

[stanford-openedx.honor]
file_filter = conf/locale/<lang>/LC_MESSAGES/honor.po
source_file = conf/locale/en/LC_MESSAGES/honor.po
source_lang = en
type = PO

[stanford-openedx.copyright]
file_filter = conf/locale/<lang>/LC_MESSAGES/copyright.po
source_file = conf/locale/en/LC_MESSAGES/copyright.po
Expand Down
3 changes: 3 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -279,4 +279,7 @@ Jhony Avella <[email protected]>
Tanmay Mohapatra <[email protected]>
Brian Mesick <[email protected]>
Jeff LaJoie <[email protected]>
Ivan Ivić <[email protected]>
Brandon Baker <[email protected]>
Shirley He <[email protected]>
Sahar Markovich <[email protected]>
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
# Do things in edx-platform

# Careful with mktemp syntax: it has to work on Mac and Ubuntu, which have differences.
PRIVATE_FILES := $(shell mktemp -u /tmp/private_files.XXXXXX)

clean:
# Remove all the git-ignored stuff, but save and restore things marked
# by start-noclean/end-noclean.
# by start-noclean/end-noclean. Include Makefile in the tarball so that
# there's always at least one file even if there are no private files.
sed -n -e '/start-noclean/,/end-noclean/p' < .gitignore > /tmp/private-files
tar cf /tmp/private.tar `git ls-files --exclude-from=/tmp/private-files --ignored --others`
git clean -fdX
tar xf /tmp/private.tar
-tar cf $(PRIVATE_FILES) Makefile `git ls-files --exclude-from=/tmp/private-files --ignored --others`
-git clean -fdX
tar xf $(PRIVATE_FILES)
rm $(PRIVATE_FILES)
16 changes: 2 additions & 14 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,9 @@ in. If you do not have an account, follow these steps.
Documentation
-------------

Documentation is managed in the `edx-documentation`_ repository. Documentation
is built using `Sphinx`_: you can `view the built documentation on
ReadTheDocs`_.

You can also check out `Confluence`_, our wiki system. Once you sign up for
an account, you'll be able to create new pages and edit existing pages, just
like in any other wiki system. You only need one account for both Confluence
and `JIRA`_, our issue tracker.

.. _Sphinx: http://sphinx-doc.org/
.. _view the built documentation on ReadTheDocs: http://docs.edx.org/
.. _edx-documentation: https://github.com/edx/edx-documentation
.. _Confluence: http://openedx.atlassian.net/wiki/
.. _JIRA: https://openedx.atlassian.net/
Documentation details can be found in the `docs index.rst`_.

.. _docs index.rst: docs/index.rst

Getting Help
------------
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dependencies:
- sudo apt-get install libxmlsec1-dev
- sudo apt-get install lynx-cur
override:
- npm install
- npm install || npm prune && npm install

- pip install setuptools
- pip install --exists-action w -r requirements/edx/paver.txt
Expand Down
11 changes: 11 additions & 0 deletions cms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@
"""
from __future__ import absolute_import

# We monkey patch Kombu's entrypoints listing because scanning through this
# accounts for the majority of LMS/Studio startup time for tests, and we don't
# use custom Kombu serializers (which is what this is for). Still, this is
# pretty evil, and should be taken out when we update Celery to the next version
# where it looks like this method of custom serialization has been removed.
#
# FWIW, this is identical behavior to what happens in Kombu if pkg_resources
# isn't available.
import kombu.utils
kombu.utils.entrypoints = lambda namespace: iter([])

# This will make sure the app is always imported when
# Django starts so that shared_task will use this app.
from .celery import APP as CELERY_APP
5 changes: 5 additions & 0 deletions cms/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
Taken from: http://celery.readthedocs.org/en/latest/django/first-steps-with-django.html
"""
from __future__ import absolute_import

import os

from celery import Celery
from django.conf import settings

from openedx.core.lib.celery.routers import AlternateEnvironmentRouter

# set the default Django settings module for the 'celery' program.
Expand All @@ -33,4 +36,6 @@ def alternate_env_tasks(self):
"""
return {
'openedx.core.djangoapps.content.block_structure.tasks.update_course_in_cache': 'lms',
'openedx.core.djangoapps.content.block_structure.tasks.update_course_in_cache_v2': 'lms',
'lms.djangoapps.grades.tasks.compute_all_grades_for_course': 'lms',
}
File renamed without changes.
19 changes: 19 additions & 0 deletions cms/djangoapps/cms_user_tasks/apps.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
"""
CMS user tasks application configuration
Signal handlers are connected here.
"""

from django.apps import AppConfig


class CmsUserTasksConfig(AppConfig):
"""
Application Configuration for cms_user_tasks.
"""
name = u'cms_user_tasks'

def ready(self):
"""
Connect signal handlers.
"""
from . import signals # pylint: disable=unused-variable
55 changes: 55 additions & 0 deletions cms/djangoapps/cms_user_tasks/signals.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
"""
Receivers of signals sent from django-user-tasks
"""
from __future__ import absolute_import, print_function, unicode_literals

import logging

from django.core.urlresolvers import reverse
from django.dispatch import receiver
from user_tasks.models import UserTaskArtifact
from user_tasks.signals import user_task_stopped

from six.moves.urllib.parse import urljoin # pylint: disable=import-error

from .tasks import send_task_complete_email

LOGGER = logging.getLogger(__name__)


@receiver(user_task_stopped, dispatch_uid="cms_user_task_stopped")
def user_task_stopped_handler(sender, **kwargs): # pylint: disable=unused-argument
"""
Handles sending notifications when a django-user-tasks completes.
This is a signal receiver for user_task_stopped. Currently it only sends
a generic "task completed" email, and only when a top-level task
completes. Eventually it might make more sense to create specific per-task
handlers.
Arguments:
sender (obj): Currently the UserTaskStatus object class
**kwargs: See below
Keywork Arguments:
status (obj): UserTaskStatus of the completed task
Returns:
None
"""
status = kwargs['status']

# Only send email when the entire task is complete, should only send when
# a chain / chord / etc completes, not on sub-tasks.
if status.parent is None:
# `name` and `status` are not unique, first is our best guess
artifact = UserTaskArtifact.objects.filter(status=status, name="BASE_URL").first()

detail_url = None
if artifact and artifact.url.startswith(('http://', 'https://')):
detail_url = urljoin(
artifact.url,
reverse('usertaskstatus-detail', args=[status.uuid])
)

try:
# Need to str state_text here because it is a proxy object and won't serialize correctly
send_task_complete_email.delay(status.name.lower(), str(status.state_text), status.user.email, detail_url)
except Exception: # pylint: disable=broad-except
LOGGER.exception("Unable to queue send_task_complete_email")
68 changes: 68 additions & 0 deletions cms/djangoapps/cms_user_tasks/tasks.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
"""
Celery tasks used by cms_user_tasks
"""

from boto.exception import NoAuthHandlerFound
from celery.exceptions import MaxRetriesExceededError
from celery.task import task
from celery.utils.log import get_task_logger
from django.conf import settings
from django.core import mail

from edxmako.shortcuts import render_to_string
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers

LOGGER = get_task_logger(__name__)
TASK_COMPLETE_EMAIL_MAX_RETRIES = 3
TASK_COMPLETE_EMAIL_TIMEOUT = 60


@task(bind=True)
def send_task_complete_email(self, task_name, task_state_text, dest_addr, detail_url):
"""
Sending an email to the users when an async task completes.
"""
retries = self.request.retries

context = {
'task_name': task_name,
'task_status': task_state_text,
'detail_url': detail_url
}

subject = render_to_string('emails/user_task_complete_email_subject.txt', context)
# Eliminate any newlines
subject = ''.join(subject.splitlines())
message = render_to_string('emails/user_task_complete_email.txt', context)

from_address = configuration_helpers.get_value(
'email_from_address',
settings.DEFAULT_FROM_EMAIL
)

try:
mail.send_mail(subject, message, from_address, [dest_addr], fail_silently=False)
LOGGER.info("Task complete email has been sent to User %s", dest_addr)
except NoAuthHandlerFound:
LOGGER.info(
'Retrying sending email to user %s, attempt # %s of %s',
dest_addr,
retries,
TASK_COMPLETE_EMAIL_MAX_RETRIES
)
try:
self.retry(countdown=TASK_COMPLETE_EMAIL_TIMEOUT, max_retries=TASK_COMPLETE_EMAIL_MAX_RETRIES)
except MaxRetriesExceededError:
LOGGER.error(
'Unable to send task completion email to user from "%s" to "%s"',
from_address,
dest_addr,
exc_info=True
)
except Exception: # pylint: disable=broad-except
LOGGER.exception(
'Unable to send task completion email to user from "%s" to "%s"',
from_address,
dest_addr,
exc_info=True
)
Loading

0 comments on commit b3bc433

Please sign in to comment.