Skip to content

Commit 227c7ec

Browse files
Install pulumi in keras-remote HOME
1 parent 865b3f6 commit 227c7ec

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

keras_remote/cli/constants.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"KERAS_REMOTE_STATE_DIR",
1313
os.path.expanduser("~/.keras-remote/pulumi"),
1414
)
15+
PULUMI_ROOT = os.path.expanduser("~/.keras-remote/pulumi-cli")
1516
REQUIRED_APIS = [
1617
"compute.googleapis.com",
1718
"cloudbuild.googleapis.com",

keras_remote/cli/infra/stack_manager.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
"""Pulumi Automation API wrapper for keras-remote."""
22

33
import os
4-
import shutil
54

65
import click
76
import pulumi.automation as auto
87

9-
from keras_remote.cli.constants import RESOURCE_NAME_PREFIX, STATE_DIR
8+
from keras_remote.cli.constants import (
9+
PULUMI_ROOT,
10+
RESOURCE_NAME_PREFIX,
11+
STATE_DIR,
12+
)
1013

1114

1215
def get_stack(program_fn, config):
@@ -22,9 +25,11 @@ def get_stack(program_fn, config):
2225
os.makedirs(STATE_DIR, exist_ok=True)
2326

2427
# Auto-install the Pulumi CLI if not already present.
25-
if not shutil.which("pulumi"):
28+
try:
29+
pulumi_cmd = auto.PulumiCommand(root=PULUMI_ROOT)
30+
except Exception: # noqa: BLE001
2631
click.echo("Pulumi CLI not found. Installing...")
27-
pulumi_cmd = auto.PulumiCommand.install()
32+
pulumi_cmd = auto.PulumiCommand.install(root=PULUMI_ROOT)
2833

2934
# Use project ID as stack name so each GCP project gets its own stack
3035
stack_name = config.project

0 commit comments

Comments
 (0)