MarkEdmondson1234 / googleCloudRunner

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

Cannot Delete Schedule - due to guesses #168

Closed muschellij2 closed 2 years ago

muschellij2 commented 2 years ago

I guess you can do it, but I'm not sure about the default for cleanup as: https://github.com/MarkEdmondson1234/googleCloudRunner/blob/b784ca9bf770b74266fba49d30750a3b9212a14a/R/cloudscheduler.R#L270

trailrun::cr_gce_setup()
#> ℹ 2022-01-15 20:24:16 > Region set to us-east4
#> ℹ 2022-01-15 20:24:16 > ProjectId set to streamline-resources
#> ℹ GCP project successfully set!
#> Warning in bucket_check(bucket, project = project): No bucket was supplied so
#> using streamline-resources_cloudbuild
#> ℹ 2022-01-15 20:24:16 > Bucket set to streamline-resources_cloudbuild
#> ℹ 2022-01-15 20:24:16 > cloudbuildEmail set to default
#> $project
#> [1] "streamline-resources"
#> 
#> $region
#> [1] "us-east4"
#> 
#> $email
#> [1] "default"
#> 
#> $token
#> <GceToken>
library(googleCloudRunner)
schedules = cr_schedule_list()
schedules = schedules$name
print(basename(schedules))
#> [1] "pull_gtrends_closure_data" "pull_gtrends_data"        
#> [3] "schedule-test-trigger"
"schedule-test-trigger" %in% basename(schedules)
#> [1] TRUE
cr_schedule_delete("schedule-test-trigger")
#> ℹ 2022-01-15 20:24:17 > PubSub triggered Cloud Build detected.  Attempting to delete topic and build trigger as well for projects/streamline-resources/locations/us-east4/jobs/schedule-test-trigger
#> ℹ 2022-01-15 20:24:17 > Fetching build trigger schedule-test-trigger-topic-trigger
#> ℹ 2022-01-15 20:24:17 > Request Status Code:  404
#> Error: API returned: triggerError spanner trigger (968618389177, schedule-test-trigger-topic-trigger) not found

Created on 2022-01-15 by the reprex package (v2.0.1)

MarkEdmondson1234 commented 2 years ago

Thanks had the same during tests but think it's solved locally in a commit not made yet. It's - vs _ (dash vs underscore)

muschellij2 commented 2 years ago

The issue is that the schedule schedule-test-trigger-topic-trigger does not exist, but I passed in schedule-test-trigger, but the default is pubsub_cleanup which fails before running the delete.

MarkEdmondson1234 commented 2 years ago

Makes sense, I was assuming all jobs were pubsub jobs when they are not.