| 1430 | } |
| 1431 | |
| 1432 | static void continueFutureOnDone(ExecutionPlan* ep, void* privateData){ |
| 1433 | // create the results lists |
| 1434 | FlatExecutionPlan* fep = RedisGears_GetFep(ep); |
| 1435 | PythonSessionCtx* sctx = RedisGears_GetFlatExecutionPrivateDataFromFep(fep); |
| 1436 | RedisModule_Assert(sctx); |
| 1437 | |
| 1438 | PythonExecutionCtx pectx = PythonExecutionCtx_New(sctx, NULL); |
| 1439 | RedisGearsPy_Lock(&pectx); |
| 1440 | |
| 1441 | PyObject* future = privateData; |
| 1442 | PyObject* l = PyList_New(0); |
| 1443 | PyObject* results = PyList_New(0); |
| 1444 | PyObject* errs = PyList_New(0); |
| 1445 | |
| 1446 | PyList_Append(l, results); |
| 1447 | PyList_Append(l, errs); |
| 1448 | |
| 1449 | for(size_t i = 0 ; i < RedisGears_GetRecordsLen(ep) ; ++i){ |
| 1450 | Record* res = RedisGears_GetRecord(ep, i); |
| 1451 | RedisModule_Assert(RedisGears_RecordGetType(res) == pythonRecordType); |
| 1452 | PythonRecord* pyRec = (PythonRecord*)res; |
| 1453 | PyList_Append(results, pyRec->obj); |
| 1454 | } |
| 1455 | |
| 1456 | for(size_t i = 0 ; i < RedisGears_GetErrorsLen(ep) ; ++i){ |
| 1457 | Record* err = RedisGears_GetError(ep, i); |
| 1458 | RedisModule_Assert(RedisGears_RecordGetType(err) == RedisGears_GetErrorRecordType()); |
| 1459 | size_t len; |
| 1460 | const char* errStr = RedisGears_StringRecordGet(err, &len); |
| 1461 | PyObject* pyErr = PyUnicode_FromStringAndSize(errStr, len); |
| 1462 | PyList_Append(errs, pyErr); |
| 1463 | GearsPyDecRef(pyErr); |
| 1464 | } |
| 1465 | |
| 1466 | GearsPyDecRef(results); |
| 1467 | GearsPyDecRef(errs); |
| 1468 | |
| 1469 | PyObject* pArgs = PyTuple_New(2); |
| 1470 | PyTuple_SetItem(pArgs, 0, future); |
| 1471 | PyTuple_SetItem(pArgs, 1, l); |
| 1472 | PyObject* r = PyObject_CallObject(setFutureResultsFunction, pArgs); |
| 1473 | GearsPyDecRef(pArgs); |
| 1474 | if(!r){ |
| 1475 | char* err = getPyError(); |
| 1476 | RedisModule_Log(staticCtx, "warning", "Error happened when releasing execution future, error='%s'", err); |
| 1477 | RG_FREE(err); |
| 1478 | }else{ |
| 1479 | GearsPyDecRef(r); |
| 1480 | } |
| 1481 | |
| 1482 | RedisGearsPy_Unlock(&pectx); |
| 1483 | } |
| 1484 | |
| 1485 | static void* runCreateStreamReaderArgs(const char* pattern, PyObject *kargs){ |
| 1486 | const char* defaultFromIdStr = "0-0"; |
nothing calls this directly
no test coverage detected