File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212"""
1313
1414import logging
15+ import os
1516import pdb
1617import sys
1718import time
@@ -190,15 +191,20 @@ def train_with_args(argl: list[str], stream_dir: str | None):
190191
191192
192193if __name__ == "__main__" :
194+ try :
195+ stage = os .environ .get ("WEATHERGEN_STAGE" )
196+ except KeyError as e :
197+ msg = f"missing environment variable 'WEATHERGEN_STAGE'"
198+ raise ValueError (msg ) from e
193199
194- if any ( "train" in arg for arg in sys . argv ) :
200+ if stage == "train" :
195201 # Entry point for slurm script.
196202 # Check whether --from_run_id passed as argument.
197203 if any ("--from_run_id" in arg for arg in sys .argv ):
198204 train_continue ()
199205 else :
200206 train ()
201- elif any ( "inference" in arg for arg in sys . argv ) :
207+ elif stage == "inference" :
202208 inference ()
203209 else :
204210 logger .error ("No stage was found." )
You can’t perform that action at this time.
0 commit comments