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