3

I have a python geoprocessing script published to ArcGIS Server. The script adds domains and updates domains in a geodatabase. This script gets called by Maximo relatively infrequently, but when it does, I need to disconnect the users from the geodatabase, because ArcGIS throws a 000464 error. I don't want to disconnect users during business hours, and I can delay the modification of the domain until late at night.

How can I delay the running of a geoprocessing script once it has been triggered?

I'm not sure if it's possible, but the two things I can think of doing are:

  • Adding a time.sleep function in the code to sleep until the middle of the night
  • Modifying the geoprocessing script to save a text file and then schedule the script to run overnight and pick up the file and process it then.

Neither of these seem particularly appealing to me and I'm looking for better options.

5
  • The GP script can create a JSON file/files for the late-night batch job(s) to run.
    – Vince
    Jul 27, 2022 at 0:22
  • Can you explain why you would like to avoid running an overnight scheduled task for this? It seems like the obvious answer (as I've detailed below, but you're probably already familiar with this, I'm guessing). Is it the saving text file(s) part, or the scheduled task part that you want to avoid? (Or something else, or both? Why?) Jul 27, 2022 at 0:24
  • I used to have Maximo do a lot of updates to feature services, but not via Geoprocessing services. What is the nature of changes it is making? Eg, additions to existing domains, or completely replacing those domains? If it is always a complete replace of the domains, it could write the data to a table(s) via a feature service (instead of a geoprocessing service). That way it avoids having to save to text files. Then an overnight job could check the tables, and re-generate the domains (and then remove/truncate the tables). Jul 27, 2022 at 0:31
  • @SonofaBeach The main reason I'd like to avoid running an overnight scheduled task was purely out of laziness and introducing more complexity for the project. But, if I have to do it, I'm prepared to do it. I already have a scheduled task doing something similar, so there is precedent... This particular geoprocessing script is triggered from Maximo when a domain is created or values updated. It will update the domains or create them in the geodatabase. We want the GIS domains to match the Maximo domains.
    – Fezter
    Jul 27, 2022 at 1:31
  • I feel your pain. I used to have to keep them in sync manually between the same two applications and would have looked into automating it if I hadn't left that job soon afterwards. Jul 27, 2022 at 1:33

1 Answer 1

4

Use the Windows Task Scheduler to run the script every night at a set time. The script can check to see if it needs to do anything, and just exit if there's nothing to be done.

I know that this is kind of what you said you didn't want to do, but running geoprocessing tasks from the Task Scheduler is standard practice for ArcGIS admins. AND it is what ESRI recommends in many different articles. Eg:

I've got about 10 scripts that run every night, and a few more that run weekly. I have the Task Scheduler job configured to just run ONE script, and that one script then calls each of the other jobs in turn. This avoids having separate Task Scheduler jobs for each script, means that you only have to disconnect users once at the beginning of the first script, etc.

The master script should do the user-disconnection, if required. It can also be written to check for exceptions, and re-enable connections after failure (as well as after running the last script).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.