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] gcp account handling #38

Merged
merged 2 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
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
7 changes: 6 additions & 1 deletion collect_coordinator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,12 @@ async def on_start_stop(_: Application) -> AsyncIterator[None]:
def main() -> None:
ap = ArgumentParser()
ap.add_argument("--namespace", help="The namespace to start the jobs in.", required=True)
ap.add_argument("--debug", action="store_true", help="Enable debug logging")
ap.add_argument(
"--debug",
action="store_true",
help="Enable debug logging",
default=os.environ.get("COORDINATOR_DEBUG", "").lower() == "true",
)
ap.add_argument("--kube-config", help="Optional path to kube config file.")
ap.add_argument(
"--redis-url-nodb", help="Redis host. Default: redis://localhost:6379", default="redis://localhost:6379"
Expand Down
9 changes: 4 additions & 5 deletions collect_coordinator/worker_queue.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@ def __init__(

@timed(module="collect_coordinator", name="collect")
async def collect(self, ctx: Dict[Any, Any], *args: Any, **kwargs: Any) -> bool:
# TODO: switch to debug here
log.info(f"Collect function called with ctx: {ctx}, args: {args}, kwargs: {kwargs}")
log.debug(f"Collect function called with ctx: {ctx}, args: {args}, kwargs: {kwargs}")
job_id: str = ctx["job_id"]
if len(args) == 1 and isinstance(args[0], dict):
data = args[0]
Expand Down Expand Up @@ -194,9 +193,9 @@ def handle_azure_subscription() -> None:
}

def handle_gcp_project() -> None:
gcp_project_id = account["gcp_project_id"]
gcp_credentials = account["google_application_credentials"]
env["GCP_CREDENTIALS"] = gcp_credentials
gcp_project_id: str = account["gcp_project_id"]
gcp_credentials: Json = account["google_application_credentials"]
env["GCP_CREDENTIALS"] = json.dumps(gcp_credentials)
filename = f"{ImageHome}/.gcp/credentials"
coordinator_args.extend(
[
Expand Down
Loading