AnsweredAssumed Answered

MakeFeatureLayer fails in multiprocessing python

Question asked by Georg.Zweyer on Jul 21, 2014
Latest reply on Jul 31, 2014 by Georg.Zweyer

Hello everyone,


--- Update -------------------------------

See later posts for specific problem description.




i try to use python multiprocessing to do some processing on chunks of a feature class. I changed the third example from this esri post: Multiprocessing with ArcGIS – Approaches and Considerations (Part 1) | ArcGIS Blog

If i set the poolsize to 1 it runs correctly but if i use more than one process "MakeFeatureLayer" throws a "Cannot open file" or "Dataset does not exist or is not supported" error most of the time for every process but the first one. (I use "MakeFeatureLayer" on three different Files in every process and it fails at one of them for sure)

It seems to be an error related to accesing the same file at the same time out of different processes, because inserting a waiting time befor starting the "MakeFeatureLayer" methods seems to work. Because this problem is not mentioned in the esri post or somewhere else in the www i think it must be my mistake but i just do the same thing like esri in their third example of the mentioned post :-/ The only thing mentioned in the blogpost is that you cannot use multiprocessing to update data in a gdb but "MakeFeatureLayer" needs only read access, doesn't it?



def worker(ranges):
    i = ranges[0]
    j = ranges[1]
        arcpy.AddMessage("started processing thread ")
##        time.sleep(1*(ranges[2]-1))
        samples=arcpy.MakeFeatureLayer_management(Input_Point_Features, "point_layer{0}".format(i), "OBJECTID >= {0} AND OBJECTID <= {1}".format(i, j))


anyone some suggestions?