Unable to make many concurrent SDE connections using arcpy

10-10-2019 12:35 PM
New Contributor

I am try to make concurrent connections to the my SQL Server SDE using arcpy and multiprocessing libraries 

When the number of working is large i.e. 16 , I got this error:

ERROR 000229: Cannot open GeoDB.sde/GeoDB.dbo.Layer1

while the code works fine if I am using small number of workers i.e. 4 or just without multiprocessing

Here is the simple code that successfully run without multiprocessing 

arcpy.MakeFeatureLayer_management("GeoDB.sde/GeoDB.dbo.Layer1", "mylayer","status = 1")

here is the code with multiprocessing 

def exe_task(layer_name):

      arcpy.MakeFeatureLayer_management("GeoDB.sde/GeoDB.dbo.Layer1", layer_name,"status = 1")

      return True

from multiprocessing import Pool

import arcpy

if __name__ == "__main__":

      number_of_workers = 4

      p = Pool(number_of_workers)

      tasks = ["layer1","layer2","layer3","layer4"]
      result = p.map(exe_task, tasks)

This is just a sample code to show the problem, if the number of workers 4 it works fine, if it is large like 16 it gives the error above. (also you need to increase the tasks number equal to workers numbers)

is there any configuration on arcpy or sde to fix this problem? 

0 Kudos
0 Replies