gce_schedule_docker.Rd
Utility function to start a VM to run a docker container on a schedule. You will need to create and build the Dockerfile first.
gce_schedule_docker(docker_image, schedule = "53 4 * * *", vm = gce_vm_scheduler())
docker_image | the hosted docker image to run on a schedule |
---|---|
schedule | The schedule you want to run via cron |
vm | A VM object to schedule the script upon that you can SSH into |
The crontab schedule of the VM including your script
You may need to run gce_vm_scheduler yourself first and then set
up SSH details if not defaults, to pass to argument vm
You can create a Dockerfile with your R script installed by
running it through containeRit::dockerfile
. It also takes care of any dependencies.
It is recommended to create a script that is self contained in output and input,
e.g. don't save files to the VM, instead upload or download any files
from Google Cloud Storage via authentication via googleAuthR::gar_gce_auth()
then downloading and uploading data using library(googleCloudStorageR)
or similar.
Once the script is working locally, build it and upload to a repository
so it can be reached via argument docker_image
You can build via Google cloud repository build triggers, in which case the name can be created via gce_tag_container or build via docker_build to build on another VM or locally, then push to a registry via gce_push_registry
Any Docker image can be run, it does not have to be an R one.
Other scheduler functions: gce_vm_scheduler