Learn R Programming

googleCloudRunner (version 0.2.0)

cr_schedule: Creates or updates a Cloud Scheduler job.

Description

Creates or updates a Cloud Scheduler job.

Usage

cr_schedule(
  name,
  schedule = NULL,
  httpTarget = NULL,
  description = NULL,
  overwrite = FALSE,
  timeZone = Sys.timezone(),
  region = cr_region_get(),
  projectId = cr_project_get()
)

Arguments

name

Optionally caller-specified in CreateJob, after

schedule

A cron schedule e.g. "15 5 * * *"

httpTarget

A HTTP target object HttpTarget

description

Optionally caller-specified in CreateJob or

overwrite

If TRUE and an existing job with the same name exists, will overwrite it with the new parameters

timeZone

Specifies the time zone to be used in interpreting schedule. If set to NULL will be "UTC". Note that some time zones include a provision for daylight savings time.

region

The region usually set with cr_region_set

projectId

The GCP project to run within usually set with cr_project_set

See Also

Google Documentation for Cloud Scheduler

Other Cloud Scheduler functions: HttpTarget(), Job(), cr_build_schedule_http(), cr_schedule_delete(), cr_schedule_get(), cr_schedule_list(), cr_schedule_pause(), cr_schedule_run()

Examples

Run this code
# NOT RUN {
# }
# NOT RUN {
cr_project_set("my-project")
cr_region_set("europe-west1")
cr_schedule("test",
      "* * * * *",
      httpTarget = HttpTarget(uri="https://code.markedmondson.me"))

# schedule a cloud build (no source)
build1 <- cr_build_make("cloudbuild.yaml")
cr_schedule("cloud-build-test", "15 5 * * *",
             httpTarget = cr_build_schedule_http(build1))

# schedule a cloud build with code source from GCS bucket
my_gcs_source <- cr_build_upload_gcs("my_folder", bucket = cr_get_bucket())
build <- cr_build_make("cloudbuild.yaml", source = my_gcs_source))
cr_schedule("cloud-build-test2", "15 5 * * *",
            httpTarget = cr_build_schedule_http(build))

# update a schedule with the same name - only supply what you want to change
cr_schedule("cloud-build-test2", "12 6 * * *", overwrite=TRUE)

# By default will use the timezone as specified by Sys.timezone() - change
# this by supplying it directly
cr_schedule("timzone-utc", "12 2 * * *", timeZone = "UTC")
# }

Run the code above in your browser using DataLab