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

Fix setting of env vars in gcloud deploy #9

Merged
merged 1 commit into from
Feb 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions prediction_market_agent_tooling/deploy/gcp/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def gcloud_deploy_cmd(
api_keys: dict[str, str],
memory: int, # in MB
) -> str:
api_keys_str = " ".join([f"{k}={v}" for k, v in api_keys.items()])
cmd = (
f"gcloud functions deploy {gcp_function_name} "
f"--runtime {get_gcloud_python_runtime_str()} "
Expand All @@ -25,8 +24,8 @@ def gcloud_deploy_cmd(
f"--memory {memory}MB "
f"--no-allow-unauthenticated "
)
if api_keys:
cmd += f"--set-env-vars {api_keys_str} "
for k, v in api_keys.items():
cmd += f"--set-env-vars {k}={v} "
Comment on lines +27 to +28
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The loop correctly iterates over api_keys to set environment variables individually. However, this approach may lead to a command length limit issue if there are many API keys. Consider batching the environment variables or checking for command length limits.


return cmd

Expand Down
Loading