Is there a way in model builder to set the model to look for lock files on all data used in the process before commencing? Alternatively, is there a way to get the model to wait for a lock file to clear before continuing instead of just stopping and leaving everything half done?
Whilst these are the preferable methods, if they can't be achieved, can it be set up to skip steps and go down an alternative path which I could write to restore the original data (my model makes copies of the old data before commencing, which get deleted at the end if it completes all processes successfully in case another user access the data and interrupts the processes).
Are you looking to test prior to a using a particular tool? or just in general?
Rules for working with schema locks—Help | ArcGIS for Desktop
TestSchemaLock—Help | ArcGIS for Desktop
Either way. Just trying to figure out a better way to do it than waiting and seeing if it succeeds which is what happens currently when someone interrupts from elsewhere in the network. It would be good to have it built in as as part of the model so that it's all wrapped up in a simple operation though.
There must be an environment setting that you can use in modelbuilder that allows for the check. When it comes to network locks...I presume that it would be the same but it would cripple a model and you would have to bail since you have no clue when the lock would be released if ever.
There is a function in arcpy to allow you to test for schema locks.
TestSchemaLock
http://desktop.arcgis.com/en/desktop/latest/analyze/arcpy-functions/testschemalock.htm
You will want to implement If-then-Logic in your model if you want it to continue working if it is unable to get an exclusive lock. An example of this is shown on the following page:
Using If-Then-Else logic for branching
You would need to essentially modify the code uses within the examples to leverage the TestSchemaLock method. This would allow you to skip portions of your model if they aren't ready to run. As a more advanced idea, you may be able to implement logic in the script that could check for the locks over a period of time prior to updating the model if it can continue.
Python time.sleep method