Select to view content in your preferred language

Is it possible to edit the maxRecordCount Property of a service via Python scripting?

2300
1
Jump to solution
01-20-2014 02:17 PM
GeorgeHaskett
Deactivated User
I am using ArcGIS Server and Desktop 10.2.

I update data used by a map service on a daily basis.  For some reason the service doesn't seem to update/refresh unless I manually do so.  In order to make sure the end user is see the latest data I have been manually restarting the service.

Recently I came across an example of code that updates the min/max number of instances for a service using python.  I have been able to replicate the code, however I cannot seem to adjust the maxRecordCount property for my service, even though I can get the script to read back my current maxRecordCount settings.

Does anyone know how to change this property via python scripting?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
GeorgeHaskett
Deactivated User
Yes it is.  Alex assisted me with this on the GIS Stack Exchange site.

I altered the ESRI example that updated the number of instances by adding a reference to the Properties Dictionary and then to the the maxRecordsCount property itself.  I did have to modify their script a bit to work within my current script.  Here is the portion of code in question:

    # Deserialize response into Python object
    dataObj = json.loads(data)
    httpConn.close()

    # Edit desired properties of the service
    dataObj["minInstancesPerNode"] = 1
    dataObj["maxInstancesPerNode"] = 10

    newdict = dataObj["properties"]
    newdict["maxRecordCount"] = 5000

    # Serialize back into JSON
    updatedSvcJson = json.dumps(dataObj)

View solution in original post

0 Kudos
1 Reply
GeorgeHaskett
Deactivated User
Yes it is.  Alex assisted me with this on the GIS Stack Exchange site.

I altered the ESRI example that updated the number of instances by adding a reference to the Properties Dictionary and then to the the maxRecordsCount property itself.  I did have to modify their script a bit to work within my current script.  Here is the portion of code in question:

    # Deserialize response into Python object
    dataObj = json.loads(data)
    httpConn.close()

    # Edit desired properties of the service
    dataObj["minInstancesPerNode"] = 1
    dataObj["maxInstancesPerNode"] = 10

    newdict = dataObj["properties"]
    newdict["maxRecordCount"] = 5000

    # Serialize back into JSON
    updatedSvcJson = json.dumps(dataObj)
0 Kudos