Commit 6b8fa06b authored by Hynek Baran's avatar Hynek Baran

Parsing job names changed: The dot is a separator (jobbase.123.runme)

parent 3d0de48b
......@@ -4,15 +4,16 @@
# $1 job base path
# all additional params are passed to maple
JobBasePath=$1
JobBaseName=`basename ${JobBasePath}`
JobPath=$1
JobName=`basename ${JobPath}`
JobBase=${JobName%.*}
shift
BaseDir=`bin/hostname`
MapleWorkDir="InProgress/${BaseDir}/${JobBasePath}"
MapleWorkDir="InProgress/${BaseDir}/${JobPath}"
ErrorFile=${MapleWorkDir}/${JobBasePath}.err
ErrorFile=${MapleWorkDir}/${JobPath}.err
StopFile="InProgress/${BaseDir}/stop"
QuitFile="InProgress/${BaseDir}/quit"
......@@ -27,25 +28,25 @@ function CleanUpSubDir()
function MoveToErrors()
{
echo "Error: "$1" moving to Errors/${JobBasePath}"
echo "Error: "$1" moving to Errors/${JobPath}"
echo
SuccessFile="${MapleWorkDir}/Results/${JobBasePath}.success"
SuccessFile="${MapleWorkDir}/Results/${JobPath}.success"
if [ -f "${SuccessFile}" ] ; then
echo "Error raised but there is a result ${SuccessFile} !"
cp "${SuccessFile}" "Results/"
fi
if [ -d Errors/${JobBasePath} ] ; then
mv Errors/${JobBasePath} Errors/${JobBasePath}.backup
# mv --backup=numbered Errors/${JobBasePath} Errors/${JobBasePath}.backup
if [ -d Errors/${JobPath} ] ; then
mv Errors/${JobPath} Errors/${JobPath}.backup
# mv --backup=numbered Errors/${JobPath} Errors/${JobPath}.backup
fi
#top -l 1 -n 60 -o vsize > "${ErrorFile}.memusage.txt"
mv "${MapleWorkDir}/" "Errors/${JobBasePath}"
# mv --backup=numbered "${MapleWorkDir}/" "Errors/${JobBasePath}"
mv "${MapleWorkDir}/" "Errors/${JobPath}"
# mv --backup=numbered "${MapleWorkDir}/" "Errors/${JobPath}"
if [[ ${MapleResult} == 0 ]] ; then
MapleResult=100
fi
......@@ -55,7 +56,7 @@ function MoveToErrors()
function FinalEcho()
{
echo "${1}"
echo "(End of ${JobBasePath})"
echo "(End of ${JobPath})"
echo
}
......@@ -87,7 +88,7 @@ if [[ -f ${QuitFile} ]] ; then
### lock job and trap signals
JobLockRootDir="InProgress/locks"
JobLockPath="${JobLockRootDir}/${JobBasePath}"
JobLockPath="${JobLockRootDir}/${JobPath}"
MyTrap() {
local ECODE=$?
......@@ -104,19 +105,19 @@ if mkdir "${JobLockPath}"; then
trap "MyTrap" INT TERM EXIT
###trap 'ECODE=$?; echo "exit(${ECODE}) TRAPped, freeing lock ${JobLockPath}"; rm -r ${JobLockPath}; exit ${ECODE}' INT TERM EXIT
else
echo "Lock of ${JobLockPath} failed, exiting ${JobBasePath} in $PWD directory on host $HOSTNAME pid $$ in ${MapleWorkDir}" >&2
echo "Lock of ${JobLockPath} failed, exiting ${JobPath} in $PWD directory on host $HOSTNAME pid $$ in ${MapleWorkDir}" >&2
exit 0
fi
##################################################
echo
echo "================================================================================"
echo "Computing ${JobBasePath} in $PWD directory on host $HOSTNAME pid $$ in ${MapleWorkDir}"
echo "Computing ${JobPath} in $PWD directory on host $HOSTNAME pid $$ in ${MapleWorkDir}"
echo
# job file existence check
if [ ! -f "Ready/${JobBasePath}.runme" ] ; then
FinalEcho "Warning: Missing job file Ready/${JobBasePath}.runme."
if [ ! -f "Ready/${JobPath}.runme" ] ; then
FinalEcho "Warning: Missing job file Ready/${JobPath}.runme."
exit 0
fi
......@@ -165,22 +166,22 @@ for x in "mc/SingleStep.mc" "mc/CommonProc.mc" "mc/Jets.s" "bin/cmaple"; do
done
# move .runme job file
mv Ready/${JobBasePath}.runme ${MapleWorkDir}/
mv Ready/${JobPath}.runme ${MapleWorkDir}/
if [[ 0 -lt $? ]] ; then
if [ ! -f "Ready/${JobBasePath}.runme" ] ; then
FinalEcho "Warning: Dissmissed job file Ready/${JobBasePath}.runme."
if [ ! -f "Ready/${JobPath}.runme" ] ; then
FinalEcho "Warning: Dissmissed job file Ready/${JobPath}.runme."
exit 0
else
FinalEcho "FATAL ERROR: Cannot move job file to work directory, file ${MapleWorkDir}/${JobBasePath}.runme does not exist."
FinalEcho "FATAL ERROR: Cannot move job file to work directory, file ${MapleWorkDir}/${JobPath}.runme does not exist."
exit 255
fi
fi
if [ ! -f "${MapleWorkDir}/${JobBasePath}.runme" ] ; then
if [ ! -f "Ready/${JobBasePath}.runme" ] ; then
FinalEcho "Warning: Dissmissed job file Ready/${JobBasePath}.runme."
if [ ! -f "${MapleWorkDir}/${JobPath}.runme" ] ; then
if [ ! -f "Ready/${JobPath}.runme" ] ; then
FinalEcho "Warning: Dissmissed job file Ready/${JobPath}.runme."
exit 0
else
FinalEcho "FATAL ERROR: Cannot move job file to work directory, file ${MapleWorkDir}/${JobBasePath}.runme does not exist."
FinalEcho "FATAL ERROR: Cannot move job file to work directory, file ${MapleWorkDir}/${JobPath}.runme does not exist."
exit 255
fi
fi
......@@ -193,8 +194,9 @@ echo "`ls -la`"
# run the computation
global/bin/cmaple \
-c 'parCD:=\"'${MapleWorkDir}'\"' \
-c 'parBaseFileName:=\"'${JobBasePath}'\"' \
-c 'parJobPrefix:=\"'${JobBaseName/[0-9\{\}]*/}'\"' \
-c 'parJobPath:=\"'${JobPath}'\"' \
-c 'parJobName:=\"'${JobName}'\"' \
-c 'parJobBase:=\"'${JobBase}'\"' \
$* < "global/mc/SingleStep.mc"
MapleResult=$?
......@@ -209,12 +211,12 @@ if [[ 50 -lt ${MapleResult} ]] ; then
elif [ -f ${ErrorFile} ] ; then
# maple created an .error file
MoveToErrors " There is an error file ${ErrorFile},"
elif [ ! -f ${MapleWorkDir}/States/${JobBasePath}.state ] ; then
elif [ ! -f ${MapleWorkDir}/States/${JobPath}.state ] ; then
# maple have not created .state file
echo "Error: States/${JobBasePath}.state does not exists." >> ${ErrorFile}
echo "Result of grep -i \"error\" Logs/${JobBasePath}.log :" >> ${ErrorFile}
grep -i "error" Logs/${JobBasePath}.log >> ${ErrorFile}
MoveToErrors " States/${JobBasePath}.state does not exists,"
echo "Error: States/${JobPath}.state does not exists." >> ${ErrorFile}
echo "Result of grep -i \"error\" Logs/${JobPath}.log :" >> ${ErrorFile}
grep -i "error" Logs/${JobPath}.log >> ${ErrorFile}
MoveToErrors " States/${JobPath}.state does not exists,"
else
# successfully done
mv ${MapleWorkDir}/*.* Done/
......
......@@ -56,5 +56,5 @@ else
cp "bin/${StopFile2}" "InProgress/${StopFile2}"
# prepare startup empty but valid maple file:
echo "# Done" >> Ready/$1.runme
echo "# Done" >> "Ready/${1}.1.runme"
fi
\ No newline at end of file
lprint("CommonProc.mc v. 0.2.j", __FILE__);
lprint("CommonProc.mc v. 0.3", __FILE__);
# Printing to file
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment