I am trying to run an R script every hour that downloads data from an API, manipulate it, and writes out some product. Each run takes 3-5h, but I can't seem to schedule a task that will successfully run multiple instances at the same time.
I use the Windows Task Scheduler to plan a task which triggers at a given time and is then repeated every 1 hour.
I run it whether logged on or not with the highest privilege (no issue with that)
The action involves running a .bat file which contains the following text:
@echo on start "" "C:\Program Files\R\R-3.4.2\bin\x64\R.exe" CMD BATCH --vanilla F:\storm\src\download_rasters.R
If the task is already running, I set it to 'Run a new instance in parallel'
Now, I'm new to batch files and task scheduling, but here are some troubleshooting clues:
My guess is that I am missing something in the batch file that would allow it to run separate instances of R from the same batch file, but I can't figure out what it is.
I got it to work by using the batch file to directly run an R command sourcing the script.
@echo off
"C:\Program Files\R\R-3.4.2\bin\x64\R.exe" -e source('F:/storm\src\download_rasters.R')
It's not great so better solutions are welcome.