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

Function setGearsSession

plugins/python/redisgears_python.c:2969–2994  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2967}
2968
2969static PyObject* setGearsSession(PyObject *cls, PyObject *args){
2970 if(PyTuple_Size(args) != 1){
2971 PyErr_SetString(GearsError, "Wrong number of args given to setGearsSession");
2972 return NULL;
2973 }
2974
2975 PythonThreadCtx* ptctx = GetPythonThreadCtx();
2976
2977 PyObject* s = PyTuple_GetItem(args, 0);
2978 if(s == Py_None){
2979 ptctx->currSession = NULL;
2980 }else{
2981 if(!PyObject_IsInstance((PyObject*)s, (PyObject*)&PyExecutionSessionType)){
2982 PyErr_SetString(GearsError, "Given object is not of type GearsSession");
2983 return NULL;
2984 }
2985
2986 PyExecutionSession* pyExSes = (PyExecutionSession*)s;
2987 ptctx->currSession = pyExSes->s;
2988 ptctx->crtCtx = pyExSes->crtCtx;
2989 ptctx->commandCtx = pyExSes->cmdCtx;
2990 }
2991
2992 Py_INCREF(Py_None);
2993 return Py_None;
2994}
2995
2996static PyObject* gearsCtx(PyObject *cls, PyObject *args){
2997 PythonThreadCtx* ptctx = GetPythonThreadCtx();

Callers 2

__enter__Method · 0.90
__exit__Method · 0.90

Calls 1

GetPythonThreadCtxFunction · 0.85

Tested by

no test coverage detected