| 36 | namespace python { |
| 37 | |
| 38 | void ProxyExecutor::registered(ExecutorDriver* driver, |
| 39 | const ExecutorInfo& executorInfo, |
| 40 | const FrameworkInfo& frameworkInfo, |
| 41 | const SlaveInfo& slaveInfo) |
| 42 | { |
| 43 | InterpreterLock lock; |
| 44 | |
| 45 | PyObject* executorInfoObj = nullptr; |
| 46 | PyObject* frameworkInfoObj = nullptr; |
| 47 | PyObject* slaveInfoObj = nullptr; |
| 48 | PyObject* res = nullptr; |
| 49 | |
| 50 | executorInfoObj = createPythonProtobuf(executorInfo, "ExecutorInfo"); |
| 51 | frameworkInfoObj = createPythonProtobuf(frameworkInfo, "FrameworkInfo"); |
| 52 | slaveInfoObj = createPythonProtobuf(slaveInfo, "SlaveInfo"); |
| 53 | |
| 54 | if (executorInfoObj == nullptr || |
| 55 | frameworkInfoObj == nullptr || |
| 56 | slaveInfoObj == nullptr) { |
| 57 | goto cleanup; // createPythonProtobuf will have set an exception. |
| 58 | } |
| 59 | |
| 60 | res = PyObject_CallMethod(impl->pythonExecutor, |
| 61 | (char*) "registered", |
| 62 | (char*) "OOOO", |
| 63 | impl, |
| 64 | executorInfoObj, |
| 65 | frameworkInfoObj, |
| 66 | slaveInfoObj); |
| 67 | if (res == nullptr) { |
| 68 | cerr << "Failed to call executor registered" << endl; |
| 69 | goto cleanup; |
| 70 | } |
| 71 | |
| 72 | cleanup: |
| 73 | if (PyErr_Occurred()) { |
| 74 | PyErr_Print(); |
| 75 | driver->abort(); |
| 76 | } |
| 77 | Py_XDECREF(executorInfoObj); |
| 78 | Py_XDECREF(frameworkInfoObj); |
| 79 | Py_XDECREF(slaveInfoObj); |
| 80 | Py_XDECREF(res); |
| 81 | } |
| 82 | |
| 83 | |
| 84 | void ProxyExecutor::reregistered(ExecutorDriver* driver, |
nothing calls this directly
no test coverage detected