MarkEdmondson1234 / googleCloudRunner

Easy R scripts on Google Cloud Platform via Cloud Run, Cloud Build and Cloud Scheduler
https://code.markedmondson.me/googleCloudRunner/
Other
81 stars 26 forks source link

ENH: cr_schedule_build #134

Open muschellij2 opened 2 years ago

muschellij2 commented 2 years ago

I didn't incorporate this into a PR since I'm not sure this is just a misunderstanding of how I should be using the scheduling, but would it be worthwhile to have the following function? The main goal is to alleviate the step of httpTarget if not specified.

cr_schedule_build = function(build,
                             schedule = NULL,
                             name = NULL,
                             email = cr_email_get(),
                             region = cr_region_get(),
                             projectId = cr_project_get(),
                             ...
) {

  https <- cr_build_schedule_http(br,
                                  email = email,
                                  projectId = projectId)

  brs <- cr_schedule(
    schedule = schedule,
    name = name,
    region = region,
    httpTarget = https,
    ...)
  return(brs)
}

I see the examples in cr_schedule to have ones similar to this such as:

# 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))

but I figured it'd be worthwhile to make an explicit function.

MarkEdmondson1234 commented 2 years ago

Yes makes sense, the crdeploy* functions have this role but it's a common enough need to make the bit low level steps less arduous.

A todo is to increase support for the non-http endpoints such as pubsub.