Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
c19a3368
Commit
c19a3368
authored
Oct 20, 2017
by
Calen Pennington
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move MessageType definitions into tasks.py
parent
e81931da
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
17 deletions
+18
-17
openedx/core/djangoapps/schedules/resolvers.py
+0
-14
openedx/core/djangoapps/schedules/tasks.py
+18
-3
No files found.
openedx/core/djangoapps/schedules/resolvers.py
View file @
c19a3368
...
...
@@ -22,7 +22,6 @@ from openedx.core.djangoapps.monitoring_utils import set_custom_metric, function
from
openedx.core.djangoapps.schedules.config
import
COURSE_UPDATE_WAFFLE_FLAG
from
openedx.core.djangoapps.schedules.exceptions
import
CourseUpdateDoesNotExist
from
openedx.core.djangoapps.schedules.models
import
Schedule
,
ScheduleConfig
from
openedx.core.djangoapps.schedules.message_type
import
ScheduleMessageType
from
openedx.core.djangoapps.schedules.utils
import
PrefixedDebugLoggerMixin
from
openedx.core.djangoapps.schedules.template_context
import
(
absolute_url
,
...
...
@@ -158,12 +157,6 @@ class BinnedSchedulesBaseResolver(PrefixedDebugLoggerMixin, RecipientResolver):
return
schedules
class
RecurringNudge
(
ScheduleMessageType
):
def
__init__
(
self
,
day
,
*
args
,
**
kwargs
):
super
(
RecurringNudge
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
name
=
"recurringnudge_day{}"
.
format
(
day
)
def
_annotate_for_monitoring
(
message_type
,
site
,
bin_num
,
target_datetime
,
day_offset
):
# This identifies the type of message being sent, for example: schedules.recurring_nudge3.
set_custom_metric
(
'message_name'
,
'{0}.{1}'
.
format
(
...
...
@@ -225,9 +218,6 @@ def _get_datetime_beginning_of_day(dt):
return
dt
.
replace
(
hour
=
0
,
minute
=
0
,
second
=
0
,
microsecond
=
0
)
class
UpgradeReminder
(
ScheduleMessageType
):
pass
class
UpgradeReminderResolver
(
BinnedSchedulesBaseResolver
):
"""
Send a message to all users whose verified upgrade deadline is at ``self.current_date`` + ``day_offset``.
...
...
@@ -295,10 +285,6 @@ def _get_link_to_purchase_verified_certificate(a_user, a_schedule):
return
verified_upgrade_deadline_link
(
a_user
,
enrollment
.
course
)
class
CourseUpdate
(
ScheduleMessageType
):
pass
class
CourseUpdateResolver
(
BinnedSchedulesBaseResolver
):
"""
Send a message to all users whose schedule started at ``self.current_date`` + ``day_offset`` and the
...
...
openedx/core/djangoapps/schedules/tasks.py
View file @
c19a3368
...
...
@@ -20,6 +20,7 @@ from openedx.core.djangoapps.monitoring_utils import set_custom_metric
from
openedx.core.djangoapps.schedules.models
import
Schedule
,
ScheduleConfig
from
openedx.core.djangoapps.schedules
import
resolvers
from
openedx.core.djangoapps.schedules.message_type
import
ScheduleMessageType
from
openedx.core.djangoapps.site_configuration.models
import
SiteConfiguration
...
...
@@ -167,6 +168,12 @@ def _recurring_nudge_schedule_send(site_id, msg_str):
ace
.
send
(
msg
)
class
RecurringNudge
(
ScheduleMessageType
):
def
__init__
(
self
,
day
,
*
args
,
**
kwargs
):
super
(
RecurringNudge
,
self
)
.
__init__
(
*
args
,
**
kwargs
)
self
.
name
=
"recurringnudge_day{}"
.
format
(
day
)
class
ScheduleRecurringNudge
(
ScheduleMessageBaseTask
):
num_bins
=
resolvers
.
RECURRING_NUDGE_NUM_BINS
enqueue_config_var
=
'enqueue_recurring_nudge'
...
...
@@ -175,7 +182,7 @@ class ScheduleRecurringNudge(ScheduleMessageBaseTask):
async_send_task
=
_recurring_nudge_schedule_send
def
make_message_type
(
self
,
day_offset
):
return
resolvers
.
RecurringNudge
(
abs
(
day_offset
))
return
RecurringNudge
(
abs
(
day_offset
))
@task
(
ignore_result
=
True
,
routing_key
=
ROUTING_KEY
)
...
...
@@ -192,6 +199,10 @@ def _upgrade_reminder_schedule_send(site_id, msg_str):
ace
.
send
(
msg
)
class
UpgradeReminder
(
ScheduleMessageType
):
pass
class
ScheduleUpgradeReminder
(
ScheduleMessageBaseTask
):
num_bins
=
resolvers
.
UPGRADE_REMINDER_NUM_BINS
enqueue_config_var
=
'enqueue_upgrade_reminder'
...
...
@@ -200,7 +211,7 @@ class ScheduleUpgradeReminder(ScheduleMessageBaseTask):
async_send_task
=
_upgrade_reminder_schedule_send
def
make_message_type
(
self
,
day_offset
):
return
resolvers
.
UpgradeReminder
()
return
UpgradeReminder
()
...
...
@@ -218,6 +229,10 @@ def _course_update_schedule_send(site_id, msg_str):
ace
.
send
(
msg
)
class
CourseUpdate
(
ScheduleMessageType
):
pass
class
ScheduleCourseUpdate
(
ScheduleMessageBaseTask
):
num_bins
=
resolvers
.
COURSE_UPDATE_NUM_BINS
enqueue_config_var
=
'enqueue_course_update'
...
...
@@ -226,4 +241,4 @@ class ScheduleCourseUpdate(ScheduleMessageBaseTask):
async_send_task
=
_course_update_schedule_send
def
make_message_type
(
self
,
day_offset
):
return
resolvers
.
CourseUpdate
()
return
CourseUpdate
()
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment