3131 BaseInstaller ,
3232 CloudAIGymEnv ,
3333 Installable ,
34+ InstallStatusResult ,
3435 MissingTestError ,
3536 Parser ,
3637 Registry ,
@@ -237,21 +238,16 @@ def _handle_single_sbatch(args: argparse.Namespace, system: System) -> bool:
237238
238239def _check_installation (
239240 args : argparse .Namespace , system : System , tests : list [Test ], test_scenario : TestScenario
240- ) -> bool :
241- logging .info ("Checking if test templates are installed." )
241+ ) -> InstallStatusResult :
242+ logging .info ("Checking if workloads components are installed." )
242243 installables , installer = prepare_installation (system , tests , test_scenario )
243244
244245 if args .enable_cache_without_check :
245246 result = installer .mark_as_installed (installables )
246247 else :
247248 result = installer .is_installed (installables )
248249
249- if args .mode == "run" and not result .success :
250- logging .error ("CloudAI has not been installed. Please run install mode first." )
251- logging .error (result .message )
252- return False
253-
254- return True
250+ return result
255251
256252
257253def handle_dry_run_and_run (args : argparse .Namespace ) -> int :
@@ -271,8 +267,18 @@ def handle_dry_run_and_run(args: argparse.Namespace) -> int:
271267 logging .info (f"Scheduler: { system .scheduler } " )
272268 logging .info (f"Test Scenario Name: { test_scenario .name } " )
273269
274- if not _check_installation (args , system , tests , test_scenario ):
275- return 1
270+ result = _check_installation (args , system , tests , test_scenario )
271+ if args .mode == "run" and not result .success :
272+ logging .info ("Not all workloads components are installed. Installing..." )
273+ installables , installer = prepare_installation (system , tests , test_scenario )
274+
275+ result = installer .install (installables )
276+ if result .success :
277+ logging .info (f"CloudAI is successfully installed into '{ system .install_path .absolute ()} '." )
278+ else :
279+ logging .error ("Failed to install workloads components." )
280+ logging .error (result .message )
281+ return 1
276282
277283 logging .info (test_scenario .pretty_print ())
278284
0 commit comments