![]() If there are additional arguments (parameters) to your script, provide them after the path to your script. In the example above, both paths contain spaces, so double quotes are required. Remember that if any of your paths or arguments contain spaces, you need to enclose the argument in double quotes. To avoid this, we recommend that you run the Python executable as the program, with the name of your Python file in the optional argument field. Intuitively, you might think to paste the path to your script in the “Program/Script” box, but this method comes with some pitfalls: namely, discrepancies with the login that Task Scheduler uses and confusion about which version of Python should be used in mixed environments (64 bit or 32 bit). To specify the action, you’re given three fields to fill in. ![]() Whichever way you choose to configure your task, keep the following tips in mind when you specify the action. Alternatively, you can stick with the Create a Basic Task wizard and add any of the options offered by the Create Tasks window after creating the task: just highlight it in the task list and select Properties from the side panel. If you require more flexibility, you’ll find that the Create Tasks window is a better option. If the wizard options meet your needs, great. First, you’re asked to define the name of your task, then the trigger (when and how often it runs), and finally the action (which program to run – in this case, your script). To start, launch the Create Basic Task wizard and click through, noting the essential steps (use fillers to get to the next page – you don’t need to run a real task yet). Both contain the same essential components, but Create Basic Task launches a wizard to walk you through the setup process. The help topic covers the Create Task option (which you’ll likely end up using, as it offers more flexibility), but here we’ll start by looking at the simpler Create Basic Task option. The Actions pane, on the right, offers two options to create tasks. To open Task Scheduler, use the Windows search bar. Note: Though it’s not necessary here, it’s still worth mentioning that in ArcGIS Pro 2.4 it’s quite easy to export a model to Python. The help topic includes a sample of how to do this with a very simple 3-line script. The key is the ImportToolbox function, which allows you to import the toolbox containing the model. Instead, you can run the model from a script as you would any other geoprocessing tool. You won’t need to export the model to a Python script – that’s a common misconception. On the other hand, if you’d like to schedule a geoprocessing model to run at a specific time, you’ll need to bring it into a script first, so start at the beginning of the help topic linked above. Note that the screenshots in this blog and on the help site currently show the 2019 version of Windows 10. The following sections of this post will also contain handy tips for getting started, so be sure to read on before you dive in! It will show you how to schedule a script to run using Windows Task Scheduler. In addition to this post, you should reference the Schedule a model help topic. Once you have your script ready (any script – it doesn’t matter if it started out as a geoprocessing model) you can begin at the “Create a task” section of the help topic. I’ve modified and rearranged the original material to reflect ArcGIS Pro, Windows 10, and Python 3. Often this is done late at night or early in the morning, so when you arrive at your computer each day, the tedious stuff is already done for you. If you have routine, lengthy processes you run with scripts or models, you can take your automation a step further and trigger the task at a specific time of day. ![]() This is an updated version of Dale Honeycutt’s 2013 post “ Scheduling a Python script or model to run at a prescribed time.” The title pretty much speaks for itself.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |