omniopt2 7773__py3-none-any.whl → 8167__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.

Potentially problematic release.


This version of omniopt2 might be problematic. Click here for more details.

Files changed (46) hide show
  1. .omniopt.py +1633 -1354
  2. .shellscript_functions +5 -5
  3. .tests/pylint.rc +687 -0
  4. README.md +0 -2
  5. omniopt +127 -38
  6. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt.py +1633 -1354
  7. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.shellscript_functions +5 -5
  8. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/omniopt +127 -38
  9. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/omniopt_plot +0 -4
  10. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/omniopt_share +0 -11
  11. omniopt2-8167.data/data/bin/pylint.rc +687 -0
  12. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/requirements.txt +1 -2
  13. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/setup.py +2 -1
  14. {omniopt2-7773.dist-info → omniopt2-8167.dist-info}/METADATA +2 -5
  15. omniopt2-8167.dist-info/RECORD +71 -0
  16. omniopt2.egg-info/PKG-INFO +2 -5
  17. omniopt2.egg-info/SOURCES.txt +1 -0
  18. omniopt2.egg-info/requires.txt +1 -2
  19. omniopt_plot +0 -4
  20. omniopt_share +0 -11
  21. pyproject.toml +1 -1
  22. requirements.txt +1 -2
  23. omniopt2-7773.dist-info/RECORD +0 -69
  24. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.colorfunctions.sh +0 -0
  25. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.general.sh +0 -0
  26. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.helpers.py +0 -0
  27. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt_plot_cpu_ram_usage.py +0 -0
  28. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt_plot_general.py +0 -0
  29. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt_plot_gpu_usage.py +0 -0
  30. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt_plot_kde.py +0 -0
  31. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt_plot_scatter.py +0 -0
  32. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt_plot_scatter_generation_method.py +0 -0
  33. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt_plot_scatter_hex.py +0 -0
  34. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt_plot_time_and_exit_code.py +0 -0
  35. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt_plot_trial_index_result.py +0 -0
  36. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.omniopt_plot_worker.py +0 -0
  37. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.random_generator.py +0 -0
  38. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/.tpe.py +0 -0
  39. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/LICENSE +0 -0
  40. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/apt-dependencies.txt +0 -0
  41. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/omniopt_docker +0 -0
  42. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/omniopt_evaluate +0 -0
  43. {omniopt2-7773.data → omniopt2-8167.data}/data/bin/test_requirements.txt +0 -0
  44. {omniopt2-7773.dist-info → omniopt2-8167.dist-info}/WHEEL +0 -0
  45. {omniopt2-7773.dist-info → omniopt2-8167.dist-info}/licenses/LICENSE +0 -0
  46. {omniopt2-7773.dist-info → omniopt2-8167.dist-info}/top_level.txt +0 -0
omniopt CHANGED
@@ -181,46 +181,13 @@
181
181
  trap - DEBUG
182
182
  }
183
183
 
184
- MAIN_PID=$$
185
-
186
- log_cpu_usage() {
187
- if [[ -n "$RUN_UUID" ]]; then
188
- if command -v ps 2>/dev/null >/dev/null; then
189
- mkdir -p logs
190
-
191
- LOG_FILE="logs/${RUN_UUID}_cpu_log"
192
-
193
- [[ ! -f "$LOG_FILE" ]] && echo "timestamp,process,command,cpu_usage" > "$LOG_FILE"
194
-
195
- _continue=1
196
-
197
- while [[ $_continue -eq 1 ]]; do
198
- if ! kill -0 "$MAIN_PID" 2>/dev/null; then
199
- _continue=0
200
- fi
201
-
202
- TIMESTAMP=$(date '+%Y-%m-%d %H:%M:%S')
203
-
204
- if [[ -e "$LOG_FILE" ]]; then
205
- ps -eo ppid,pid,pcpu,comm,args | awk -v ts="$TIMESTAMP" -v ppid=$$ 'NR>1 && $1 == ppid {print ts "," $4 "," substr($0, index($0,$5)) "," $3}' >> "$LOG_FILE"
206
- else
207
- _continue=0
208
- fi
209
-
210
- sleep 1
211
- done &
212
- fi
213
- fi
214
- }
215
-
216
- #log_cpu_usage &
217
-
218
184
  checkout_to_latest_tested_version=0
219
185
  debug=0
220
186
  main_process_gb=
221
187
  run_tests_that_fail_on_taurus=0
222
188
  force_local_execution=0
223
189
  dryrun=0
190
+ worker_generator_path=""
224
191
  has_sbatch=0
225
192
 
226
193
  function parse_toml {
@@ -721,6 +688,7 @@
721
688
  continue_previous_job=""
722
689
  calculate_pareto_front_of_job=""
723
690
  mem_gb=
691
+ dependency=
724
692
  gpus=
725
693
  time=
726
694
  if [[ -z $root_venv_dir ]]; then
@@ -862,6 +830,7 @@ EOF
862
830
  "experiment_name"
863
831
  "reservation"
864
832
  "time"
833
+ "dependency"
865
834
  )
866
835
 
867
836
  complex_options_str=""
@@ -957,6 +926,36 @@ $complex_options_str
957
926
 
958
927
  ;;
959
928
 
929
+ --worker_generator_path=*)
930
+ old_worker_generator_path=\$worker_generator_path
931
+ worker_generator_path="\${i#*=}"
932
+
933
+ if [[ -n \$old_worker_generator_path ]]; then
934
+ red_text "--worker_generator_path was specified more than once. Using the last one.\\n"
935
+ args_string=\$(echo "\$args_string" | sed -e 's#[[:space:]]*--worker_generator_path=.*[[:space:]][[:space:]]*# #')
936
+ fi
937
+
938
+ args_string+=" --worker_generator_path \$worker_generator_path "
939
+
940
+ ;;
941
+
942
+ --worker_generator_path)
943
+ old_worker_generator_path=\$worker_generator_path
944
+
945
+ shift
946
+ k=\$((k+1))
947
+
948
+ worker_generator_path="\${args[k]}"
949
+
950
+ if [[ -n \$old_worker_generator_path ]]; then
951
+ red_text "--worker_generator_path was specified more than once. Using the last one.\\n"
952
+ args_string=\$(echo "\$args_string" | sed -e 's#[[:space:]]*--worker_generator_path.*[[:space:]][[:space:]]*# #')
953
+ fi
954
+
955
+ args_string+=" --worker_generator_path \$worker_generator_path "
956
+
957
+ ;;
958
+
960
959
  --calculate_pareto_front_of_job=*)
961
960
  old_continue=\$calculate_pareto_front_of_job
962
961
  calculate_pareto_front_of_job="\${i#*=}"
@@ -1057,6 +1056,19 @@ EOF
1057
1056
 
1058
1057
  eval "$PARAM_EVAL"
1059
1058
 
1059
+ if [[ $worker_generator_path != "" ]]; then
1060
+ old_uuid_dir="$worker_generator_path/state_files/run_uuid"
1061
+ if [[ -e $old_uuid_dir ]]; then
1062
+ RUN_UUID=$(cat $old_uuid_dir)
1063
+ if [[ -z $SLURM_JOB_ID ]]; then
1064
+ yellow_text "--worker_generator_path defined: $worker_generator_path. Using UUID from that run."
1065
+ yellow_text "Set RUN_UUID to $RUN_UUID"
1066
+ fi
1067
+ else
1068
+ red_text "Old UUID cannot be found"
1069
+ fi
1070
+ fi
1071
+
1060
1072
  if [[ $dryrun -eq 1 ]]; then
1061
1073
  force_local_execution=1
1062
1074
  live_share=0
@@ -1181,8 +1193,7 @@ EOF
1181
1193
  myexit $exit_code
1182
1194
  else
1183
1195
  if [[ -z $OO_MAIN_TESTS ]]; then
1184
- yellow_text "The current version was not thoroughly tested. It may contain bugs. Checkout to $tag_commit_hash to get the latest tested version."
1185
- yellow_text "Use --checkout_to_latest_tested_version to automatically use the latest tested version."
1196
+ yellow_text "The current version was not thoroughly tested. It may contain bugs. Checkout to $tag_commit_hash or use --checkout_to_latest_tested_version to get the latest tested version."
1186
1197
  fi
1187
1198
  fi
1188
1199
  fi
@@ -1348,6 +1359,14 @@ EOF
1348
1359
  trap - ERR
1349
1360
  set +e
1350
1361
 
1362
+ if [[ -z $dependency ]]; then
1363
+ _dependency=$(get_config_from_config_file "dependency" 0 2>/dev/null)
1364
+ retcode=$?
1365
+ if [[ $retcode -ne 0 ]] && [[ -n $_dependency ]]; then
1366
+ dependency=$_dependency
1367
+ fi
1368
+ fi
1369
+
1351
1370
  if [[ -z $reservation ]]; then
1352
1371
  _reservation=$(get_config_from_config_file "reservation" 0 2>/dev/null)
1353
1372
  retcode=$?
@@ -1656,12 +1675,43 @@ EOF
1656
1675
  fi
1657
1676
  fi
1658
1677
 
1678
+ if [[ $dependency == "omniopt_singleton" ]]; then
1679
+ k=0
1680
+ deps=""
1681
+ while read -r job_id; do
1682
+ if scontrol show job "$job_id" 2>/dev/null | grep -qi omniopt; then
1683
+ [[ -n $deps ]] && deps+=","
1684
+ deps+="after:$job_id"
1685
+ k=$((k+1))
1686
+ fi
1687
+ done < <(squeue -h -u "$USER" -o "%A")
1688
+
1689
+ if (( k > 0 )); then
1690
+ dependency="$deps"
1691
+ echo "Automatic dependencies: $dependency"
1692
+ else
1693
+ dependency=""
1694
+ fi
1695
+ fi
1696
+
1697
+ if [[ -n $dependency ]]; then
1698
+ if [[ $dependency =~ ^(afterok:[0-9]+|afternotok:[0-9]+|after:[0-9]+|afterany:[0-9]+|singleton)(,(afterok:[0-9]+|afternotok:[0-9]+|after:[0-9]+|afterany:[0-9]+|singleton))*$ ]]; then
1699
+ if [[ $debug -eq 1 ]]; then
1700
+ yellow_text "Valid dependency found: $dependency. Adding it it to sbatch command."
1701
+ fi
1702
+ sbatch_command="$sbatch_command --dependency $dependency"
1703
+ else
1704
+ echo "Invalid dependency format: $dependency"
1705
+ fi
1706
+ fi
1707
+
1659
1708
  sbatch_command+=" $SCRIPT_DIR/omniopt $args_string"
1660
1709
 
1661
1710
  if [[ "$debug" -eq "1" ]] || [[ -n $PRINT_SBATCH_COMMAND ]]; then
1662
1711
  yellow_text "$sbatch_command"
1663
1712
  fi
1664
1713
 
1714
+
1665
1715
  set +e
1666
1716
 
1667
1717
  sbatch_result=$($sbatch_command)
@@ -1835,7 +1885,46 @@ EOF
1835
1885
  exec 2> >(tee -ia $bash_logname >& 2)
1836
1886
  fi
1837
1887
 
1838
- exit_code=$(cat "$LOG_PATH" | grep -i "exit-code:*" | sed -e 's#Exit-Code:*[[:space:]]*##i' -e 's#,.*##' | tail -n1)
1888
+
1889
+ exit_code_lines=$(grep -i "exit-code:*" "$LOG_PATH" 2>/dev/null)
1890
+ if [ $? -ne 0 ] || [ -z "$exit_code_lines" ]; then
1891
+ echo "WARN: grep failed or no exit-code line found."
1892
+ exit_code_lines=""
1893
+ fi
1894
+
1895
+ exit_code_sed=$(echo "$exit_code_lines" | sed -e 's#Exit-Code:*[[:space:]]*##i' -e 's#,.*##')
1896
+ if [ $? -ne 0 ] || [ -z "$exit_code_sed" ]; then
1897
+ echo "WARN: sed failed or no data after sed."
1898
+ exit_code_sed=""
1899
+ fi
1900
+
1901
+ exit_code_tail=$(echo "$exit_code_sed" | tail -n1)
1902
+ if [ $? -ne 0 ] || [ -z "$exit_code_tail" ]; then
1903
+ echo "WARN: tail failed or no data after tail."
1904
+ exit_code_tail=""
1905
+ fi
1906
+
1907
+ exit_code_only_digits=$(echo "$exit_code_tail" | grep -o '[0-9]\+')
1908
+ if [ -z "$exit_code_only_digits" ]; then
1909
+ echo "WARN: No valid exit code found, setting it to 3"
1910
+ exit_code_only_digits=3
1911
+ fi
1912
+
1913
+ exit_code="$exit_code_only_digits"
1914
+
1915
+ if ! [[ "$exit_code" =~ ^[0-9]+$ ]]; then
1916
+ echo "WARN: exit_code invalid ('$exit_code'), setting to 3"
1917
+ exit_code=3
1918
+ fi
1919
+
1920
+ if (( exit_code != 0 )); then
1921
+ if declare -f myexit > /dev/null; then
1922
+ myexit "$exit_code"
1923
+ else
1924
+ echo "WARN: myexit function not found, exiting with code $exit_code"
1925
+ exit "$exit_code"
1926
+ fi
1927
+ fi
1839
1928
  else
1840
1929
  red_text "$LOG_PATH could not be found\n"
1841
1930
  fi
@@ -1865,7 +1954,7 @@ EOF
1865
1954
  sbatch_command=$(echo "$sbatch_command" | sed -e 's#^[[:space:]]*##' -e 's#[[:space:]]*$##')
1866
1955
  red_text "Failed to start sbatch job. Command:\n"
1867
1956
  red_text "$sbatch_command\n"
1868
- red_text "Exit-Code: $exit_code\n"
1957
+ red_text "Exit-Code (sbatch): $exit_code\n"
1869
1958
 
1870
1959
  myexit $exit_code
1871
1960
  fi