I'm looking for some guidance on modifying the assignment workforce scripts so I can use them with the windows scheduler and have them run in the background. The scripts work great when I run them from the Python Command Prompt, but I'm not sure how to switch to Windows Scheduler automation. Just running the script as is in WinSch doesn't seem to work. Craig Gillgrass Aaron Pulver
Thanks
What types of errors or logs are generated. You need to make sure that the script is using the correct python interpreter.
This is what my test task looks like (Windows Server 2016):
Make sure you are running with a user that has the correct permissions (depends what you want to do).
Make sure you set the full path to the python environment that has the ArcGIS API for Python installed in my case this is "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe"
Make sure you add an argument with the full path to the script you want to run. In my case this is "C:\Users\<my-username>\some_script.py". Add any other arguments your script by expect.
I would test that the task can be run manually from within the Task Scheduler. Then if that's working, add a trigger to schedule it.
Hope that helps,
Aaron
You should be able to just add the following to the "Add arguments" text box:
C:\Users\username\some_script.py -u aaron -p password ...
I had python scripts that ran perfectly in task scheduler, once we went to windows 10 task scheduler will no longer run the scripts as scheduled as its a security feature in W10 that would always require a login credential of an administrator. Are you using windows 10 and an administrator to your machine?
Hi Aaron,
How would the arguments look in the Task Scheduler? I am used to running batch files that call python and list the arguments directly in the batch, but just opening cmd and running the example code isn't working for me. The scripts only appear to work when running in the Anaconda Prompt. Since the script works just fine when running it manually, I guess I need to open the Anaconda Prompt within Task Scheduler, but then just need direction on how to add the following arguments.
-u username -p password -org "https://<org>.maps.arcgis.com" -project-id "038a1926d2d741dc8acabefd5b2cc5d3" -log-file "../log.txt" -where "1=1"
I am including the full path to the script as the first parameter as you advised, but not sure how the quotes affect task scheduler. So far I am loading them into the argument text box exactly as the example shows in the line above/on your Git site.
Any help would be appreciated.
Haven't had your specific issue. This was more script related. I've been able to run them on this machine with the "Run whether user is logged on or not" option on and "Run with highest privilege" checked. Also had to make sure I was using the correct path to the ArcGIS Pro python environment in the Action dialogue box.
Do you have both ArcMap and Pro installed on the Windows 10 machine? If so, did you call the correct python environment to run?
Did the python Windows Sch. Task ever run on this computer?
This keeps on popping up, only with python in task scheduler?
No, when I add the python script windows 10 requires a password, when its scheduled to run and no password entered it wont run.
Yeah that script was mostly for a demo. You have to modify it to remove the loop (since you will schedule it to run every 1 minute or whatever).
George:
Have you resolved your problem on your Windows 10 desktop machine with running the python based Windows Scheduled Task?
Aaron,
The create assignments by csv script works great using this method, but I can't get the assignment monitor script to work using the the same method. Does this have something to do with the loop that script has in it?
Thanks, I think this will work. The python environment paths were where I was hung up on. I'll let you know what I find.
I am having the same problem since switching to window 10, task scheduler wont schedule a python script either, some sort of security I believe. hope someone can answer also.
Aangemelde leden kunnen berichten plaatsen, updates volgen en meer. Nieuw hier? Registreer een gratis account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.