Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Workloads without WEB on CloudRun #166

Open
LMSSonos opened this issue Mar 22, 2022 · 7 comments
Open

Running Workloads without WEB on CloudRun #166

LMSSonos opened this issue Mar 22, 2022 · 7 comments

Comments

@LMSSonos
Copy link

What is the recommendation to run workloads (containers) which execute a command line tool to do some work (like sending emails, cleaning up data, making calculations, etc) in CloudRun.

@ImAnAutie
Copy link

Kinda depends how often you need to run it, is it on a set schedule?

@LMSSonos
Copy link
Author

It is set on schedule. We have like a current project where all is in cloudrun but run the jobs (about 20 different jobs) that are scheduled from every 1 minute, to every 1h or once a day. Often it's the same container/Tool but different cli arguments.

@sohail288
Copy link

Seems like this will be a reality pretty soon -- there may be support for "server-less" jobs on cloud run. It's in alpha so they may scrap the functionality. Seems promising though. The only documentation I've found is https://cloud.google.com/sdk/gcloud/reference/alpha/run/jobs and some demos at https://github.com/GoogleCloudPlatform/jobs-demos

@LMSSonos
Copy link
Author

@sohail288 - awesome, that was exactly what i was looking for

I just wanted to test it and run into following issue

I tried to run my own container

gcloud alpha run jobs create mytest --image=eu.gcr.io/my-project-name/mycontainer:latest --platform managed --parallelism=1 --region=europe-westX --service-account=mytest-serviceaccount@my-project-name.iam.gserviceaccount.com

Then I get the following exception. I tried to follow https://github.com/GoogleCloudPlatform/jobs-demos/tree/main/screenshot to get it up and running, but failing with the Namespaces instance issue and can't figure out which part I'm missing.

job to Cloud Run service [mytest] in project [my-project-name] region [europe-westX]
X Creating and starting job...
  . Provisioning resources...
Job failed
ERROR: (gcloud.alpha.run.jobs.create) Namespaces instance [my-project-name] not found: Requested entity was not found.

@sohail288
Copy link

@LMSSonos not sure about the namespace error. I was able to run a simple python based docker image using the alpha API without any issue (besides the documentation not matching up with the actual exposed gcloud commands). FYI I was running it in us-central1.

@LMSSonos
Copy link
Author

LMSSonos commented May 1, 2022

@sohail288 thanks, works now well for me. I received an update for gcloud and with following version it works now as expected.

alpha 2022.04.26
bq 2.0.74
core 2022.04.26
gsutil 5.9

Will start to move some real workload to it ;-)

@phoward38
Copy link

@LMSSonos Another option is using Cloud Scheduler to trigger an endpoint in your Cloud Run service. There's brief documentation about it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants