Skip to content

Commit 50e8feb

Browse files
Address reviews
1 parent f27dc4d commit 50e8feb

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

keras_remote/backend/execution.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ def from_params(
102102
class BaseK8sBackend:
103103
"""Base class for Kubernetes-based backends."""
104104

105-
def __init__(self, cluster: Optional[str] = None, namespace: str = "default"):
105+
def __init__(self, cluster: str, namespace: str = "default"):
106106
self.cluster = cluster
107107
self.namespace = namespace
108108

@@ -225,13 +225,14 @@ def _prepare_artifacts(
225225
# Get caller directory
226226
frame = inspect.stack()[caller_frame_depth]
227227
module = inspect.getmodule(frame[0])
228-
if module:
228+
caller_path: str
229+
if module and module.__file__:
229230
caller_path = os.path.dirname(os.path.abspath(module.__file__))
230231
else:
231232
caller_path = os.getcwd()
232233

233-
# --- Process Data objects ---
234-
exclude_paths = set()
234+
# Process Data objects
235+
exclude_paths: set[str] = set()
235236
ref_map = {} # id(Data) -> ref dict (for arg replacement)
236237
volume_refs = [] # list of ref dicts (for volumes)
237238

@@ -307,6 +308,8 @@ def _build_container(ctx: JobContext) -> None:
307308

308309
def _upload_artifacts(ctx: JobContext) -> None:
309310
"""Phase 3: Upload artifacts to Cloud Storage."""
311+
if ctx.payload_path is None or ctx.context_path is None:
312+
raise ValueError("payload_path and context_path must be set before upload")
310313
logging.info("Uploading artifacts to Cloud Storage (job: %s)...", ctx.job_id)
311314
storage.upload_artifacts(
312315
bucket_name=ctx.bucket_name,

0 commit comments

Comments
 (0)