Skip to content

Commit

Permalink
[fix] gcp account handling (#38)
Browse files Browse the repository at this point in the history
* [feat] allow debug via env

* dump json
  • Loading branch information
aquamatthias authored May 22, 2024
1 parent 6d83b5b commit fd902e2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
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

0 comments on commit fd902e2

Please sign in to comment.