Commit d9b6bce1 by Will Daly

Merge pull request #457 from edx/will/TIM-661

Catch HTTP errors that occur when downloading classifier data
parents 75c5f7ed aee87a7e
......@@ -2,6 +2,7 @@
Public interface for AI training and grading, used by workers.
"""
import logging
from httplib import HTTPException
from django.db import DatabaseError
from dogapi import dog_stats_api
from openassessment.assessment.models import (
......@@ -80,7 +81,10 @@ def get_grading_task_params(grading_workflow_uuid):
for classifier in classifiers
}
}
except (DatabaseError, ClassifierSerializeError, IncompleteClassifierSet, ValueError) as ex:
except (
DatabaseError, ClassifierSerializeError, IncompleteClassifierSet,
ValueError, IOError, HTTPException
) as ex:
msg = (
u"An unexpected error occurred while retrieving "
u"classifiers for the grading workflow with UUID {uuid}: {ex}"
......
......@@ -276,6 +276,11 @@ class AIClassifierSet(models.Model):
dict: keys are criteria names, values are JSON-serializable classifier data
If there are no classifiers in the set, returns None
Raises:
ValueError
IOError
httplib.HTTPException
"""
# First check the in-memory cache
# We use an in-memory cache because the classifier data will most often
......@@ -364,6 +369,7 @@ class AIClassifier(models.Model):
Raises:
ValueError
IOError
httplib.HTTPException
"""
return json.loads(self.classifier_data.read()) # pylint:disable=E1101
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment