Hi,
Since ArcPro 3.0, my python scripts using multiprocessing will only work if I have a single-use licence setup on the machine - previously concurrent licence worked fine, but no longer.
Is there any way to check in python if machine is single-use licenced or concurrent? I want script to end if not single-use, as process takes days otherwise (an no error is thrown)...
I have googled and can't come up with anything.
Thanks,
Erin
This is a headscratcher. Looks like the script is essentially creating more instances of the application/arcpy when it runs, but since you only have one available license it fails. I don't think there is a built in check either.
Could you get with your admin(?) and do one of the following:
As a work around, you could maybe pass the licensed arcpy module to workers (as much as the pickling will let you):
import sys
import arcpy
import multiprocessing as mp
arcpy.env.workspace = "c:/data/world.gdb"
def package_pass(module, int):
line = None
if module("ArcInfo") == "Available":
# arcpy.PolygonToLine_management("Lakes", "LakeLines")
line = f'Licensed {int}'
else:
line = 'Not licensed'
return line
if __name__ == '__main__':
with mp.Pool(processes=2) as pool:
jobs = []
for k in range(10):
jobs.append(pool.apply_async(package_pass, (arcpy.CheckProduct, k)))
res = [j.get() for j in jobs]
for r in res:
print(r)