Skip to content

Commit a35edf1

Browse files
committed
add job_status.log
1 parent 99efc14 commit a35edf1

File tree

8 files changed

+45
-3
lines changed

8 files changed

+45
-3
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# logs
22
ctl/logs
3+
ctl/job_status.log
34
# run directories
45
run/
56
# data directories

ctl/control_tsmp2.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ pfl_node=2
6262
# DebugMode: No job submission. Just config
6363
debugmode=false
6464

65+
# log job status
66+
joblog=true
67+
6568
###########################################
6669

6770
###
@@ -182,8 +185,6 @@ else
182185
source ${ctl_dir}/pre_ctl/pre.job
183186
fi
184187

185-
echo $submit_pre" for preprocessing"
186-
187188
# get jobid
188189
pre_id=$(echo $submit_pre | awk 'END{print $(NF)}')
189190

ctl/pos_ctl/pos.job

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ IFS=' ' read -r -a lvis <<< "$lvisstr"
1818
###
1919
# source environment
2020
###
21+
timestart=$(date +%s)
2122
source ${tsmp2_env} # should be changed to post-processing env.
2223

2324
###
@@ -57,4 +58,10 @@ pos_cleanup
5758

5859
fi # cleanup
5960

61+
###
62+
# Log job
63+
###
64+
timeend=$(date +%s)
65+
logging_job_status "pos"
66+
6067
exit 0

ctl/pre_ctl/pre.job

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ IFS=' ' read -r -a lvis <<< "$lvisstr"
1818
###
1919
# source environment
2020
###
21+
timestart=$(date +%s)
2122
#source ${tsmp2_env} # chang pre-processing env. according to comp. model
2223

2324
###
@@ -57,4 +58,10 @@ pre_cleanup
5758

5859
fi # cleanup
5960

61+
###
62+
# Log job
63+
###
64+
timeend=$(date +%s)
65+
logging_job_status "pre"
66+
6067
exit 0

ctl/sim_ctl/sim.job

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ IFS=' ' read -r -a lvis <<< "$lvisstr"
1818
###
1919
# source environment
2020
###
21+
timestart=$(date +%s)
2122
source ${tsmp2_env}
2223

2324
###
@@ -57,4 +58,10 @@ sim_cleanup
5758

5859
fi # cleanup
5960

61+
###
62+
# Log simulation
63+
###
64+
timeend=$(date +%s)
65+
logging_job_status "sim"
66+
6067
exit 0

ctl/sim_ctl/sim_cleanup.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ cp -v ${sim_dir}/slm_multiprog_mapping.conf ${simout_dir}/log/
9696
# sim logs
9797
mv ${log_dir}/${SLURM_JOB_NAME}_${SLURM_JOB_ID}.{err,out} ${simout_dir}/log/.
9898

99-
#echo "SLURM node ID LIST:"${SLURM_JOB_NODELIST}
99+
# job info
100+
echo $(scontrol show job ${SLURM_JOB_ID}) > ${simout_dir}/log/job_info.log
100101

101102
# remove run directory
102103
rm -rf ${sim_dir:?}

ctl/utils_tsmp2.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,3 +83,14 @@ check_var_def() {
8383
fi
8484
fi
8585
} # check_var_def
86+
87+
logging_job_status(){
88+
local step="$1"
89+
90+
if [ "$joblog" = true ]; then
91+
job_state=$(scontrol show job $SLURM_JOB_ID | grep "JobState=" | cut -d= -f2 | cut -d' ' -f1)
92+
printf "%10s %3s %15s %14s %10s %14s %9s\n" "${expid}" "${step}" "${modelid}" \
93+
"${dateshort}" "${job_state}" "$(date '+%Y%m%d%H%M%S')" $(date -u -d "0 $timeend sec - $timestart sec" +"%H:%M:%S") \
94+
>> ${ctl_dir}/job_status.log
95+
fi
96+
} # logging_job_status

ctl/vis_ctl/vis.job

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ IFS=' ' read -r -a lvis <<< "$lvisstr"
1818
###
1919
# source environment
2020
###
21+
timestart=$(date +%s)
2122
source ${tsmp2_env} # should be changed to visualisation env.
2223

2324
###
@@ -57,4 +58,10 @@ vis_cleanup
5758

5859
fi # cleanup
5960

61+
###
62+
# Log job
63+
###
64+
timeend=$(date +%s)
65+
logging_job_status "vis"
66+
6067
exit 0

0 commit comments

Comments
 (0)