Skip to content

Commit

Permalink
scripts to help with synchronizing async daq jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
joshStillerman committed Mar 26, 2010
1 parent ea5509e commit c73691b
Show file tree
Hide file tree
Showing 6 changed files with 124 additions and 1 deletion.
28 changes: 27 additions & 1 deletion scripts/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,13 @@ SCRIPTS = \
@MAKEBINDIR@remote_submit \
@MAKEBINDIR@unix_submit \
@MAKEBINDIR@synchronize_unix \
@MAKEBINDIR@SetMdsplusFileProtection
@MAKEBINDIR@SetMdsplusFileProtection \
@MAKEBINDIR@job_finish \
@MAKEBINDIR@job_functions \
@MAKEBINDIR@job_output \
@MAKEBINDIR@job_que \
@MAKEBINDIR@job_start


all : @MAKEBINDIR@ \
$(SCRIPTS)
Expand All @@ -36,3 +42,23 @@ install:

@MAKEBINDIR@ :
mkdir @MAKEBINDIR@

@MAKEBINDIR@remote_submit : remote_submit
cp remote_submit @MAKEBINDIR@remote_submit

@MAKEBINDIR@job_finish : job_finish
cp job_finish @MAKEBINDIR@job_finish

@MAKEBINDIR@job_functions : job_functions
cp job_functions @MAKEBINDIR@job_functions

@MAKEBINDIR@job_output : job_output
cp job_output @MAKEBINDIR@job_output

@MAKEBINDIR@job_queue : job_queue
cp job_queue @MAKEBINDIR@job_queue

@MAKEBINDIR@job_start : job_start
cp job_start @MAKEBINDIR@job_start


16 changes: 16 additions & 0 deletions scripts/job_finish
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# file: /usr/local/mdsplus/bin/job_finish
#
# shell script to signal completion of async daq task.
#
# called by job_finish.fun
#
# param 1 = tree_path
# param 2 = shot number
#
#
. `dirname $0`/job_functions
job_output $1 $2 "FINISHED >>>>>>>>> `date`"
cumulative_name=$(cumulative_log_spec $1 $2)
lock_name=$(job_file_spec $1 $2)
cat $lock_name >> $cumulative_name
rm -f $lock_name
22 changes: 22 additions & 0 deletions scripts/job_functions
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
set_mds_logs()
{
if [ "x$MDS_LOGS" = "x" ]; then
MDS_LOGS="/var/log/mdsplus";
fi
}

job_file_spec()
{
set_mds_logs
FILE=$1
SHOT=$2
LOG="$MDS_LOGS/$FILE.$2.log"
echo $LOG
}
cumulative_log_spec()
{
set_mds_logs
FILE=$1
LOG="$MDS_LOGS/$FILE.log"
echo $LOG
}
31 changes: 31 additions & 0 deletions scripts/job_output
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# file: /usr/local/mdsplus/bin/job_output
#
# shell script to spawn a batch job for automatic intershot analysis.
#
# called by job_que.fun
#
# procedure:
# build a log file name from the base file name
# (logs go to /var/mdsplus/log)
# insert a status line for this shot
# invoke the job with the shot number as $1 redirecting stdout and err
# to the end of the log file
# insert a done status line for this shot
#
# param 1 = tree_path
# param 2 = shot number
# param 3 = message to output
#
. `dirname $0`/job_functions
#
lock_file=$(job_file_spec $1 $2)
if [ ! -e $lock_file ]
then
job_que $1 $2
fi
if [ -e $lock_file ]
then
echo $3 >> $lock_file
else
echo "No lock file found/created"
fi
17 changes: 17 additions & 0 deletions scripts/job_que
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
#
# file: /usr/local/mdsplus/bin/job_que
#
# shell script to signal existance of async daq task.
#
# called by job_que.fun
#
# param 1 = tree_path
# param 2 = shot number
#
#
. `dirname $0`/job_functions
#
file=$(job_file_spec $1 $2)
lockfile $file
chmod a+rw $file
11 changes: 11 additions & 0 deletions scripts/job_start
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# file: /usr/local/mdsplus/bin/job_start
#
# shell script to signal start of async daq task.
#
# called by job_start.fun
#
# param 1 = tree_path
# param 2 = shot number
#
#
job_output $1 $2 "STARTING >>>>>>>>> `date`"

0 comments on commit c73691b

Please sign in to comment.