AGOL Notebooks: ArcPy module fails to load sporadically when using Tasks

211
4
Jump to solution
10-13-2022 08:31 AM
Labels (1)
AaronKoelker
Occasional Contributor III

I'm experiencing an issue when using Tasks in ArcGIS Online Notebooks. I have a Notebook that runs as expected whenever I start it manually, but when I use the Tasks options to schedule it, it will fail sporadically in the very first cell when simply trying to import arcpy. See error below:

 

 

"startTime": "2022-10-13T03:33:04.3991322Z",
    "endTime": "2022-10-13T03:33:54.2327257Z",
    "type": "executeNotebook",
    "results": {},
    "status": "FAILED",
    "username": "",
    "errors": {
      "messages": [
        "An error has occurred.",
        "",
        "---------------------------------------------------------------------------",
        "Exception encountered at \"In [1]\":",
        "---------------------------------------------------------------------------",
        "error                                     Traceback (most recent call last)",
        " in  7 import arcpy",
        "      8 from arcgis.gis import GIS",
        "      9 from arcgis.features import FeatureLayer",
        "",
        "/opt/conda/lib/python3.6/site-packages/arcpy/__init__.py in  72     import _initagsenv",
        "     73 ",
        "     74 from arcpy.geoprocessing import gp",
        "",
        "error: WSLib: failed initializing arcpy. Check if environment was activated correctly."
      ]

 

 

 

The Task I have set up runs every 3 hours, and fails roughly 30-40% of the time. I've included a screenshot below of the recent results, but I've been seeing this behavior the past few weeks. It was not occurring this past June, when I last had it running with Tasks. I have not been able to identify any pattern to it yet, as the times vary.

I will note, my Notebook is using Runtime 4.0 - Advanced. I have not had a chance to upgrade it to a newer runtime for this particular Notebook as some of the packages it relies on have changed in newer versions and will require me to rewrite how some portions of it work. I will get to that after hurricane season, but in the meantime I'm curious if anyone else has run into this issue, or if it has maybe already been logged as a bug?

-Aaron
Tags (4)
0 Kudos
1 Solution

Accepted Solutions
JLBlair
New Contributor II

Yep, same.  I submitted a support ticket to this issue and ESRI has it now as BUG-000151561.  It started somewhere in early August, I believe.  It only happens when a script is run through "task".  I had ESRI support reproduce the issue with a simple script:

import arcpy

arcpy.GetInstallInfo()['Version']

... run every 15 minutes and it did fail for them.  The runtime does not seem to matter.  My tasked scripts have been failing more times than not.  

View solution in original post

4 Replies
JLBlair
New Contributor II

Yep, same.  I submitted a support ticket to this issue and ESRI has it now as BUG-000151561.  It started somewhere in early August, I believe.  It only happens when a script is run through "task".  I had ESRI support reproduce the issue with a simple script:

import arcpy

arcpy.GetInstallInfo()['Version']

... run every 15 minutes and it did fail for them.  The runtime does not seem to matter.  My tasked scripts have been failing more times than not.  

AaronKoelker
Occasional Contributor III

Thanks for letting me know @JLBlair .

It would be helpful if there was a way to search the list of open/unresolved bugs. If there is, I haven't found it yet (other than ones where I've had a cased attached to it.)

-Aaron
0 Kudos
JLBlair
New Contributor II

All I know is that you can search this bug number in Technical Support.  They have a severity "medium" for this one, unfortunately.  Apparently not many folks are running Notebooks on AGOL, or those that are - are not tasking them because this bug is limiting some basic functions.  My scripts often take spatially enabled dataframes and converts them to hosted feature layers, which is where I've been encountering the issue.  

-Luke

0 Kudos
JLBlair
New Contributor II

This appears to have been fixed.

0 Kudos