Hi all,
I have a simple model that replaces the data in a hosted feature service with data from a SQL server database. I would like this to run every night. When I run the model in my pro project, it works great, but I have yet to have a successful run overnight using Windows Task Scheduler. After some research and talking briefly with tech support (they are able to give me limited support as they don't really deal with WTS), here is everything that I have tried:
Another weird thing is that even after changing all of these settings, my tasks are set to run at 12:00AM (batch file to open pro) and 12:30AM (scheduled model builder), but they are actually running at varying times just after 6AM. I feel I am close with the idea that I need Pro open in order to run the model, since I'm needing to connect to my SQL database connection and AGO credentials, but I'm hitting a wall since the batch file I tried is not doing the trick.
This is my first time trying to schedule a model like this so any help is appreciated.
Here is the model:
Here's what I see when I check if it has run in the morning, there are no helpful messages along with it:
Have you checked Event Viewer for any errors?
Would you be willing to save model as python script and try running it from python with error catching that might yield some clues on why it is not running?
Event Viewer and Windows task scheduler both are showing that the tasks are starting and completing successfully, but ArcGIS Pro history is showing it failed. I will attempt today to run it from python and see if I get different results. I'm new to this so very much figuring it out as I go.
I'm having what seems to be the same issue. I can set up a model to run via the scheduler option, run the task manually in Pro from the History tab, then the "Run Now" option, and it runs just fine (takes about 5 minutes to complete). If I then go to Windows Task Scheduler and change from "Run only when user is logged on" to "Run whether user is logged on or not", then follow the same "Run Now" process as before, in Pro, the task runs for about 4 seconds, then just terminates without having done anything.
The user account that I set for that "Run whether the user is logged on or not" setting has full admin privileges on the PC. Checking the box for "Run with highest privileges" doesn't make any difference. I also have set Pro to have its license "checked out" as offline from AGOL as well. None of these things seems to have any effect. The task either runs fine when Task Scheduler is in the "logged on" mode and never runs properly when in the "whether logged in/out" mode. I'm currently working with Esri Tech Support on this, but they are stumped too.
Pro 3.4.3 Advanced.
I seem to have gotten this one fixed. In the python script that the task scheduler uses, there are path reference to the network drive where the Pro project lives. Those references are using our drive letter mappings. Drive letters do not work when the user is not logged in. I ended up changing the path string in that py file from the drive letter format to the actual UNC path format. Now the model automation runs correctly.
Yes when running automated scripts, it is best practice to use UNC path format. This is also a requirement when publishing GIS services from network drives, you need to use the UNC path format.