Changeset: d5bc794c719e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=d5bc794c719e
Modified Files:
        monetdb5/extras/pyapi/pyapi.c
        monetdb5/extras/pyapi/type_conversion.h
Branch: pyapi
Log Message:

Terminate multiprocessing pools properly now.


diffs (39 lines):

diff --git a/monetdb5/extras/pyapi/pyapi.c b/monetdb5/extras/pyapi/pyapi.c
--- a/monetdb5/extras/pyapi/pyapi.c
+++ b/monetdb5/extras/pyapi/pyapi.c
@@ -778,7 +778,7 @@ str PyAPIeval(MalBlkPtr mb, MalStkPtr st
 
         if (mapped)
         {
-            PyObject *pMult, *pPoolClass, *pPoolProcesses, *pPoolObject, 
*pApply, *pPoolArgs, *pOutput, *pGet;
+            PyObject *pMult, *pPoolClass, *pPoolProcesses, *pPoolObject, 
*pApply, *pPoolArgs, *pOutput, *pGet, *pClose;
 
             pMult = PyImport_Import(PyString_FromString("multiprocessing"));
             if (pMult == NULL)
@@ -834,6 +834,14 @@ str PyAPIeval(MalBlkPtr mb, MalStkPtr st
             gstate = AcquireLock(&holds_gil, false);
 
             pResult = PyObject_CallObject(pGet, NULL);
+
+            pClose = PyObject_GetAttrString(pPoolObject, "terminate");
+            if (pClose == NULL)
+            {
+                msg = createException(MAL, "pyapi.eval", "No close?");
+                goto wrapup;
+            }
+            PyObject_CallObject(pClose, NULL);
         }
         else
         {
diff --git a/monetdb5/extras/pyapi/type_conversion.h 
b/monetdb5/extras/pyapi/type_conversion.h
--- a/monetdb5/extras/pyapi/type_conversion.h
+++ b/monetdb5/extras/pyapi/type_conversion.h
@@ -8,7 +8,7 @@
 
 /*
  * M. Raasveldt
- * This file contains a number of helper functions for converting between 
files, mainly used to convert from an object from a numpy array to the type 
requested by the BAT.
+ * This file contains a number of helper functions for converting between 
types, mainly used to convert from an object from a numpy array to the type 
requested by the BAT.
  */
 
 #ifndef _TYPE_CONVERSION_
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to