TransWikia.com

Which feature class(es) is/are used by service?

Geographic Information Systems Asked by user32324 on February 24, 2021

I have several feature classes and a lot of services. When I try to make my feature class versioned I get the message that the feature class is locked which is obvious.
But it’s not telling me by which service it’s locked.

Is there a possibility to work through all feature classes with ArcPy and find out in which service it’s referenced?

2 Answers

ArcGIS Server 10.1+:

You can do this, however there is no out-of-the-box functionality for this. The information about what feature classes are used (and from what database files they are coming) is not exposed via ArcGIS Server Manager / Services Directory / REST Admin.

However, this information is stored as service metadata within C:arcgisserverdirectoriesarcgissystemarcgisinputServicePaths.MapServerextracted folder in manifest.xml file (there are both .json and .xml). .Xml file contains more detailed information, I recommend parsing this file (but you could start with .json first to get the idea).

Two tags you should look at in .xml file are <Name>ServicePaths</Name> - service name and multiple <OnPremisePath>C:GISTemptest.gdbStopsSandiego</OnPremisePath> tags which will contain feature classes names and their catalog/geodatabase path.

Code wise, you could use Python to parse this .xml file, get a dictionary with this structure:

{str:(tuple)} #data type

{servicename:(featureclasspath)} #pseudocode
{servicename:(fc1,fc2,fc3); servicename1:(fc1,fc2); servicename2:(fc5);...} #pseudocode

When you are done with that, you can write a function that will return the key of the dictionary (servicename) based on the value (feature class path name you supply). This will let you know what services you should stop to release the lock to the feature class.

UPDATE April 2016: you can do this with the REST API service manifest for the service, added in ArcGIS Server 10.1 SP1:

http://localhost:6080/arcgis/admin/services/Parks/Landmarks.MapServer/iteminfo/manifest/manifest.%format% 

where %format% is either json or xml

A post with full answer is here: Python script to print the feature classes which are referencing AGS map services

ArcGIS Server 10.0:

Go to C:Program Files (x86)ArcGISServer10.0serverusercfg and open the .cfg file associated with your service. Look for the <FilePath> tag. Now you can iterate through all .cfg files in this folder with Python and get information on what .mxd files are used and since you have access to the .mxd you can get each layer data source path and thus feature class names.

<ServerObjectConfiguration>

    <Description></Description>

    <Properties>
        <FilePath>D:tempTempService.mxd</FilePath>

Answered by Alex Tereshenkov on February 24, 2021

The lock file should contains the server name and process ID (PID) like MyFeatureClass.MyServerName.57784.63616.sr.lock.

The second number in the file name 63616 is the PID. If you have access to the server, got to the task manager under the Detail tab, search for that PID, and under the Command Line column you can identify the service name

Answered by SEALJACK on February 24, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP