Skip to content

Commit 23ca56c

Browse files
committed
Added logging code to all ai workflows
1 parent 89096ff commit 23ca56c

20 files changed

+157
-141
lines changed
File renamed without changes.

workflows/nt3_mlrMBO/scripts/run_logger.sh renamed to workflows/common/sh/run_logger.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export PYTHONPATH="$COMMON_DIR"
99
# "start" propose_points, max_iterations, ps, algorithm, exp_id, sys_env
1010
if [ $CMD == "start" ]
1111
then
12-
arg_array=("$EMEWS_PROJECT_ROOT/python/log_runner.py" "$1" "$3" "$4" "$5" "$6" "$7" "$8")
12+
arg_array=("$EMEWS_PROJECT_ROOT/../common/python/log_runner.py" "$1" "$3" "$4" "$5" "$6" "$7" "$8")
1313
python "${arg_array[@]}"
1414
else
15-
arg_array=("$EMEWS_PROJECT_ROOT/python/log_runner.py" "$1" "$3")
15+
arg_array=("$EMEWS_PROJECT_ROOT/../common/python/log_runner.py" "$1" "$3")
1616
python "${arg_array[@]}"
1717
fi

workflows/nt3_mlrMBO/scripts/theta_run_logger.sh renamed to workflows/common/sh/theta_run_logger.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@ export PYTHONPATH
1616
# "start" propose_points, max_iterations, ps, algorithm, exp_id, sys_env
1717
if [ $CMD == "start" ]
1818
then
19-
arg_array=("$EMEWS_PROJECT_ROOT/python/log_runner.py" "$1" "$3" "$4" "$5" "$6" "$7" "$8")
19+
arg_array=("$EMEWS_PROJECT_ROOT/../common/python/log_runner.py" "$1" "$3" "$4" "$5" "$6" "$7" "$8")
2020
python "${arg_array[@]}"
2121
else
22-
arg_array=("$EMEWS_PROJECT_ROOT/python/log_runner.py" "$1" "$3")
22+
arg_array=("$EMEWS_PROJECT_ROOT/../common/python/log_runner.py" "$1" "$3")
2323
python "${arg_array[@]}"
2424
fi

workflows/nt3_mlrMBO/scripts/run_model.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ if [ -n "$TIMEOUT" ]; then
2525
TIMEOUT_CMD="timeout $TIMEOUT"
2626
fi
2727

28-
# Set param_line from the first argument to this script
29-
# param_line is the string containing the model parameters for a run.
28+
# string of parameters
3029
parameter_string="$1"
3130
echo $parameter_string
3231

workflows/nt3_mlrMBO/scripts/theta_run_model.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ if [ -n "$TIMEOUT" ]; then
2525
TIMEOUT_CMD="timeout $TIMEOUT"
2626
fi
2727

28-
# Set param_line from the first argument to this script
29-
# param_line is the string containing the model parameters for a run.
28+
3029
parameter_string=$1
3130

3231
# Set emews_root to the root directory of the project (i.e. the directory

workflows/nt3_mlrMBO/swift/ai_workflow.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ MACHINE=""
3434
# How many to runs evaluate per iteration
3535
MAX_BUDGET=${MAX_BUDGET:-110}
3636
# Total iterations
37-
MAX_ITERATIONS=${MAX_ITERATIONS:-2}
37+
MAX_ITERATIONS=${MAX_ITERATIONS:-4}
3838
DESIGN_SIZE=${DESIGN_SIZE:-4}
3939
PROPOSE_POINTS=${PROPOSE_POINTS:-4}
40-
PARAM_SET_FILE=${PARAM_SET_FILE:-$EMEWS_PROJECT_ROOT/data/parameter_set.R}
40+
PARAM_SET_FILE=${PARAM_SET_FILE:-$EMEWS_PROJECT_ROOT/data/parameter_set3.R}
4141

4242
SCRIPT_FILE=$EMEWS_PROJECT_ROOT/scripts/run_model.sh
43-
LOG_SCRIPT_FILE=$EMEWS_PROJECT_ROOT/scripts/run_logger.sh
43+
LOG_SCRIPT_FILE=$EMEWS_PROJECT_ROOT/../common/sh/run_logger.sh
4444
# USER SETTINGS END
4545

4646
# source some utility functions used by EMEWS in this script

workflows/nt3_mlrMBO/swift/test_workflow.sh

Lines changed: 0 additions & 82 deletions
This file was deleted.

workflows/nt3_mlrMBO/swift/theta_workflow.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ EQR=$EMEWS_PROJECT_ROOT/ext/EQ-R
9494
CMD_LINE_ARGS="$* -pp=$PROPOSE_POINTS -mi=$MAX_ITERATIONS -mb=$MAX_BUDGET -ds=$DESIGN_SIZE "
9595
CMD_LINE_ARGS+="-param_set_file=$PARAM_SET_FILE -script_file=$EMEWS_PROJECT_ROOT/scripts/theta_run_model.sh "
9696
CMD_LINE_ARGS+="-model_name=$MODEL_NAME "
97-
CMD_LINE_ARGS+="-exp_id=$EXPID -log_script=$EMEWS_PROJECT_ROOT/scripts/theta_run_logger.sh"
97+
CMD_LINE_ARGS+="-exp_id=$EXPID -log_script=$EMEWS_PROJECT_ROOT/../common/sh/theta_run_logger.sh"
9898

9999
# set machine to your scheduler type (e.g. pbs, slurm, cobalt etc.),
100100
# or empty for an immediate non-queued unscheduled run

workflows/p2b1_mlrMBO/python/p2b1_runner.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,15 @@ def run(hyper_parameter_map):
4141
return loss_history[-1]
4242

4343
if __name__ == '__main__':
44-
param_file = sys.argv[1]
44+
param_string = sys.argv[1]
4545
instance_directory = sys.argv[2]
4646
framework = sys.argv[3]
47-
hyper_parameter_map = runner_utils.init(param_file, instance_directory,
47+
exp_id = sys.argv[4]
48+
run_id = sys.argv[5]
49+
hyper_parameter_map = runner_utils.init(param_string, instance_directory,
4850
framework, 'save_path')
51+
hyper_parameter_map['experiment_id'] = exp_id
52+
hyper_parameter_map['run_id'] = run_id
4953
# clear sys.argv so that argparse doesn't object
5054
sys.argv = ['p2b1_runner']
5155
result = run(hyper_parameter_map)

workflows/p2b1_mlrMBO/scripts/run_model.sh

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ set -eu
1313

1414
# !!! IF YOU CHANGE THE NUMBER OF ARGUMENTS PASSED TO THIS SCRIPT, YOU MUST
1515
# CHANGE THE TIMEOUT_ARG_INDEX !!!
16-
TIMEOUT_ARG_INDEX=5
16+
TIMEOUT_ARG_INDEX=7
1717
TIMEOUT=""
1818
if [[ $# == $TIMEOUT_ARG_INDEX ]]
1919
then
@@ -25,9 +25,9 @@ if [ -n "$TIMEOUT" ]; then
2525
TIMEOUT_CMD="timeout $TIMEOUT"
2626
fi
2727

28-
# Set param_line from the first argument to this script
29-
# param_line is the string containing the model parameters for a run.
30-
param_file=$1
28+
## param_string is the string containing the model parameters for a run.
29+
parameter_string="$1"
30+
echo $parameter_string
3131

3232
# Set emews_root to the root directory of the project (i.e. the directory
3333
# that contains the scripts, swift, etc. directories and files)
@@ -39,19 +39,24 @@ instance_directory=$3
3939
cd $instance_directory
4040

4141
framework=$4
42+
exp_id=$5
43+
run_id=$6
4244

4345
export KERAS_BACKEND=theano
44-
BENCHMARK_DIR=$emews_root/../../../Benchmarks/Pilot2/P2B1
46+
BENCHMARK_DIR=$emews_root/../../../Benchmarks/common:$emews_root/../../../Benchmarks/Pilot2/P2B1
4547
COMMON_DIR=$emews_root/../common/python
4648
export PYTHONPATH="$BENCHMARK_DIR:$COMMON_DIR"
47-
MODEL_CMD="python $emews_root/python/p2b1_runner.py $param_file $instance_directory $framework"
49+
50+
arg_array=("$emews_root/python/p2b1_runner.py" "$parameter_string" "$instance_directory" "$framework" "$exp_id" "$run_id")
51+
MODEL_CMD="python ${arg_array[@]}"
52+
4853

4954
# Turn bash error checking off. This is
5055
# required to properly handle the model execution return value
5156
# the optional timeout.
5257
set +e
5358
echo $MODEL_CMD
54-
$TIMEOUT_CMD $MODEL_CMD
59+
$TIMEOUT_CMD python "${arg_array[@]}"
5560
# $? is the exit status of the most recently executed command (i.e the
5661
# line above)
5762
RES=$?

0 commit comments

Comments
 (0)