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

allow cloud run job overrides #500

Open
sleithart opened this issue May 12, 2024 · 3 comments
Open

allow cloud run job overrides #500

sleithart opened this issue May 12, 2024 · 3 comments
Labels
enhancement Improvement to existing feature or Goblet in general

Comments

@sleithart
Copy link

I'm trying to run a cloud run function that processes a GCS folder based on a parameter that's passed in. I'm not able to run the function because Goblet doesn't allow arbitrary arguments passed into the CLI.

Ideally, this would allow someone to capture an args parameter or similar that's passed into the job, but it's easy enough to use something like sys.argv to grab any arguments that are passed in.

Here's the RunJobRequest documentation that specifies allowing overrides: https://cloud.google.com/python/docs/reference/run/latest/google.cloud.run_v2.types.RunJobRequest

@anovis anovis added the enhancement Improvement to existing feature or Goblet in general label May 12, 2024
@anovis
Copy link
Collaborator

anovis commented May 12, 2024

@sleithart how are you calling your cloudrun job? Are you using the goblet cli or calling the deployed cloudrun job directly via the run endpoint.

I think you actually should be able to achieve you use case with goblet as is, by overriding environment variables when calling the run endpoint and having your script use those env variables as the parameter to process.

so you can deploy your goblet cloudrun job as is and then use a container override to set your desired environment variable (https://cloud.google.com/run/docs/reference/rest/v2/projects.locations.jobs/run#ContainerOverride) .

let me know if this makes sense and works for you.

separately i can look into how we could override the args parameter and pass that in through goblet.

@sleithart
Copy link
Author

I'm using ContainerOverride via the Python client, but using args instead of env vars. I'll try out env vars and see if that works. It seems like a good short term solution, but also feels like a bit of an anti-pattern long-term. If I have time, I may submit a PR for the args change.

Thanks for the help! Love using Goblet so far.

@sleithart
Copy link
Author

just for anyone else finding this... using env vars worked well for me and should be a pretty decent holdover.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing feature or Goblet in general
Projects
None yet
Development

No branches or pull requests

2 participants