Arcgis Pro是否支持脚本工具进行多线程?

我这面想做一个Web tool,想进行多线程数据处理,我写了一个脚本,然后封装了一个脚本工具,想测一下效果,但是在Arcgis Pro中貌似不支持多线程,不知道是我这面脚本有问题还是Arcgis Pro确实不支持。脚本内容如下:
import arcpy
import threading
import time
import json

def fun1():
dictionary = {"title":"sym","author":"lalala","url":"http://c.biancheng.net/","catalogue":["JSON1","JSONP2","JSON3"]}
JsonString = json.dumps(dictionary, indent=4, ensure_ascii=False)
f = open(r'E:\1_地图文档\3_政府上传影像数据管理\result\20220518.json', 'w')
f.write(JsonString)
f.close()
arcpy.AddMessage('子线程结束')

xc1 = threading.Thread(target=fun1)
xc1.start()
arcpy.AddMessage('主线程结束')
已邀请:

李明

赞同来自: wenqin

不支持。
这个得区分看,arcpy和web tool(gp服务)。
Esri也没有明确支持与否。pro本身是64位程序,gp工具运行、arcpy执行是在多线程环境下的。
加速gp工具有并行因子参数,也可以用多进程(mutilprocessing)。
gp服务是支持异步执行的
可以去ESRI社区找一找
https://community.esri.com/t5/arcgis-api-for-python-questions/does-arcpy-support-multithreading/td-p/819315
https://www.esri.com/arcgis-blog/products/analytics/analytics/parallel-geoprocessing-in-arcgis-pro/
 

要回复问题请先登录注册