66"""
77
88import hydra
9+ import json
10+
911from omegaconf import DictConfig
1012from typing import Dict
13+ from types import SimpleNamespace
14+
1115from leptonai .api .v2 .client import APIClient
1216from leptonai .api .v1 .types .affinity import LeptonResourceAffinity
1317from leptonai .api .v1 .types .common import Metadata
1620from omegaconf import OmegaConf
1721from 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
2137def 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
3248def 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
5070def 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