Hi,
Map processing can take time - for other python applications, I successfully applied the concurrent.future package but python crashes in combination with arcpy. My guess is a problem with the license CheckOut (server licenses) which works fine with multiple calls of the ArcGIS 10.5 GUI but not with python.
Here an example of my code:
import concurrent.futures
import arcpy
def sub(parameter):
arcpy.CheckOutExtension('Spatial')
lifespan = Lifespan_Assessment(parameter)
arcpy.CheckInExtension('Spatial') # release license
def main():
test_parameters = np.array(["parameter1", "parameter2", "parameter3"])
with concurrent.futures.ThreadPoolExecutor(max_workers=3) as executor:
executor.submit(sub, test_parameters[0])
executor.submit(sub, test_parameters[1])
executor.submit(sub, test_parameters[2])
if __name__ == "__main__":
main()
Running this code leads to either:
1) Program crashes or
2) Program is non-responsive (without crashing but is has the same utility as crashing though)
Alternatively, I tried calling CheckOutExtension('Spatial') before the "executor.submit(...)" or within my class "Lifespan_Assessment()". Both options lead to python crashes.
Does anyone have experience with applying concurrent.features on arcpy? What am I doing wrong? Does anyone know alternatives?
I'm grateful for any kind of hint - thanks in advance,
Sebastian