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
4f5848a9
Commit
4f5848a9
authored
Jun 03, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #393 from edx/will/reschedule-task-priority
Will/reschedule task priority
parents
8f9dd4c8
f379a4b1
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 @
4f5848a9
...
@@ -5,6 +5,7 @@ Asynchronous tasks for grading essays using text classifiers.
...
@@ -5,6 +5,7 @@ Asynchronous tasks for grading essays using text classifiers.
import
datetime
import
datetime
from
celery
import
task
from
celery
import
task
from
django.db
import
DatabaseError
from
django.db
import
DatabaseError
from
django.conf
import
settings
from
celery.utils.log
import
get_task_logger
from
celery.utils.log
import
get_task_logger
from
dogapi
import
dog_stats_api
from
dogapi
import
dog_stats_api
from
openassessment.assessment.api
import
ai_worker
as
ai_worker_api
from
openassessment.assessment.api
import
ai_worker
as
ai_worker_api
...
@@ -17,6 +18,10 @@ MAX_RETRIES = 2
...
@@ -17,6 +18,10 @@ MAX_RETRIES = 2
logger
=
get_task_logger
(
__name__
)
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
@task
(
max_retries
=
MAX_RETRIES
)
# pylint: disable=E1102
def
grade_essay
(
workflow_uuid
):
def
grade_essay
(
workflow_uuid
):
...
@@ -93,7 +98,7 @@ def grade_essay(workflow_uuid):
...
@@ -93,7 +98,7 @@ def grade_essay(workflow_uuid):
raise
grade_essay
.
retry
()
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
):
def
reschedule_grading_tasks
(
course_id
,
item_id
):
"""
"""
Reschedules all incomplete grading workflows with the specified parameters.
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
...
@@ -243,4 +248,4 @@ def _log_complete_reschedule_grading(course_id=None, item_id=None, seconds=-1, s
if
not
success
:
if
not
success
:
msg
+=
u" At least one grading task failed due to internal error."
msg
+=
u" At least one grading task failed due to internal error."
msg
.
format
(
cid
=
course_id
,
iid
=
item_id
,
s
=
seconds
)
msg
.
format
(
cid
=
course_id
,
iid
=
item_id
,
s
=
seconds
)
logger
.
info
(
msg
)
logger
.
info
(
msg
)
\ No newline at end of file
apps/openassessment/assessment/worker/training.py
View file @
4f5848a9
...
@@ -22,6 +22,8 @@ logger = get_task_logger(__name__)
...
@@ -22,6 +22,8 @@ logger = get_task_logger(__name__)
# If the Django settings define a low-priority queue, use that.
# If the Django settings define a low-priority queue, use that.
# Otherwise, use the default queue.
# Otherwise, use the default queue.
TRAINING_TASK_QUEUE
=
getattr
(
settings
,
'LOW_PRIORITY_QUEUE'
,
None
)
TRAINING_TASK_QUEUE
=
getattr
(
settings
,
'LOW_PRIORITY_QUEUE'
,
None
)
RESCHEDULE_TASK_QUEUE
=
getattr
(
settings
,
'LOW_PRIORITY_QUEUE'
,
None
)
class
InvalidExample
(
Exception
):
class
InvalidExample
(
Exception
):
"""
"""
...
@@ -146,7 +148,7 @@ def train_classifiers(workflow_uuid):
...
@@ -146,7 +148,7 @@ def train_classifiers(workflow_uuid):
raise
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
):
def
reschedule_training_tasks
(
course_id
,
item_id
):
"""
"""
Reschedules all incomplete training tasks
Reschedules all incomplete training tasks
...
@@ -281,4 +283,4 @@ def _log_complete_reschedule_training(course_id=None, item_id=None, seconds=-1,
...
@@ -281,4 +283,4 @@ def _log_complete_reschedule_training(course_id=None, item_id=None, seconds=-1,
if
not
success
:
if
not
success
:
msg
+=
u" At least one rescheduling task failed due to internal error."
msg
+=
u" At least one rescheduling task failed due to internal error."
msg
.
format
(
cid
=
course_id
,
iid
=
item_id
,
s
=
seconds
)
msg
.
format
(
cid
=
course_id
,
iid
=
item_id
,
s
=
seconds
)
logger
.
info
(
msg
)
logger
.
info
(
msg
)
\ No newline at end of file
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