Skip to content

Commit f7233c6

Browse files
committed
move shared mounts draft
Signed-off-by: Jared Wilber <jwilber@nvidia.com>
1 parent 2bc8ec2 commit f7233c6

File tree

1 file changed

+26
-3
lines changed

1 file changed

+26
-3
lines changed

ci/lepton/model_convergence/scripts/launch_job.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,12 @@
66
"""
77

88
import hydra
9+
import json
10+
911
from omegaconf import DictConfig
1012
from typing import Dict
13+
from types import SimpleNamespace
14+
1115
from leptonai.api.v2.client import APIClient
1216
from leptonai.api.v1.types.affinity import LeptonResourceAffinity
1317
from leptonai.api.v1.types.common import Metadata
@@ -16,6 +20,18 @@
1620
from omegaconf import OmegaConf
1721
from omegaconf import DictConfig as HydraDictConfig, ListConfig
1822

23+
# todo: move to some defaults file
24+
default_mounts = [
25+
{"path": "/BioNeMo", "mount_path": "/BioNeMo", "from_": "node-nfs:lepton-shared-fs"},
26+
]
27+
28+
default_env_vars = [
29+
{"name": "KRATOS_SSA_URL", "value_from": "KRATOS_SSA_URL"},
30+
{"name": "KRATOS_SSA_CLIENT_ID", "value_from": "KRATOS_SSA_CLIENT_ID"},
31+
{"name": "KRATOS_SSA_SECRET", "value_from": "KRATOS_SSA_SECRET"},
32+
{"name": "LEP_LOGIN_CREDENTIALS", "value_from": "LEP_LOGIN_CREDENTIALS"},
33+
]
34+
1935

2036
# todo: make utils file? also, add cfg checks to make sure these are used in the config before calling
2137
def construct_mount(path: str, mount_path: str, from_: str = "node-nfs:lepton-shared-fs") -> Mount:
@@ -31,7 +47,7 @@ def construct_mount(path: str, mount_path: str, from_: str = "node-nfs:lepton-sh
3147

3248
def construct_env_var(env_var) -> EnvVar:
3349
"""Construct an EnvVar object from a config entry, supporting both secrets and literals."""
34-
if 'value_from' in env_var:
50+
if hasattr(env_var, 'value_from') and env_var.value_from is not None:
3551
return EnvVar(
3652
name=env_var.name,
3753
value_from=EnvValue(secret_name_ref=env_var.value_from),
@@ -43,8 +59,12 @@ def construct_env_var(env_var) -> EnvVar:
4359
)
4460

4561

46-
import json
47-
from typing import Dict
62+
bionemo_mount = construct_mount(
63+
path=default_mounts[0]['path'], mount_path=default_mounts[0]['mount_path'], from_=default_mounts[0]['from_']
64+
)
65+
66+
bionemo_env_vars = [construct_env_var(SimpleNamespace(**env_var)) for env_var in default_env_vars]
67+
print('bionemo_env_vars', bionemo_env_vars)
4868

4969

5070
def wrap_with_wandb_copy(
@@ -306,6 +326,9 @@ def main(cfg: DictConfig):
306326
if hasattr(cfg, "mounts") and cfg.mounts:
307327
mounts = [construct_mount(path=m.path, mount_path=m.mount_path, from_=m.from_) for m in cfg.mounts]
308328

329+
print('env_vars', env_vars)
330+
print('mounts', mounts)
331+
309332
# Create job specification
310333
job_spec = LeptonJobUserSpec(
311334
resource_shape=cfg.resource_shape,

0 commit comments

Comments
 (0)