Map Tile Package Publishing Fail

2154
10
08-30-2017 07:19 PM
JingjingLi
New Contributor II

Hi,

I've tried using the following script to upload a map tile package and publish it to a hosted tile layer but it failed. The map tile package was successfully uploaded and the hosted tile layer was successfully created. However, it didn't copy the min and max scale to the service so the publishing tile process was failed.

That's the script I used.

from arcgis.gis import GIS

gis = GIS("https://www.arcgis.com", "username", "password")
cm = gis.content
print(gis._con._token)
itemProperties = {}
data = r"TileMapPackage\PlanningTeamArea_agspro.tpk"
item = cm.add(itemProperties, data=data, folder="test_automation")
if item != None:
    print(item)
    tiledServiceItem = item.publish()
    if tiledServiceItem != None:
        print("published")

that's the error message I got.

Traceback (most recent call last):
  File "D:/Data/Requests/Requests 2017/26_0511_AGOL_Automation_Test/Codes/addingItems.py", line 11, in <module>
    tiledServiceItem = item.publish()
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 4299, in publish
    serviceitem_id = self._check_publish_status(ret, folder)
  File "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py", line 4519, in _check_publish_status
    raise Exception("No job id")
Exception: No job id

Any idea?

10 Replies
DanPatterson_Retired
MVP Emeritus

is itemProperties supposed to be an empty dictionary? ie { } or a list? [ ]

0 Kudos
JingjingLi
New Contributor II

As far as I know. It is a dictionary. And according to this sample, I don't see what's wrong with my script.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Apparently it is missing a jobId (whatever that is.)

You can find out more details by examining the script 

C:\ArcPro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\__init__.py

the def in question is

    def _check_publish_status(self, ret, folder):

its help says...

Internal method to check the status of a publishing job.
        :param ret: Dictionary representing the result of a publish REST call. This dict should contain the
                    `serviceItemId` and `jobId` of the publishing job
        :param folder: obtained from self.ownerFolder

and it failed to pass on line 4485 returning the error message on 4519... raise Exception("No job id")

So if you know what a job id is...

0 Kudos
JingjingLi
New Contributor II

Yep. The job id is supposed to be generated by arcgisonline but I don't see it anywhere.

0 Kudos
JingjingLi
New Contributor II

And I tested the same script using version 1.0.1 and it worked. I am currently running 1.2.1.

0 Kudos
JingjingLi
New Contributor II

{
    "services": [{
            "type": "Map Service",
            "serviceurl": "https://tiles.arcgis.com/tiles/okWBWNlpfMx5q1bT/arcgis/rest/services/PlanningTeamArea_agspro/MapServ...",
            "size": 926219,
            "serviceItemId": "dc7ee927d0e242bc8de5200634532de1",
            "encodedServiceURL": "https://tiles.arcgis.com/tiles/okWBWNlpfMx5q1bT/arcgis/rest/services/PlanningTeamArea_agspro/MapServ..."
        }
    ]
}

that's the response from the publish service url, and obviously there is no jobId in it.

0 Kudos
DanPatterson_Retired
MVP Emeritus

Since no one who does this has chimed in, I would contact tech support or search Esri Support Home to see if any other reports along the same line have appeared.

0 Kudos
KevinEscalera2
New Contributor II

Hi Dan, did you resolved this issue?, I'm having the same problem using the publish function of an scene layer package item in ArcGIS Online....

0 Kudos
by Anonymous User
Not applicable

Kevin, did you find a solution on this front?

Trying to overwrite an existing hosted feature layer; the service definition creates and overwrites the sd on AGOL, but I can't get the script to actually use the updated SD to overwrite the feature layer.

0 Kudos