Edit Service

79
2
06-02-2020 10:35 PM
Highlighted
New Contributor III

Hi

I would like to adapt the min- and max instance per node for my service with the python api. I would like to do that with the following API arcgis.gis.server module — arcgis 1.8.0 documentation .

I'm not able to edit the service, since I have no idea what the functions exactly expects. It's written that it needs "Required dict. The service JSON as a dictionary." 

So I grabed from the service the properties, edited the two properties and tried to pass the properties to the edit function.

import arcgis
from arcgis import *
from arcgis.gis import server
import json
s = server.Server("https://mystandalongeserver/site/admin",username='myuser',password='mypassword')
service3 = s.services.list(folder='MyFolder',refresh=True)[3]
props = service3.properties
props['minInstancesPerNode'] = 2
props['maxInstancesPerNode'] = 4
service3.edit(props)


What exactly is needed to update the service? Unfortunately there's no example and the documentation doesn't say much.

Any help appreciated, thanks.

Reply
0 Kudos
2 Replies
Highlighted
New Contributor III

The problem seems to be the returned json from:

service3.properties

{   "serviceName": "MyService",   "type": "MapServer",   "description": "Some description.",   "capabilities": "Map,Query,Data",   "provider": "ArcObjects",   "clusterName": "default",   "minInstancesPerNode": 2,   "maxInstancesPerNode": 4,   "instancesPerContainer": 1,   "maxWaitTime": 60,   "maxStartupTime": 300,   "maxIdleTime": 180,   "maxUsageTime": 600,   "loadBalancing": "ROUND_ROBIN",   "isolationLevel": "HIGH",   "configuredState": "STARTED",   "recycleInterval": 24,   "recycleStartTime": "04:00",   "keepAliveInterval": 1800,  "private": false,   "isDefault": false,  "maxUploadFileSize": 0,   "allowedUploadFileTypes": "",   "properties": {....}
...
}

The properties "private" and "isDefault" use the false-value without quotes??!!!! If I add some quotes to those values, I can hand over the properties to edit the service.

Bug?

I use pyhton api for arcgis 1.7.1

Reply
0 Kudos
Highlighted
New Contributor III

From Esri support:

BUG-000091846: Boolean values in a JSON representation of a map service are not enclosed with double quotes.

Reply
0 Kudos