MCPcopy Create free account
hub / github.com/RedisGears/RedisGears / getGearsSession

Function getGearsSession

plugins/python/redisgears_python.c:2937–2960  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2935}
2936
2937static PyObject* getGearsSession(PyObject *cls, PyObject *args){
2938 PythonThreadCtx* ptctx = GetPythonThreadCtx();
2939 PyObject* res;
2940 if(!ptctx->currSession){
2941 Py_INCREF(Py_None);
2942 res = Py_None;
2943 }else{
2944 PyExecutionSession* pyExSes = PyObject_New(PyExecutionSession, &PyExecutionSessionType);
2945 pyExSes->s = PythonSessionCtx_ShallowCopy(ptctx->currSession);
2946 pyExSes->crtCtx = getCommandReaderTriggerCtx(ptctx);
2947 pyExSes->cmdCtx = getCommandCtx(ptctx);
2948
2949 if(pyExSes->crtCtx){
2950 pyExSes->crtCtx = RedisGears_CommandReaderTriggerCtxGetShallowCopy(pyExSes->crtCtx);
2951 }
2952
2953 if(pyExSes->cmdCtx){
2954 pyExSes->cmdCtx = RedisGears_CommandCtxGetShallowCopy(pyExSes->cmdCtx);
2955 }
2956
2957 res = (PyObject*)pyExSes;
2958 }
2959 return res;
2960}
2961
2962static PyObject* isInAtomicBlock(PyObject *cls, PyObject *args){
2963 PythonThreadCtx* ptctx = GetPythonThreadCtx();

Callers 2

GearsBuilder.pyFile · 0.90
runCoroutineFunction · 0.90

Calls 4

GetPythonThreadCtxFunction · 0.85
getCommandCtxFunction · 0.85

Tested by

no test coverage detected