Skip to content

Commit 7393eb9

Browse files
committed
stdout and stderr redirected in model run script
1 parent 11e0493 commit 7393eb9

File tree

10 files changed

+50
-24
lines changed

10 files changed

+50
-24
lines changed

workflows/nt3_mlrMBO/scripts/run_model.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ emews_root=$2
3636
# Each model run, runs in its own "instance" directory
3737
# Set instance_directory to that and cd into it.
3838
instance_directory=$3
39+
40+
mkdir -p $instance_directory
41+
log_file=$instance_directory/run_model.log
42+
exec >> $log_file
43+
exec 2>&1
3944
cd $instance_directory
4045

4146
model_name=$4

workflows/nt3_mlrMBO/scripts/theta_run_model.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,11 @@ emews_root=$2
3535
# Each model run, runs in its own "instance" directory
3636
# Set instance_directory to that and cd into it.
3737
instance_directory=$3
38+
39+
mkdir -p $instance_directory
40+
log_file=$instance_directory/run_model.log
41+
exec >> $log_file
42+
exec 2>&1
3843
cd $instance_directory
3944

4045
model_name=$4

workflows/nt3_mlrMBO/swift/ai_workflow3.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ string algo_params_template =
3030
max.budget = %d, max.iterations = %d, design.size=%d, propose.points=%d, param.set.file='%s'
3131
""";
3232

33-
app (file out, file err) run_model (file shfile, string params_string, string instance, string run_id)
33+
app (void o) run_model (file shfile, string params_string, string instance, string run_id)
3434
{
35-
"bash" shfile params_string emews_root instance model_name FRAMEWORK exp_id run_id benchmark_timeout @stdout=out @stderr=err;
35+
"bash" shfile params_string emews_root instance model_name FRAMEWORK exp_id run_id benchmark_timeout;
3636
}
3737

3838

@@ -79,12 +79,9 @@ app (file out, file err) run_log_end(file shfile)
7979
}
8080

8181
(string obj_result) obj(string params, string iter_indiv_id) {
82-
string outdir = "%s/run_%s" % (turbine_output, iter_indiv_id);
83-
file out <"%s/out.txt" % outdir>;
84-
file err <"%s/err.txt" % outdir>;
85-
86-
(out,err) = run_model(model_script, params, outdir, iter_indiv_id) =>
87-
string result_file = "%s/result.txt" % outdir;
82+
string outdir = "%s/run_%s" % (turbine_output, iter_indiv_id) =>
83+
run_model(model_script, params, outdir, iter_indiv_id) =>
84+
string result_file = "%s/result.txt" % outdir =>
8885
obj_result = get_results(result_file);
8986
printf(obj_result);
9087
}

workflows/p2b1_mlrMBO/scripts/run_model.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ emews_root=$2
3636
# Each model run, runs in its own "instance" directory
3737
# Set instance_directory to that and cd into it.
3838
instance_directory=$3
39+
40+
mkdir -p $instance_directory
41+
log_file=$instance_directory/run_model.log
42+
exec >> $log_file
43+
exec 2>&1
3944
cd $instance_directory
4045

4146
framework=$4

workflows/p2b1_mlrMBO/scripts/theta_run_model.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ emews_root=$2
3434
# Each model run, runs in its own "instance" directory
3535
# Set instance_directory to that and cd into it.
3636
instance_directory=$3
37+
38+
mkdir -p $instance_directory
39+
log_file=$instance_directory/run_model.log
40+
exec >> $log_file
41+
exec 2>&1
3742
cd $instance_directory
3843

3944
framework=$4

workflows/p2b1_mlrMBO/swift/ai_workflow3.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ string algo_params_template =
3030
max.budget = %d, max.iterations = %d, design.size=%d, propose.points=%d, param.set.file='%s'
3131
""";
3232

33-
app (file out, file err) run_model (file shfile, string params_string, string instance, string run_id)
33+
app (void o) run_model (file shfile, string params_string, string instance, string run_id)
3434
{
35-
"bash" shfile params_string emews_root instance FRAMEWORK exp_id run_id benchmark_timeout @stdout=out @stderr=err;
35+
"bash" shfile params_string emews_root instance FRAMEWORK exp_id run_id benchmark_timeout
3636
}
3737

3838

@@ -80,12 +80,9 @@ app (file out, file err) run_log_end(file shfile)
8080
}
8181

8282
(string obj_result) obj(string params, string iter_indiv_id) {
83-
string outdir = "%s/run_%s" % (turbine_output, iter_indiv_id);
84-
file out <"%s/out.txt" % outdir>;
85-
file err <"%s/err.txt" % outdir>;
86-
87-
(out,err) = run_model(model_script, params, outdir, iter_indiv_id) =>
88-
string result_file = "%s/result.txt" % outdir;
83+
string outdir = "%s/run_%s" % (turbine_output, iter_indiv_id) =>
84+
run_model(model_script, params, outdir, iter_indiv_id) =>
85+
string result_file = "%s/result.txt" % outdir =>
8986
obj_result = get_results(result_file);
9087
printf(obj_result);
9188
}

workflows/p3b1_mlrMBO/scripts/run_model.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ emews_root=$2
3636
# Each model run, runs in its own "instance" directory
3737
# Set instance_directory to that and cd into it.
3838
instance_directory=$3
39+
40+
mkdir -p $instance_directory
41+
log_file=$instance_directory/run_model.log
42+
exec >> $log_file
43+
exec 2>&1
3944
cd $instance_directory
4045

4146
framework=$4

workflows/p3b1_mlrMBO/scripts/theta_run_model.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ emews_root=$2
3434
# Each model run, runs in its own "instance" directory
3535
# Set instance_directory to that and cd into it.
3636
instance_directory=$3
37+
38+
mkdir -p $instance_directory
39+
log_file=$instance_directory/run_model.log
40+
exec >> $log_file
41+
exec 2>&1
3742
cd $instance_directory
3843

3944
framework=$4

workflows/p3b1_mlrMBO/scripts/titan_run_model.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@ emews_root=$2
3434
# Each model run, runs in its own "instance" directory
3535
# Set instance_directory to that and cd into it.
3636
instance_directory=$3
37+
38+
mkdir -p $instance_directory
39+
log_file=$instance_directory/run_model.log
40+
exec >> $log_file
41+
exec 2>&1
3742
cd $instance_directory
3843

3944
framework=$4

workflows/p3b1_mlrMBO/swift/ai_workflow3.swift

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ string algo_params_template =
3232
max.budget = %d, max.iterations = %d, design.size=%d, propose.points=%d, param.set.file='%s'
3333
""";
3434

35-
app (file out, file err) run_model (file shfile, string params_string, string instance, string run_id)
35+
app (void o) run_model (file shfile, string params_string, string instance, string run_id)
3636
{
37-
"bash" shfile params_string emews_root instance FRAMEWORK exp_id run_id benchmark_timeout @stdout=out @stderr=err;
37+
"bash" shfile params_string emews_root instance FRAMEWORK exp_id run_id benchmark_timeout;
3838
}
3939

4040
app (file out, file err) run_log_start(file shfile, string ps, string sys_env, string algorithm)
@@ -81,12 +81,9 @@ app (file out, file err) run_log_end(file shfile)
8181
}
8282

8383
(string obj_result) obj(string params, string iter_indiv_id) {
84-
string outdir = "%s/run_%s" % (turbine_output, iter_indiv_id);
85-
file out <"%s/out.txt" % outdir>;
86-
file err <"%s/err.txt" % outdir>;
87-
88-
(out,err) = run_model(model_script, params, outdir, iter_indiv_id) =>
89-
string result_file = "%s/result.txt" % outdir;
84+
string outdir = "%s/run_%s" % (turbine_output, iter_indiv_id) =>
85+
run_model(model_script, params, outdir, iter_indiv_id) =>
86+
string result_file = "%s/result.txt" % outdir =>
9087
obj_result = get_results(result_file);
9188
printf(obj_result);
9289
}

0 commit comments

Comments
 (0)