RT Guide: Chapter 7, Workstation Scheduler
Introduction
This article contains the detailed instruction on using our new Workstation Scheduler functionality. The information contained here will help you set up “automation” for various scripts that you might want to run from your SDC workstation at periodical times. Ideally, the automated scripts should be scheduled to run sometime when you are not using the system so there is little overlap which will minimize the possibility of interrupting your workflow. There are 2 main components that are needed from the researcher’s side to set up this automation.
.yaml
scheduleWindows'
Task Scheduler
.yaml
schedule
The purpose of the .yaml
schedule is so that we have the timing of when to turn your workstation on/off so that we can manage resources effectively while still allowing you to schedule tasks. There are a couple things to make sure to include in the .yaml
schedule. The YAML file can be named anything as long as it is located in the prefix Workstation-Schedules
, for example s3://prod.sdc.dot.gov.team.acme-research-team/Workstation-Schedules
.
Workstation
Your workstation’s name. It should look something like
ECSPWXXX01
Timezone
Make sure the time zone you name here is the same one your workstation’s
Task Scheduler
is set to.
Schedules
For each schedule you need to include:Day
Daily: When the value of
Day
isDaily
the schedule will run every day at theTime
specifiedOn a date: When the value of
Day
is an ISO formatted date the schedule will run on that date at theTime
specifiedDay of the week: When the value of
Day
isSunday
throughSaturday
the schedule will run on that day of the week at theTime
specifiedDay of the month: When the value of
Day
is an integer-1
through31
the schedule will run on that day of the month at theTime
specified (-1
will run on the last day of the month)
Time
The time of day that the schedule will start your workstation
Time should follow an
HH:MM
format in a 24 hour clock
Duration
To fill out the duration of your task you need to run it a few times manually to understand approximately how long it takes to complete. We recommend adding anywhere from 5 - 45 minutes to the longest runtime of 3 manually run trials depending on the runtime of your script (a few minutes to many hours) to get an upper bound that minimizes the risk of shutting down your workstation early. Use your judgement on how much time to add for extra padding on your script. If your task takes 5 minutes to complete at its longest, then a 5 minute buffer would likely be enough (so you would set the duration to 10 minutes). If your task takes 5+ hours to run at its longest, it would make sense to add.
Duration should follow an
HH:MM
format
Example of .yaml
schedule
Workstation: ECSPWABC01
Timezone: US/Eastern
Schedules:
- Day: Daily # Daily, ISO Date, Sunday-Saturday or Day of month (-1 for last day of the month)
Time: "10:00" # 24 hour clock
Duration: "3:00" # 0-24 hours
- Day: "2022-09-01"
Time: "09:00"
Duration: "12:00"
- Day: Monday
Time: "03:00"
Duration: "1:00"
- Day: -1
Time: "07:00"
Duration: "12:00"
Once you have created the .yaml
schedule, please save it in your team's s3 bucket.
Windows' Task Scheduler
The Task Scheduler
is a program on Windows machines that allows for the scheduling of tasks to be run at a specific time. For this to work, the workstation needs to be on and running, which is what our Workstation Scheduler does. Below are some detailed instructions on how to set up the Task Scheduler
on your workstation.
Note: For now, our Workstation Scheduler has an hourly granularity, meaning it will activate once an hour to check if your workstation needs to be activated. Because of the way our Workstation Scheduler works, you should only schedule tasks to activate at the ‘top’ of the hour. So, for example, when you’re scheduling a task on the Task Scheduler
, it should be scheduled for the hour you want and no minutes (i.e. 11:00, 2:00, 4:00, etc.)
Instructions for setting up a task on the Task Scheduler
Open the start menu on your workstation and type ‘task scheduler’, click on the icon.
Click on the ‘Create Task’ button
Fill out relevant information about the task under the
General
tab:Give the task an appropriate name
Add a short description of what the task does
Select the option
Run whether user is logged in or not
, then selectRun with the highest privileges
Change the
Configure for:
option if necessary
Next, select the
Triggers
tab and pressNew
Select the appropriate trigger based on how often you want your script to run, we recommend having your script run at some time when there will be no one else on the workstation (early morning or late night) if it is possible. Also, make sure to schedule the task at the 'top' of the hour.
Keep track of the trigger times and dates you set up as they will be important in the next step of the setup.
Select the options that match the frequency of when you need the task performed
Daily, weekly, monthly, etc. What time? How often?
Selecting the
Synchronize across time zones
option sets the time to UTC. If your workstation is using a time zone other than UTC and you should leave the box unchecked. Ensure to specify the time zone your workstation is using in the.yaml
scheduler file later.Keep track of the time zone that you are using for the
task scheduler
.
Next, select the
Actions
tab and pressNew
:
Select the appropriate
Action
, usuallyStart a program
, and find the program using the browse functionality
The
Start in
value is the directory in which the application/program/script starts. This matters for when it calls other resources. If it callssomecustom.exe
that's not in thatStart in
directory, it won't be found, and your application/program/script will error out. If you call absolutely everything by path, it shouldn't matter.Next you will want to add some options in the
Settings
tab of the menu.The most important option here is the
Run task as soon as possible after a scheduled start is missed
. This will allow us to mitigate potential problems that arise with the timing of the automated tasks.
You may also add extra options within the
Conditions
andSettings
tabs that may be useful for your particular script or program.
When the task is set up and configured to your liking, press the OK
button on the bottom of the window to create the task and have it "automated" on your computer.
Deleting a Task
To delete a task you just need to re-open the task scheduler and find it in the task scheduler library, right click on the task, and click delete. You can also do things like run the task manually, end, and disable the task temporarily.