omniopt2 7137__py3-none-any.whl → 7141__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. .omniopt.py +202 -172
  2. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt.py +202 -172
  3. {omniopt2-7137.dist-info → omniopt2-7141.dist-info}/METADATA +1 -1
  4. {omniopt2-7137.dist-info → omniopt2-7141.dist-info}/RECORD +35 -35
  5. omniopt2.egg-info/PKG-INFO +1 -1
  6. pyproject.toml +1 -1
  7. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.colorfunctions.sh +0 -0
  8. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.general.sh +0 -0
  9. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.helpers.py +0 -0
  10. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt_plot_cpu_ram_usage.py +0 -0
  11. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt_plot_general.py +0 -0
  12. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt_plot_gpu_usage.py +0 -0
  13. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt_plot_kde.py +0 -0
  14. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt_plot_scatter.py +0 -0
  15. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt_plot_scatter_generation_method.py +0 -0
  16. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt_plot_scatter_hex.py +0 -0
  17. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt_plot_time_and_exit_code.py +0 -0
  18. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt_plot_trial_index_result.py +0 -0
  19. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.omniopt_plot_worker.py +0 -0
  20. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.random_generator.py +0 -0
  21. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.shellscript_functions +0 -0
  22. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/.tpe.py +0 -0
  23. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/LICENSE +0 -0
  24. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/apt-dependencies.txt +0 -0
  25. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/omniopt +0 -0
  26. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/omniopt_docker +0 -0
  27. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/omniopt_evaluate +0 -0
  28. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/omniopt_plot +0 -0
  29. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/omniopt_share +0 -0
  30. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/requirements.txt +0 -0
  31. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/setup.py +0 -0
  32. {omniopt2-7137.data → omniopt2-7141.data}/data/bin/test_requirements.txt +0 -0
  33. {omniopt2-7137.dist-info → omniopt2-7141.dist-info}/WHEEL +0 -0
  34. {omniopt2-7137.dist-info → omniopt2-7141.dist-info}/licenses/LICENSE +0 -0
  35. {omniopt2-7137.dist-info → omniopt2-7141.dist-info}/top_level.txt +0 -0
.omniopt.py CHANGED
@@ -2301,13 +2301,14 @@ def check_slurm_job_id() -> None:
2301
2301
 
2302
2302
  @beartype
2303
2303
  def create_folder_and_file(folder: str) -> str:
2304
- print_debug(f"create_folder_and_file({folder})")
2304
+ with console.status(f"[bold green]Creating folder {folder}..."):
2305
+ print_debug(f"create_folder_and_file({folder})")
2305
2306
 
2306
- makedirs(folder)
2307
+ makedirs(folder)
2307
2308
 
2308
- file_path = os.path.join(folder, "results.csv")
2309
+ file_path = os.path.join(folder, "results.csv")
2309
2310
 
2310
- return file_path
2311
+ return file_path
2311
2312
 
2312
2313
  @beartype
2313
2314
  def get_program_code_from_out_file(f: str) -> str:
@@ -6600,26 +6601,27 @@ def write_continue_run_uuid_to_file() -> None:
6600
6601
 
6601
6602
  @beartype
6602
6603
  def save_state_files() -> None:
6603
- with console.status("[bold green]Saving state files..."):
6604
- write_state_file("joined_run_program", global_vars["joined_run_program"])
6605
- write_state_file("experiment_name", global_vars["experiment_name"])
6606
- write_state_file("mem_gb", str(global_vars["mem_gb"]))
6607
- write_state_file("max_eval", str(max_eval))
6608
- write_state_file("gpus", str(args.gpus))
6609
- write_state_file("time", str(global_vars["_time"]))
6610
- write_state_file("run.sh", "omniopt '" + " ".join(sys.argv[1:]) + "'")
6611
- write_state_file("run_uuid", str(run_uuid))
6612
- if args.external_generator:
6613
- write_state_file("external_generator", str(args.external_generator))
6604
+ if len(args.calculate_pareto_front_of_job) == 0:
6605
+ with console.status("[bold green]Saving state files..."):
6606
+ write_state_file("joined_run_program", global_vars["joined_run_program"])
6607
+ write_state_file("experiment_name", global_vars["experiment_name"])
6608
+ write_state_file("mem_gb", str(global_vars["mem_gb"]))
6609
+ write_state_file("max_eval", str(max_eval))
6610
+ write_state_file("gpus", str(args.gpus))
6611
+ write_state_file("time", str(global_vars["_time"]))
6612
+ write_state_file("run.sh", "omniopt '" + " ".join(sys.argv[1:]) + "'")
6613
+ write_state_file("run_uuid", str(run_uuid))
6614
+ if args.external_generator:
6615
+ write_state_file("external_generator", str(args.external_generator))
6614
6616
 
6615
- if args.follow:
6616
- write_state_file("follow", "True")
6617
+ if args.follow:
6618
+ write_state_file("follow", "True")
6617
6619
 
6618
- if args.main_process_gb:
6619
- write_state_file("main_process_gb", str(args.main_process_gb))
6620
+ if args.main_process_gb:
6621
+ write_state_file("main_process_gb", str(args.main_process_gb))
6620
6622
 
6621
- if args.force_choice_for_ranges:
6622
- write_state_file("force_choice_for_ranges", str(args.main_process_gb))
6623
+ if args.force_choice_for_ranges:
6624
+ write_state_file("force_choice_for_ranges", str(args.main_process_gb))
6623
6625
 
6624
6626
  @beartype
6625
6627
  def execute_evaluation(_params: list) -> Optional[int]:
@@ -7738,87 +7740,88 @@ def create_systematic_step(model: Any, _num_trials: int = -1, index: Optional[in
7738
7740
 
7739
7741
  @beartype
7740
7742
  def set_global_generation_strategy() -> None:
7741
- global global_gs, generation_strategy_human_readable
7743
+ with console.status("[bold green]Setting generation strategy..."):
7744
+ global global_gs, generation_strategy_human_readable
7742
7745
 
7743
- args_generation_strategy = args.generation_strategy
7746
+ args_generation_strategy = args.generation_strategy
7744
7747
 
7745
- continue_not_supported_on_custom_generation_strategy()
7748
+ continue_not_supported_on_custom_generation_strategy()
7746
7749
 
7747
- gs_names: list = []
7748
- gs_nodes: list = []
7750
+ gs_names: list = []
7751
+ gs_nodes: list = []
7749
7752
 
7750
- if args_generation_strategy is None:
7751
- num_imported_jobs: int = get_nr_of_imported_jobs()
7752
- set_max_eval(max_eval + num_imported_jobs)
7753
- set_random_steps(random_steps or 0)
7753
+ if args_generation_strategy is None:
7754
+ num_imported_jobs: int = get_nr_of_imported_jobs()
7755
+ set_max_eval(max_eval + num_imported_jobs)
7756
+ set_random_steps(random_steps or 0)
7754
7757
 
7755
- if max_eval is None:
7756
- set_max_eval(max(1, random_steps))
7758
+ if max_eval is None:
7759
+ set_max_eval(max(1, random_steps))
7757
7760
 
7758
- chosen_model = get_chosen_model()
7761
+ chosen_model = get_chosen_model()
7759
7762
 
7760
- if chosen_model == "SOBOL":
7761
- set_random_steps(max_eval)
7763
+ if chosen_model == "SOBOL":
7764
+ set_random_steps(max_eval)
7762
7765
 
7763
- if random_steps >= 1:
7764
- next_node_name = None
7765
- if max_eval - random_steps and chosen_model:
7766
- next_node_name = chosen_model
7766
+ if random_steps >= 1:
7767
+ next_node_name = None
7768
+ if max_eval - random_steps and chosen_model:
7769
+ next_node_name = chosen_model
7767
7770
 
7768
- gs_names.append(get_step_name("SOBOL", random_steps))
7769
- gs_nodes.append(create_node("SOBOL", random_steps, next_node_name))
7771
+ gs_names.append(get_step_name("SOBOL", random_steps))
7772
+ gs_nodes.append(create_node("SOBOL", random_steps, next_node_name))
7770
7773
 
7771
- write_state_file("model", str(chosen_model))
7774
+ write_state_file("model", str(chosen_model))
7772
7775
 
7773
- if chosen_model != "SOBOL" and max_eval > random_steps:
7774
- this_node = create_node(chosen_model, max_eval - random_steps, None)
7776
+ if chosen_model != "SOBOL" and max_eval > random_steps:
7777
+ this_node = create_node(chosen_model, max_eval - random_steps, None)
7775
7778
 
7776
- gs_names.append(get_step_name(chosen_model, max_eval - random_steps))
7777
- gs_nodes.append(this_node)
7779
+ gs_names.append(get_step_name(chosen_model, max_eval - random_steps))
7780
+ gs_nodes.append(this_node)
7778
7781
 
7779
- generation_strategy_human_readable = join_with_comma_and_then(gs_names)
7782
+ generation_strategy_human_readable = join_with_comma_and_then(gs_names)
7780
7783
 
7781
- try:
7782
- global_gs = GenerationStrategy(
7783
- name="+".join(gs_names),
7784
- nodes=gs_nodes
7785
- )
7786
- except ax.exceptions.generation_strategy.GenerationStrategyMisconfiguredException as e:
7787
- print_red(f"Error: {e}\ngs_names: {gs_names}\ngs_nodes: {gs_nodes}")
7784
+ try:
7785
+ global_gs = GenerationStrategy(
7786
+ name="+".join(gs_names),
7787
+ nodes=gs_nodes
7788
+ )
7789
+ except ax.exceptions.generation_strategy.GenerationStrategyMisconfiguredException as e:
7790
+ print_red(f"Error: {e}\ngs_names: {gs_names}\ngs_nodes: {gs_nodes}")
7788
7791
 
7789
- my_exit(55)
7790
- else:
7791
- generation_strategy_array, new_max_eval = parse_generation_strategy_string(args_generation_strategy)
7792
+ my_exit(55)
7793
+ else:
7794
+ generation_strategy_array, new_max_eval = parse_generation_strategy_string(args_generation_strategy)
7792
7795
 
7793
- new_max_eval_plus_inserted_jobs = new_max_eval + get_nr_of_imported_jobs()
7796
+ new_max_eval_plus_inserted_jobs = new_max_eval + get_nr_of_imported_jobs()
7794
7797
 
7795
- if max_eval < new_max_eval_plus_inserted_jobs:
7796
- print_yellow(f"--generation_strategy {args_generation_strategy.upper()} has, in sum, more tasks than --max_eval {max_eval}. max_eval will be set to {new_max_eval_plus_inserted_jobs}.")
7797
- set_max_eval(new_max_eval_plus_inserted_jobs)
7798
+ if max_eval < new_max_eval_plus_inserted_jobs:
7799
+ print_yellow(f"--generation_strategy {args_generation_strategy.upper()} has, in sum, more tasks than --max_eval {max_eval}. max_eval will be set to {new_max_eval_plus_inserted_jobs}.")
7800
+ set_max_eval(new_max_eval_plus_inserted_jobs)
7798
7801
 
7799
- print_generation_strategy(generation_strategy_array)
7802
+ print_generation_strategy(generation_strategy_array)
7800
7803
 
7801
- start_index = int(len(generation_strategy_array) / 2)
7804
+ start_index = int(len(generation_strategy_array) / 2)
7802
7805
 
7803
- steps: list = []
7806
+ steps: list = []
7804
7807
 
7805
- for gs_element in generation_strategy_array:
7806
- model_name = list(gs_element.keys())[0]
7808
+ for gs_element in generation_strategy_array:
7809
+ model_name = list(gs_element.keys())[0]
7807
7810
 
7808
- nr = int(gs_element[model_name])
7811
+ nr = int(gs_element[model_name])
7809
7812
 
7810
- gs_elem = create_systematic_step(select_model(model_name), nr, start_index)
7811
- steps.append(gs_elem)
7813
+ gs_elem = create_systematic_step(select_model(model_name), nr, start_index)
7814
+ steps.append(gs_elem)
7812
7815
 
7813
- gs_names.append(get_step_name(model_name, nr))
7816
+ gs_names.append(get_step_name(model_name, nr))
7814
7817
 
7815
- start_index = start_index + 1
7818
+ start_index = start_index + 1
7816
7819
 
7817
- write_state_file("custom_generation_strategy", args_generation_strategy)
7820
+ write_state_file("custom_generation_strategy", args_generation_strategy)
7818
7821
 
7819
- global_gs = GenerationStrategy(steps=steps)
7822
+ global_gs = GenerationStrategy(steps=steps)
7820
7823
 
7821
- generation_strategy_human_readable = join_with_comma_and_then(gs_names)
7824
+ generation_strategy_human_readable = join_with_comma_and_then(gs_names)
7822
7825
 
7823
7826
  @beartype
7824
7827
  def wait_for_jobs_or_break(_max_eval: Optional[int], _progress_bar: Any) -> bool:
@@ -8000,35 +8003,36 @@ def _create_and_execute_next_runs_return_value(trial_index_to_param: Optional[Di
8000
8003
 
8001
8004
  @beartype
8002
8005
  def get_number_of_steps(_max_eval: int) -> Tuple[int, int]:
8003
- _random_steps = args.num_random_steps
8006
+ with console.status("[bold green]Calculating number of steps..."):
8007
+ _random_steps = args.num_random_steps
8004
8008
 
8005
- already_done_random_steps = get_random_steps_from_prev_job()
8009
+ already_done_random_steps = get_random_steps_from_prev_job()
8006
8010
 
8007
- _random_steps = _random_steps - already_done_random_steps
8011
+ _random_steps = _random_steps - already_done_random_steps
8008
8012
 
8009
- if _random_steps > _max_eval:
8010
- print_yellow(f"You have less --max_eval {_max_eval} than --num_random_steps {_random_steps}. Switched both.")
8011
- _random_steps, _max_eval = _max_eval, _random_steps
8013
+ if _random_steps > _max_eval:
8014
+ print_yellow(f"You have less --max_eval {_max_eval} than --num_random_steps {_random_steps}. Switched both.")
8015
+ _random_steps, _max_eval = _max_eval, _random_steps
8012
8016
 
8013
- if _random_steps < num_parallel_jobs and SYSTEM_HAS_SBATCH:
8014
- print_yellow(f"Warning: --num_random_steps {_random_steps} is smaller than --num_parallel_jobs {num_parallel_jobs}. It's recommended that --num_parallel_jobs is the same as or a multiple of --num_random_steps")
8017
+ if _random_steps < num_parallel_jobs and SYSTEM_HAS_SBATCH:
8018
+ print_yellow(f"Warning: --num_random_steps {_random_steps} is smaller than --num_parallel_jobs {num_parallel_jobs}. It's recommended that --num_parallel_jobs is the same as or a multiple of --num_random_steps")
8015
8019
 
8016
- if _random_steps > _max_eval:
8017
- set_max_eval(_random_steps)
8020
+ if _random_steps > _max_eval:
8021
+ set_max_eval(_random_steps)
8018
8022
 
8019
- original_second_steps = _max_eval - _random_steps
8020
- second_step_steps = max(0, original_second_steps)
8021
- if second_step_steps != original_second_steps:
8022
- original_print(f"? original_second_steps: {original_second_steps} = max_eval {_max_eval} - _random_steps {_random_steps}")
8023
- if second_step_steps == 0:
8024
- print_yellow("This is basically a random search. Increase --max_eval or reduce --num_random_steps")
8023
+ original_second_steps = _max_eval - _random_steps
8024
+ second_step_steps = max(0, original_second_steps)
8025
+ if second_step_steps != original_second_steps:
8026
+ original_print(f"? original_second_steps: {original_second_steps} = max_eval {_max_eval} - _random_steps {_random_steps}")
8027
+ if second_step_steps == 0:
8028
+ print_yellow("This is basically a random search. Increase --max_eval or reduce --num_random_steps")
8025
8029
 
8026
- second_step_steps = second_step_steps - already_done_random_steps
8030
+ second_step_steps = second_step_steps - already_done_random_steps
8027
8031
 
8028
- if args.continue_previous_job:
8029
- second_step_steps = _max_eval
8032
+ if args.continue_previous_job:
8033
+ second_step_steps = _max_eval
8030
8034
 
8031
- return _random_steps, second_step_steps
8035
+ return _random_steps, second_step_steps
8032
8036
 
8033
8037
  @beartype
8034
8038
  def _set_global_executor() -> None:
@@ -8334,16 +8338,18 @@ def check_if_has_random_steps() -> None:
8334
8338
 
8335
8339
  @beartype
8336
8340
  def add_exclude_to_defective_nodes() -> None:
8337
- if args.exclude:
8338
- entries = [entry.strip() for entry in args.exclude.split(',')]
8341
+ with console.status("[bold green]Adding excluded nodes..."):
8342
+ if args.exclude:
8343
+ entries = [entry.strip() for entry in args.exclude.split(',')]
8339
8344
 
8340
- for entry in entries:
8341
- count_defective_nodes(None, entry)
8345
+ for entry in entries:
8346
+ count_defective_nodes(None, entry)
8342
8347
 
8343
8348
  @beartype
8344
8349
  def check_max_eval(_max_eval: int) -> None:
8345
- if not _max_eval:
8346
- _fatal_error("--max_eval needs to be set!", 19)
8350
+ with console.status("[bold green]Checking max_eval..."):
8351
+ if not _max_eval:
8352
+ _fatal_error("--max_eval needs to be set!", 19)
8347
8353
 
8348
8354
  @beartype
8349
8355
  def parse_parameters() -> Any:
@@ -9009,58 +9015,72 @@ def write_files_and_show_overviews() -> None:
9009
9015
 
9010
9016
  @beartype
9011
9017
  def write_git_version() -> None:
9012
- folder = f"{get_current_run_folder()}/"
9013
- os.makedirs(folder, exist_ok=True)
9014
- file_path = os.path.join(folder, "git_version")
9018
+ with console.status("[bold green]Writing git info file..."):
9019
+ folder = f"{get_current_run_folder()}/"
9020
+ os.makedirs(folder, exist_ok=True)
9021
+ file_path = os.path.join(folder, "git_version")
9015
9022
 
9016
- try:
9017
- commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True, stderr=subprocess.DEVNULL).strip()
9023
+ try:
9024
+ commit_hash = subprocess.check_output(["git", "rev-parse", "HEAD"], text=True, stderr=subprocess.DEVNULL).strip()
9018
9025
 
9019
- git_tag = ""
9026
+ git_tag = ""
9027
+
9028
+ try:
9029
+ git_tag = subprocess.check_output(["git", "describe", "--tags"], text=True, stderr=subprocess.DEVNULL).strip()
9030
+ git_tag = f" ({git_tag})"
9031
+ except subprocess.CalledProcessError:
9032
+ pass
9033
+
9034
+ if commit_hash:
9035
+ with open(file_path, mode="w", encoding="utf-8") as f:
9036
+ f.write(f"Commit: {commit_hash}{git_tag}\n")
9020
9037
 
9021
- try:
9022
- git_tag = subprocess.check_output(["git", "describe", "--tags"], text=True, stderr=subprocess.DEVNULL).strip()
9023
- git_tag = f" ({git_tag})"
9024
9038
  except subprocess.CalledProcessError:
9025
9039
  pass
9026
9040
 
9027
- if commit_hash:
9028
- with open(file_path, mode="w", encoding="utf-8") as f:
9029
- f.write(f"Commit: {commit_hash}{git_tag}\n")
9030
-
9031
- except subprocess.CalledProcessError:
9032
- pass
9041
+ @beartype
9042
+ def write_job_start_file() -> None:
9043
+ with console.status("[bold green]Writing job_start_time file..."):
9044
+ fn = f'{get_current_run_folder()}/job_start_time.txt'
9045
+ try:
9046
+ with open(fn, mode='w', encoding="utf-8") as f:
9047
+ f.write(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
9048
+ except Exception as e:
9049
+ print_red(f"Error trying to write {fn}: {e}")
9033
9050
 
9034
9051
  @beartype
9035
9052
  def write_live_share_file_if_needed() -> None:
9036
- if args.live_share:
9037
- write_state_file("live_share", "1\n")
9053
+ with console.status("[bold green]Writing live_share file if it is present..."):
9054
+ if args.live_share:
9055
+ write_state_file("live_share", "1\n")
9038
9056
 
9039
9057
  @beartype
9040
9058
  def write_username_statefile() -> None:
9041
- _path = get_current_run_folder()
9042
- if args.username:
9043
- file_path = f"{_path}/state_files/username"
9059
+ with console.status("[bold green]Writing username state file..."):
9060
+ _path = get_current_run_folder()
9061
+ if args.username:
9062
+ file_path = f"{_path}/state_files/username"
9063
+
9064
+ try:
9065
+ os.makedirs(os.path.dirname(file_path), exist_ok=True)
9066
+ with open(file_path, mode="w", encoding="utf-8") as f:
9067
+ f.write(args.username)
9068
+ except Exception as e:
9069
+ print_red(f"Error writing to file: {e}")
9070
+
9071
+ @beartype
9072
+ def write_revert_to_random_when_seemingly_exhausted_file() -> None:
9073
+ with console.status("[bold green]Writing revert_to_random_when_seemingly_exhausted file ..."):
9074
+ _path = get_current_run_folder()
9075
+ file_path = f"{_path}/state_files/revert_to_random_when_seemingly_exhausted"
9044
9076
 
9045
9077
  try:
9046
9078
  os.makedirs(os.path.dirname(file_path), exist_ok=True)
9047
9079
  with open(file_path, mode="w", encoding="utf-8") as f:
9048
- f.write(args.username)
9080
+ f.write("1\n")
9049
9081
  except Exception as e:
9050
9082
  print_red(f"Error writing to file: {e}")
9051
9083
 
9052
- @beartype
9053
- def write_revert_to_random_when_seemingly_exhausted_file() -> None:
9054
- _path = get_current_run_folder()
9055
- file_path = f"{_path}/state_files/revert_to_random_when_seemingly_exhausted"
9056
-
9057
- try:
9058
- os.makedirs(os.path.dirname(file_path), exist_ok=True)
9059
- with open(file_path, mode="w", encoding="utf-8") as f:
9060
- f.write("1\n")
9061
- except Exception as e:
9062
- print_red(f"Error writing to file: {e}")
9063
-
9064
9084
  @beartype
9065
9085
  def debug_vars_unused_by_python_for_linter() -> None:
9066
9086
  print_debug(
@@ -9327,6 +9347,28 @@ def set_arg_states_from_continue() -> None:
9327
9347
  if os.path.exists(f"{args.continue_previous_job}/state_files/revert_to_random_when_seemingly_exhausted"):
9328
9348
  args.revert_to_random_when_seemingly_exhausted = True
9329
9349
 
9350
+ @beartype
9351
+ def write_result_min_max_file() -> None:
9352
+ with console.status("[bold green]Writing result min/max file..."):
9353
+ try:
9354
+ fn = f"{get_current_run_folder()}/result_min_max.txt"
9355
+ with open(fn, mode="a", encoding="utf-8") as myfile:
9356
+ for rarg in arg_result_min_or_max:
9357
+ original_print(rarg, file=myfile)
9358
+ except Exception as e:
9359
+ print_red(f"Error trying to open file '{fn}': {e}")
9360
+
9361
+ @beartype
9362
+ def write_result_names_file() -> None:
9363
+ with console.status("[bold green]Writing result names file..."):
9364
+ try:
9365
+ fn = f"{get_current_run_folder()}/result_names.txt"
9366
+ with open(fn, mode="a", encoding="utf-8") as myfile:
9367
+ for rarg in arg_result_names:
9368
+ original_print(rarg, file=myfile)
9369
+ except Exception as e:
9370
+ print_red(f"Error trying to open file '{fn}': {e}")
9371
+
9330
9372
  @beartype
9331
9373
  def main() -> None:
9332
9374
  global RESULT_CSV_FILE, ax_client, LOGFILE_DEBUG_GET_NEXT_TRIALS
@@ -9354,21 +9396,9 @@ def main() -> None:
9354
9396
 
9355
9397
  write_username_statefile()
9356
9398
 
9357
- try:
9358
- fn = f"{get_current_run_folder()}/result_names.txt"
9359
- with open(fn, mode="a", encoding="utf-8") as myfile:
9360
- for rarg in arg_result_names:
9361
- original_print(rarg, file=myfile)
9362
- except Exception as e:
9363
- print_red(f"Error trying to open file '{fn}': {e}")
9399
+ write_result_names_file()
9364
9400
 
9365
- try:
9366
- fn = f"{get_current_run_folder()}/result_min_max.txt"
9367
- with open(fn, mode="a", encoding="utf-8") as myfile:
9368
- for rarg in arg_result_min_or_max:
9369
- original_print(rarg, file=myfile)
9370
- except Exception as e:
9371
- print_red(f"Error trying to open file '{fn}': {e}")
9401
+ write_result_min_max_file()
9372
9402
 
9373
9403
  if os.getenv("CI"):
9374
9404
  data_dict: dict = {
@@ -9381,8 +9411,7 @@ def main() -> None:
9381
9411
 
9382
9412
  write_failed_logs(data_dict, error_description)
9383
9413
 
9384
- if len(args.calculate_pareto_front_of_job) == 0:
9385
- save_state_files()
9414
+ save_state_files()
9386
9415
 
9387
9416
  print_run_info()
9388
9417
 
@@ -9394,12 +9423,7 @@ def main() -> None:
9394
9423
 
9395
9424
  write_live_share_file_if_needed()
9396
9425
 
9397
- fn = f'{get_current_run_folder()}/job_start_time.txt'
9398
- try:
9399
- with open(fn, mode='w', encoding="utf-8") as f:
9400
- f.write(datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S"))
9401
- except Exception as e:
9402
- print_red(f"Error trying to write {fn}: {e}")
9426
+ write_job_start_file()
9403
9427
 
9404
9428
  write_git_version()
9405
9429
 
@@ -9410,6 +9434,7 @@ def main() -> None:
9410
9434
  set_random_steps(_random_steps)
9411
9435
 
9412
9436
  add_exclude_to_defective_nodes()
9437
+
9413
9438
  handle_random_steps()
9414
9439
 
9415
9440
  set_global_generation_strategy()
@@ -9463,30 +9488,34 @@ def log_worker_creation() -> None:
9463
9488
 
9464
9489
  @beartype
9465
9490
  def set_run_folder() -> None:
9466
- global CURRENT_RUN_FOLDER
9467
- RUN_FOLDER_NUMBER: int = 0
9468
- CURRENT_RUN_FOLDER = f"{args.run_dir}/{global_vars['experiment_name']}/{RUN_FOLDER_NUMBER}"
9469
-
9470
- while os.path.exists(f"{CURRENT_RUN_FOLDER}"):
9471
- RUN_FOLDER_NUMBER += 1
9491
+ with console.status("[bold green]Setting run folder..."):
9492
+ global CURRENT_RUN_FOLDER
9493
+ RUN_FOLDER_NUMBER: int = 0
9472
9494
  CURRENT_RUN_FOLDER = f"{args.run_dir}/{global_vars['experiment_name']}/{RUN_FOLDER_NUMBER}"
9473
9495
 
9496
+ while os.path.exists(f"{CURRENT_RUN_FOLDER}"):
9497
+ RUN_FOLDER_NUMBER += 1
9498
+ CURRENT_RUN_FOLDER = f"{args.run_dir}/{global_vars['experiment_name']}/{RUN_FOLDER_NUMBER}"
9499
+
9474
9500
  @beartype
9475
9501
  def print_run_info() -> None:
9476
- original_print(f"Run-folder: {get_current_run_folder()}")
9477
- if args.continue_previous_job:
9478
- original_print(f"Continuation from {args.continue_previous_job}")
9502
+ with console.status("[bold green]Printing run info..."):
9503
+ original_print(f"Run-folder: {get_current_run_folder()}")
9504
+ if args.continue_previous_job:
9505
+ original_print(f"Continuation from {args.continue_previous_job}")
9479
9506
 
9480
9507
  @beartype
9481
9508
  def initialize_nvidia_logs() -> None:
9482
- global NVIDIA_SMI_LOGS_BASE
9483
- NVIDIA_SMI_LOGS_BASE = f'{get_current_run_folder()}/gpu_usage_'
9509
+ with console.status("[bold green]Initializing NVIDIA-Logs..."):
9510
+ global NVIDIA_SMI_LOGS_BASE
9511
+ NVIDIA_SMI_LOGS_BASE = f'{get_current_run_folder()}/gpu_usage_'
9484
9512
 
9485
9513
  @beartype
9486
9514
  def write_ui_url_if_present() -> None:
9487
- if args.ui_url:
9488
- with open(f"{get_current_run_folder()}/ui_url.txt", mode="a", encoding="utf-8") as myfile:
9489
- myfile.write(decode_if_base64(args.ui_url))
9515
+ with console.status("[bold green]Writing ui_url file if it is present..."):
9516
+ if args.ui_url:
9517
+ with open(f"{get_current_run_folder()}/ui_url.txt", mode="a", encoding="utf-8") as myfile:
9518
+ myfile.write(decode_if_base64(args.ui_url))
9490
9519
 
9491
9520
  @beartype
9492
9521
  def set_random_steps(new_steps: int) -> None:
@@ -9498,9 +9527,10 @@ def set_random_steps(new_steps: int) -> None:
9498
9527
 
9499
9528
  @beartype
9500
9529
  def handle_random_steps() -> None:
9501
- if args.parameter and args.continue_previous_job and random_steps <= 0:
9502
- print(f"A parameter has been reset, but the earlier job already had its random phase. To look at the new search space, {args.num_random_steps} random steps will be executed.")
9503
- set_random_steps(args.num_random_steps)
9530
+ with console.status("[bold green]Handling random steps..."):
9531
+ if args.parameter and args.continue_previous_job and random_steps <= 0:
9532
+ print(f"A parameter has been reset, but the earlier job already had its random phase. To look at the new search space, {args.num_random_steps} random steps will be executed.")
9533
+ set_random_steps(args.num_random_steps)
9504
9534
 
9505
9535
  @beartype
9506
9536
  def initialize_ax_client() -> None: