Is multi-processing supported in custom ArcGis Pro scripts?

321
0
12-17-2018 05:29 AM
JoseManriquez
New Contributor

I am having problems running a multi-process script when executed from the ArcGIS Pro application.  The script works fine when invoked from the command line.  

Here is sample code to reproduce the problem:

import arcpy

import multiprocessing

def mp_process(inputs):

    task = inputs

    # do some work

    return task

if __name__ == "__main__":

    # create pool 

    pool = multiprocessing.Pool(2)

    arcpy.AddMessage(str(pool.map(mp_process, [1,2,3,4])))

This simple geo-processing script fails to execute when invoked from ArcGIS Pro.  The following exception is reported:

_pickle.PicklingError: Can't pickle <function mp_process at 0x000001C5CD672510>: attribute lookup mp_process on __main__ failed.

I can run this script from the command line with no issues, but from ArcGIS Pro it throws this exception.  Does anyone know if there is a way to implement multi-processing in ArcGIS Pro custom geoprocessing tools??

thanks

0 Kudos
0 Replies