catch exceptions on workers and pass them to the scheduler (#93)

This commit is contained in:
Robert Nishihara
2016-06-11 15:44:56 -07:00
committed by Philipp Moritz
parent 61a0014c00
commit 41539141af
8 changed files with 38 additions and 15 deletions
+6 -2
View File
@@ -662,10 +662,14 @@ PyObject* submit_task(PyObject* self, PyObject* args) {
PyObject* notify_task_completed(PyObject* self, PyObject* args) {
Worker* worker;
if (!PyArg_ParseTuple(args, "O&", &PyObjectToWorker, &worker)) {
PyObject* task_succeeded_obj;
const char* error_message_ptr;
if (!PyArg_ParseTuple(args, "O&Os", &PyObjectToWorker, &worker, &task_succeeded_obj, &error_message_ptr)) {
return NULL;
}
worker->notify_task_completed();
std::string error_message(error_message_ptr);
bool task_succeeded = PyObject_IsTrue(task_succeeded_obj);
worker->notify_task_completed(task_succeeded, error_message);
Py_RETURN_NONE;
}