Hi
we are working on an automation process which should publish multidimensional cloud raster files.
We tested with Notebooks in ArcGIS Pro 2.8 and ArcGIS Notebook Server 10.9.1. Both approaches produce the same error messages.
Here is the code:
from arcgis.gis import GIS
import arcpy
import json
import shutil
import arcgisscripting
import xarray as xr
from netCDF4 import Dataset as NetCDFFile
import numpy as np
gis = GIS("home")
output_draft = '/arcgis/home/temperature_interim2.sddraft'
service = "SN"
con = "/arcgis/home/hub_hereon_de_image.ags"
# arcpy.CreateImageSDDraft(out_rasterdataset, output_draft, service,
# 'FROM_CONNECTION_FILE', con, True, None, "netCDF test", "netCDF,test")
arcpy.CreateImageSDDraft(out_rasterdataset, output_draft, service,
'ARCGIS_SERVER')
try:
arcpy.StageService_server(
'/arcgis/home/temperature_interim2.sddraft', '/arcgis/home/temperature_interim3.sd')
warnings = arcpy.GetMessages(1)
print(warnings)
except Exception as stage_exception:
print("Sddraft not staged. Analyzer errors encountered - {}".format(str(stage_exception)))
inSdFile = '/arcgis/home/temperature_interim3.sd'
arcpy.UploadServiceDefinition_server(inSdFile, con)
Error Message:
---------------------------------------------------------------------------
ExecuteError Traceback (most recent call last)
/tmp/ipykernel_482/388611030.py in <module>
3 # inServer = '/arcgis/home/rasterimage.ags'
4 # inServer=r"C:/Users/Chaudhr1/arcgis/rasterimage.ags"
----> 5 arcpy.UploadServiceDefinition_server(inSdFile, con)
/opt/conda/lib/python3.7/site-packages/arcpy/server.py in UploadServiceDefinition(in_sd_file, in_server, in_service_name, in_cluster, in_folder_type, in_folder, in_startupType, in_override, in_my_contents, in_public, in_organization, in_groups)
1293 return retval
1294 except Exception as e:
-> 1295 raise e
1296
1297
/opt/conda/lib/python3.7/site-packages/arcpy/server.py in UploadServiceDefinition(in_sd_file, in_server, in_service_name, in_cluster, in_folder_type, in_folder, in_startupType, in_override, in_my_contents, in_public, in_organization, in_groups)
1290 from arcpy.arcobjects.arcobjectconversion import convertArcObjectToPythonObject
1291 try:
-> 1292 retval = convertArcObjectToPythonObject(gp.UploadServiceDefinition_server(*gp_fixargs((in_sd_file, in_server, in_service_name, in_cluster, in_folder_type, in_folder, in_startupType, in_override, in_my_contents, in_public, in_organization, in_groups), True)))
1293 return retval
1294 except Exception as e:
/opt/conda/lib/python3.7/site-packages/arcpy/geoprocessing/_base.py in <lambda>(*args)
510 val = getattr(self._gp, attr)
511 if callable(val):
--> 512 return lambda *args: val(*gp_fixargs(args, True))
513 else:
514 return convertArcObjectToPythonObject(val)
ExecuteError: ERROR 002901: Sharing related error during geo-processing (Unable to check if service exists. (temp_netCDFwv1))
Failed to execute (UploadServiceDefinition).
When we use a simple Map Image Service the process is working fine. Not with an Image layer.
It would be nice if someone could give us a hint?
Thx a lot.
Max