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

Error on testing scheduling R script #189

Closed eteitelbaum closed 2 years ago

eteitelbaum commented 2 years ago

I was able to configure googleCloudRunner and get everything working except for the last test (Cloud Scheduler - R script) where I get this error message:

-- Testing scheduling R script deployments via cr_deploy_r(schedule = ' *') --

i 2022-03-25 13:29:33 > Deploy R script cr_rscript_2022031648229373132933 to Cloud Build i 2022-03-25 13:29:33 > Scheduling R script on cron schedule: * i 2022-03-25 13:29:33 > Creating PubSub topic: cr_rscript_2022031648229373132933-topic Error: Could not create topic:cr_rscript_2022031648229373132933-topicNo projectId set - use ps_project_set() or set GCP_PROJECT env var

Here is my session info:

MarkEdmondson1234 commented 2 years ago

Thanks for report! It looks like the setup steps for library(googlePubSubR) should also be set which I missed as it's a one time thing you do. I'll look to add docs and update script to help with it.

MarkEdmondson1234 commented 2 years ago

This should be fixed now, but needs testing

sommerhd-royals commented 2 years ago

Hi @MarkEdmondson1234 - I had the same error today as @eteitelbaum when trying to run cr_setup_test(). Everything was successful right up until the creating PubSub topic point.

Thanks for the tip above, as running library(googlePubSubR) gave me the below information:

library(googlePubsubR) ! GCP_PROJECT environment not found, please set it up before starting! ! googlePubsubR: GCP_AUTH_FILE environment variable not found, please set it up before authenticating

From there, i checked the https://cran.r-project.org/web/packages/googlePubsubR/googlePubsubR.pdf documentation and ran the ps_project_set() function (but with project id specified) in my RStudio session to set GCP projectID, then re-ran cr_setup_test(), and the setup finished successfully. @eteitelbaum I hope that helps a little.

MarkEdmondson1234 commented 2 years ago

Thanks for report, did the error still occur with GitHub version or were you on CRAN version? It should be fixed in the former.

sommerhd-royals commented 2 years ago

I was on CRAN version using RStudio.

MarkEdmondson1234 commented 2 years ago

Ok cool, if you install the GitHub version this should be fixed (remotes::install_github("MarkEdmondson1234/googleCloudRunner"))