Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-ora2
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-ora2
Commits
f379a4b1
Commit
f379a4b1
authored
Jun 03, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put rescheduling tasks on the low-priority queue
parent
8f9dd4c8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
6 deletions
+11
-6
apps/openassessment/assessment/worker/grading.py
+7
-3
apps/openassessment/assessment/worker/training.py
+4
-3
No files found.
apps/openassessment/assessment/worker/grading.py
View file @
f379a4b1
...
...
@@ -5,6 +5,7 @@ Asynchronous tasks for grading essays using text classifiers.
import
datetime
from
celery
import
task
from
django.db
import
DatabaseError
from
django.conf
import
settings
from
celery.utils.log
import
get_task_logger
from
dogapi
import
dog_stats_api
from
openassessment.assessment.api
import
ai_worker
as
ai_worker_api
...
...
@@ -17,6 +18,10 @@ MAX_RETRIES = 2
logger
=
get_task_logger
(
__name__
)
# If the Django settings define a low-priority queue, use that.
# Otherwise, use the default queue.
RESCHEDULE_TASK_QUEUE
=
getattr
(
settings
,
'LOW_PRIORITY_QUEUE'
,
None
)
@task
(
max_retries
=
MAX_RETRIES
)
# pylint: disable=E1102
def
grade_essay
(
workflow_uuid
):
...
...
@@ -93,7 +98,7 @@ def grade_essay(workflow_uuid):
raise
grade_essay
.
retry
()
@task
(
max_retries
=
MAX_RETRIES
)
# pylint: disable=E1102
@task
(
queue
=
RESCHEDULE_TASK_QUEUE
,
max_retries
=
MAX_RETRIES
)
# pylint: disable=E1102
def
reschedule_grading_tasks
(
course_id
,
item_id
):
"""
Reschedules all incomplete grading workflows with the specified parameters.
...
...
@@ -243,4 +248,4 @@ def _log_complete_reschedule_grading(course_id=None, item_id=None, seconds=-1, s
if
not
success
:
msg
+=
u" At least one grading task failed due to internal error."
msg
.
format
(
cid
=
course_id
,
iid
=
item_id
,
s
=
seconds
)
logger
.
info
(
msg
)
\ No newline at end of file
logger
.
info
(
msg
)
apps/openassessment/assessment/worker/training.py
View file @
f379a4b1
...
...
@@ -22,6 +22,8 @@ logger = get_task_logger(__name__)
# If the Django settings define a low-priority queue, use that.
# Otherwise, use the default queue.
TRAINING_TASK_QUEUE
=
getattr
(
settings
,
'LOW_PRIORITY_QUEUE'
,
None
)
RESCHEDULE_TASK_QUEUE
=
getattr
(
settings
,
'LOW_PRIORITY_QUEUE'
,
None
)
class
InvalidExample
(
Exception
):
"""
...
...
@@ -146,7 +148,7 @@ def train_classifiers(workflow_uuid):
raise
@task
(
max_retries
=
MAX_RETRIES
)
#pylint: disable E=
1102
@task
(
queue
=
RESCHEDULE_TASK_QUEUE
,
max_retries
=
MAX_RETRIES
)
#pylint: disable=E
1102
def
reschedule_training_tasks
(
course_id
,
item_id
):
"""
Reschedules all incomplete training tasks
...
...
@@ -281,4 +283,4 @@ def _log_complete_reschedule_training(course_id=None, item_id=None, seconds=-1,
if
not
success
:
msg
+=
u" At least one rescheduling task failed due to internal error."
msg
.
format
(
cid
=
course_id
,
iid
=
item_id
,
s
=
seconds
)
logger
.
info
(
msg
)
\ No newline at end of file
logger
.
info
(
msg
)
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