Select to view content in your preferred language

arcpy.server.UploadServiceDefinition output result is blank

613
7
09-01-2023 08:51 AM
Jay_Gregory
Regular Contributor

After running arcpy.server.UploadServiceDefinition to create a map service in my ArcGIS Enterprise (10.9.1), the documentation indicates I should be able access the out_mapServiceItemID by looking at result.getOutput(2).  However, the return value is blank.  

result = arcpy.server.UploadServiceDefinition(service_definition, "https://arcgisenv/serverWebAdaptor", in_folder_type="EXISTING", in_folder="myfoldername")
result.getOutput(2) #this ends up being ''

I'm trying to get the Portal Item ID of the map service that is published using the above service definition.  Documentation says it should be available in the derived output (https://pro.arcgis.com/en/pro-app/latest/tool-reference/server/upload-service-definition.htm).  In fact every output is blank after the first 2.  

Any ideas what could be happening?

7 Replies
SH_DH
by
New Contributor III

Running into this same thing. Hoping to derive to newly created service ID. Did you make any progress on this?

0 Kudos
Jay_Gregory
Regular Contributor

No progress.  I just do a very specific search using the Portal search API to get my item.  

0 Kudos
FredSpataro
Occasional Contributor III

I'm seeing the same results ... none of the good result values are being populated according to the doc.  Any chance you reported this as a bug? 

0 Kudos
BenKeller_Esri
New Contributor

All,

This is a documented BUG now and has been reproduced internally. Hopefully a hotfix is out soon.

BUG-000140843

It does seem like you might be able to use the Python API to get the output instead of getting it through arcpy:

    rsp = arcpy.UploadServiceDefinition_server(<sd_output_filename>, "HOSTING_SERVER")
    gis_item = gis.content.get(rsp[2])

 

Thanks,

Ben Keller

0 Kudos
FredSpataro
Occasional Contributor III
Thanks Ben! I was just about to write up the bug in Support.
BenKeller_Esri
New Contributor

Fred, I was able to find a possible workaround with the API instead of arcpy. If you want to give that a try.

0 Kudos
FredSpataro
Occasional Contributor III

Thanks Ben, I've probably worked out that solution as well... i have file level access to the config store so i'm able to open the item json and scrap the ids from there... not totally ideal but slightly faster than an api query and a bit easier to code. 

0 Kudos