Skip to content

Commit 5706357

Browse files
more fixes
1 parent e0101bd commit 5706357

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

keras_remote/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55
os.environ.setdefault("GLOG_minloglevel", "3")
66
os.environ.setdefault("GRPC_ENABLE_FORK_SUPPORT", "0")
77

8-
from keras_remote.core.core import run
8+
from keras_remote.core.core import run as run

keras_remote/backend/gke_client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,21 +68,21 @@ def submit_k8s_job(
6868
f"Permission denied creating K8s Job. Ensure your kubeconfig "
6969
f"has 'create' permission for Jobs in namespace '{namespace}'. "
7070
f"Run: kubectl auth can-i create jobs -n {namespace}"
71-
)
71+
) from e
7272
elif e.status == 404:
7373
raise RuntimeError(
7474
f"Namespace '{namespace}' not found. Create it with: "
7575
f"kubectl create namespace {namespace}"
76-
)
76+
) from e
7777
elif e.status == 409:
7878
raise RuntimeError(
7979
f"Job '{job_name}' already exists. "
8080
f"Clean up with: kubectl delete job {job_name} -n {namespace}"
81-
)
81+
) from e
8282
else:
8383
raise RuntimeError(
8484
f"Kubernetes API error: {e.status} - {e.reason}: {e.body}"
85-
)
85+
) from e
8686

8787

8888
def wait_for_job(job, namespace="default", timeout=3600, poll_interval=10):
@@ -118,7 +118,7 @@ def wait_for_job(job, namespace="default", timeout=3600, poll_interval=10):
118118
try:
119119
job_status = batch_v1.read_namespaced_job_status(job_name, namespace)
120120
except ApiException as e:
121-
raise RuntimeError(f"Failed to read job status: {e.reason}")
121+
raise RuntimeError(f"Failed to read job status: {e.reason}") from e
122122

123123
# Check completion conditions
124124
if job_status.status.succeeded and job_status.status.succeeded >= 1:
@@ -232,7 +232,7 @@ def _load_kube_config():
232232
f"Failed to load Kubernetes configuration. "
233233
f"Ensure you have run 'gcloud container clusters get-credentials <cluster-name>' "
234234
f"or have a valid kubeconfig. Error: {e}"
235-
)
235+
) from e
236236

237237

238238
def _create_job_spec(

keras_remote/cli/commands/up.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def up(project, zone, accelerator, cluster_name, yes):
6464
try:
6565
accel_config = accelerators.parse_accelerator(accelerator)
6666
except ValueError as e:
67-
raise click.BadParameter(str(e), param_hint="--accelerator")
67+
raise click.BadParameter(str(e), param_hint="--accelerator") from e
6868
else:
6969
accel_config = prompt_accelerator()
7070

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,7 @@ line-length = 80
6464

6565
[tool.ruff.lint]
6666
select = ["B", "E", "F", "N", "PYI", "T20", "TID", "SIM", "W", "I", "NPY"]
67-
ignore = ["E501"]
67+
ignore = ["E501"]
68+
69+
[tool.ruff.lint.per-file-ignores]
70+
"examples/*" = ["T201", "NPY002"]

0 commit comments

Comments
 (0)