AnsweredAssumed Answered

Process runs and gets expected result using calculate field tool, but will not work with ArcGIS Pro scheduler.

Question asked by eleigh on Jun 19, 2020
Latest reply on Jun 23, 2020 by eleigh

Windows 10 Enterprise w/ ArcGIS Pro 2.5.1 and Python 3.

 

I have managed to schedule a field concatenation process on the same feature layer that is currently working on a schedule and that process works just fine.  For some reason, the following process will execute and create the data I want when I use the calculate field tool, but when I try to schedule it, the arc pro scheduler won't run it at all. There is no error apparent or log file created.  

 

I am not an experienced python programmer and have a very rudimentary idea of how this works.  I put this together using examples.  I have "copied" the python command that the tool generates below. Hopefully this can help.

 

I want the script to look and see if the field "advisory_lvl" contains text of "CAUTION" or "CLOSURE" and write the field DESC5 with the appropriate image URL.  As I said, this process works perfectly when I initiate it manually using the calculate field tool so I don't really know what's wrong with scheduling it.  

 

This does not work with the Pro scheduler tool:

arcpy.management.CalculateField(r"Harmful Algal Bloom Report 3\surveyPoint", "DESC5", "Reclass(!advisory_lvl!)", "PYTHON3", @"def Reclass(advisory_lvl):
if (advisory_lvl == ""CAUTION""):
return '<a href=""url""><img src=""url"" style=""width: 150px;""></a>'
elif (advisory_lvl == ""CLOSURE""):
return '<a href=""url""><img src=""url"" style=""width: 150px;""></a>'
", "TEXT")

 

This works with the Pro scheduler tool:

arcpy.management.CalculateField(r"Harmful Algal Bloom Report 3\surveyPoint", "DESC4", "'<b>Agency:</b>' + ' ' +  str(!agency!) + '<br>' + '<b>Sample Date:</b>' + ' ' + str(!sample_date!) + '<br>' + '<b>Advisory Level:</b>' + ' ' + str(!advisory_lvl!) + '<br>' + '<b>Advisory Issued:</b>' + ' ' + str(!advisory_issued!) + '<br>' + '<b>Advisory Lifted:</b>' + ' ' + str(!advisory_lifted!) + '<br>' + '<b>Cyanobacteria Density:</b>' + ' ' + str(!cyano_density!) + '<br>' + '<b>Microcystin:</b>' + ' ' + str(!microcystin!) + '<br>' + '<b>Anatoxin:</b>' + ' ' + str(!anatoxin!) ", "PYTHON3", '', "TEXT")

 

Please let me know if there is any other information I can provide.

 

Thanks for your help!

 

Update:

ArcPro scheduler creates a task within windows task scheduler.  The last run result returns (0x1). Looking at the general history panel it runs pythonw.exe with return code 2147942401. This is apparently some form of "illegal function".  No idea what or why, especially since other scripts run just fine. I did try running the script "run only when user is logged on" and that doesn't seem to affect anything.

Outcomes