regisss HF staff commited on
Commit
568dde5
·
verified ·
1 Parent(s): 4678ae1

Improve try-catch

Browse files
Files changed (1) hide show
  1. entrypoint.sh +5 -21
entrypoint.sh CHANGED
@@ -1,8 +1,5 @@
1
  #!/bin/bash
2
 
3
- # TODO: I think this flag is related to getting fail logs; check.
4
- set -e
5
-
6
  export SPACE="EnergyStarAI/launch-computation-example"
7
 
8
  echo "Not checking h100 -- already know it's not there."
@@ -22,24 +19,11 @@ python /parse_requests.py | while read -r line; do
22
  mkdir -p "$run_dir"
23
 
24
  # Let the benchmarking begin!
25
- optimum-benchmark --config-name "${experiment_name}" --config-dir /optimum-benchmark/examples/energy_star/ backend.model="${backend_model}" backend.processor="${backend_model}" hydra.run.dir="${run_dir}" 2> "${run_dir}/error.log"
26
-
27
- # Either mark that the benchmark FAILED, or upload the results.
28
- if [ -s "${run_dir}/error.log" ]; then
29
- # error.log is not-empty, an error was raised
30
- echo "An error was raised while benchmarking the model..."
31
- python /failed_run.py --run_dir "${run_dir}" --model_name "${backend_model}"
32
- else
33
- # The error log file is empty, and we didn't catch an error.
34
- echo "Finished; uploading dataset results"
35
- python /create_results.py ./runs
36
- fi
37
- done || {
38
- # Catch any errors that get thrown; update the requests dataset to FAILED
39
- # based on the last-read run_dir and backend_model.
40
- echo "Error."
41
- python /failed_run.py --run_dir "${run_dir}" --model_name "${backend_model}"
42
- }
43
 
44
  echo "Uploading all output from the /runs folder."
45
  python /upload_run_folder.py --run_dir "/runs"
 
1
  #!/bin/bash
2
 
 
 
 
3
  export SPACE="EnergyStarAI/launch-computation-example"
4
 
5
  echo "Not checking h100 -- already know it's not there."
 
19
  mkdir -p "$run_dir"
20
 
21
  # Let the benchmarking begin!
22
+ optimum-benchmark --config-name "${experiment_name}" --config-dir /optimum-benchmark/examples/energy_star/ backend.model="${backend_model}" backend.processor="${backend_model}" hydra.run.dir="${run_dir}" 2> "${run_dir}/error.log" || (python /failed_run.py --run_dir "${run_dir}" --model_name "${backend_model}" && rm -rf $run_dir)
23
+ done
24
+
25
+ echo "Finished; uploading dataset results"
26
+ python /create_results.py ./runs
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
  echo "Uploading all output from the /runs folder."
29
  python /upload_run_folder.py --run_dir "/runs"