|
70 | 70 | $ torchx run -s local_cwd ./my_component.py:train |
71 | 71 |
|
72 | 72 | #. In addition, it is possible to specify a different config other than .torchxconfig to |
73 | | - load at runtime. Requirements are that the config name is specified with a suffix and |
74 | | - passed as environment variable TORCHX_CONFIG_SUFFIX, and the .torchxconfig_${suffix} |
75 | | - resides in the current directory. It also disables hierarchy loading configs from |
76 | | - multiple directories as the case without specifying suffix. |
| 73 | + load at runtime. Requirements are that the config path is specified by enviornment |
| 74 | + variable TORCHX_CONFIG. It also disables hierarchy loading configs from multiple |
| 75 | + directories as the cases otherwise. |
77 | 76 |
|
78 | 77 | **Component Config** |
79 | 78 |
|
@@ -153,7 +152,7 @@ def my_component(a: int) -> specs.AppDef: |
153 | 152 |
|
154 | 153 |
|
155 | 154 | CONFIG_FILE = ".torchxconfig" |
156 | | -ENV_TORCHX_CONFIG_SUFFIX = "TORCHX_CONFIG_SUFFIX" |
| 155 | +ENV_TORCHX_CONFIG = "TORCHX_CONFIG" |
157 | 156 | CONFIG_PREFIX_DELIM = ":" |
158 | 157 |
|
159 | 158 | _NONE = "None" |
@@ -433,16 +432,16 @@ def get_config( |
433 | 432 | def find_configs(dirs: Optional[Iterable[str]] = None) -> List[str]: |
434 | 433 | """ |
435 | 434 | find_configs returns all the .torchxconfig files it finds: |
436 | | - - if environment variable TORCHX_CONFIG_SUFFIX is specified, then |
437 | | - ./torchxconfig_suffix is expected and will be loaded as the only config |
| 435 | + - if environment variable TORCHX_CONFIG is specified, then |
| 436 | + it is expected to exists and will be loaded as the only config |
438 | 437 | - otherwise, directories are checked to look for .torchxconfig and loaded. If |
439 | 438 | directories is empty it checks the local directory. |
440 | 439 | """ |
441 | 440 |
|
442 | 441 | config_files = [] |
443 | | - suffix = os.getenv(ENV_TORCHX_CONFIG_SUFFIX, "") |
444 | | - if len(suffix) > 0: |
445 | | - configfile = Path.cwd() / (CONFIG_FILE + "." + suffix) |
| 442 | + config = os.getenv(ENV_TORCHX_CONFIG, "") |
| 443 | + if len(config) > 0: |
| 444 | + configfile = Path(config) |
446 | 445 | assert configfile.exists(), f"{str(configfile)} expected but not found" |
447 | 446 | config_files.append(str(configfile)) |
448 | 447 | else: |
|
0 commit comments