adding original examples
This commit is contained in:
106
examples/jobs/array_submitter.sh
Executable file
106
examples/jobs/array_submitter.sh
Executable file
@@ -0,0 +1,106 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#___INFO__MARK_BEGIN__
|
||||
##########################################################################
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# the Sun Industry Standards Source License Version 1.2
|
||||
#
|
||||
# Sun Microsystems Inc., March, 2001
|
||||
#
|
||||
#
|
||||
# Sun Industry Standards Source License Version 1.2
|
||||
# =================================================
|
||||
# The contents of this file are subject to the Sun Industry Standards
|
||||
# Source License Version 1.2 (the "License"); You may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of the
|
||||
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
|
||||
#
|
||||
# Software provided under this License is provided on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
# See the License for the specific provisions governing your rights and
|
||||
# obligations concerning the Software.
|
||||
#
|
||||
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
#
|
||||
# Copyright: 2001 by Sun Microsystems, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
##########################################################################
|
||||
#___INFO__MARK_END__
|
||||
|
||||
#
|
||||
# This sample consists of three scripts belonging toghether
|
||||
#
|
||||
# array_submitter.sh
|
||||
# step_A_array_submitter.sh
|
||||
# step_B_array_submitter.sh
|
||||
#
|
||||
# The number <n> passed as an argument to the interactively started
|
||||
# array_submitter.sh is used to specify the the size of the two array
|
||||
# jobs step_A_array_submitter.sh/step_B_array_submitter.sh which are
|
||||
# submitted. Each single job of array job B is not scheduled before
|
||||
# array job A has not passed the section where qalter is used to release
|
||||
# the succesor task. Refer to qsub(1) for more information about array
|
||||
# jobs.
|
||||
#
|
||||
# This is a typical scenario in DCC industry where schemes like this
|
||||
# are used to control sequence of large rendering jobs.
|
||||
# Note that it is necessary that all hosts where A jobs are started
|
||||
# must be submit hosts to allow the qalter happen.
|
||||
#
|
||||
|
||||
#$ -S /bin/sh
|
||||
|
||||
if [ x$SGE_ROOT = x ]; then
|
||||
SGE_ROOT=/usr/SGE
|
||||
fi
|
||||
if [ ! -d $SGE_ROOT ]; then
|
||||
echo "error: SGE_ROOT directory $SGE_ROOT does not exist"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ARC=`$SGE_ROOT/util/arch`
|
||||
|
||||
QSUB=$SGE_ROOT/bin/$ARC/qsub
|
||||
QALTER=$SGE_ROOT/bin/$ARC/qalter
|
||||
|
||||
if [ ! -x $QSUB ]; then
|
||||
echo "error: cannot execute qsub command under $QSUB"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -x $QALTER ]; then
|
||||
echo "error: cannot execute qalter command under $QALTER"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
tasks=0
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
case "$1" in
|
||||
[0-9]*)
|
||||
tasks=$1
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ $tasks = 0 ]; then
|
||||
echo "usage: array_submitter.sh <number_of_tasks>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# submit step A jobarray
|
||||
jobid_a=`$QSUB -t 1-$tasks -r y -N StepA $SGE_ROOT/examples/jobs/step_A_array_submitter.sh | cut -f3 -d" "|cut -f1 -d.`
|
||||
echo "submission result: jobid_a = $jobid_a"
|
||||
|
||||
# submit step B jobarray with hold state
|
||||
jobid_b=`$QSUB -t 1-$tasks -h -r y -N StepB $SGE_ROOT/examples/jobs/step_B_array_submitter.sh | cut -f3 -d" "|cut -f1 -d.`
|
||||
echo "submission result: jobid_b = $jobid_b"
|
||||
|
||||
# put jobid of step B into context of step A
|
||||
$QALTER -ac succ=$jobid_b $jobid_a
|
||||
36
examples/jobs/env-tester.sh
Executable file
36
examples/jobs/env-tester.sh
Executable file
@@ -0,0 +1,36 @@
|
||||
#!/bin/sh
|
||||
#$ -S /bin/sh
|
||||
#___INFO__MARK_BEGIN__
|
||||
##########################################################################
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# the Sun Industry Standards Source License Version 1.2
|
||||
#
|
||||
# Sun Microsystems Inc., March, 2001
|
||||
#
|
||||
#
|
||||
# Sun Industry Standards Source License Version 1.2
|
||||
# =================================================
|
||||
# The contents of this file are subject to the Sun Industry Standards
|
||||
# Source License Version 1.2 (the "License"); You may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of the
|
||||
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
|
||||
#
|
||||
# Software provided under this License is provided on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
# See the License for the specific provisions governing your rights and
|
||||
# obligations concerning the Software.
|
||||
#
|
||||
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
#
|
||||
# Copyright: 2001 by Sun Microsystems, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
##########################################################################
|
||||
#___INFO__MARK_END__
|
||||
echo ------------------------------------
|
||||
env
|
||||
echo ------------------------------------
|
||||
77
examples/jobs/jobnet_submitter.sh
Executable file
77
examples/jobs/jobnet_submitter.sh
Executable file
@@ -0,0 +1,77 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
#___INFO__MARK_BEGIN__
|
||||
##########################################################################
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# the Sun Industry Standards Source License Version 1.2
|
||||
#
|
||||
# Sun Microsystems Inc., March, 2001
|
||||
#
|
||||
#
|
||||
# Sun Industry Standards Source License Version 1.2
|
||||
# =================================================
|
||||
# The contents of this file are subject to the Sun Industry Standards
|
||||
# Source License Version 1.2 (the "License"); You may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of the
|
||||
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
|
||||
#
|
||||
# Software provided under this License is provided on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
# See the License for the specific provisions governing your rights and
|
||||
# obligations concerning the Software.
|
||||
#
|
||||
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
#
|
||||
# Copyright: 2001 by Sun Microsystems, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
##########################################################################
|
||||
#___INFO__MARK_END__
|
||||
|
||||
QSUB=$SGE_ROOT/bin/$ARC/qsub
|
||||
name_base=Net
|
||||
hold=""
|
||||
jobs=5
|
||||
|
||||
while [ "$1" != "" ]; do
|
||||
case "$1" in
|
||||
-N)
|
||||
shift
|
||||
name_base=$1
|
||||
shift
|
||||
;;
|
||||
-h)
|
||||
hold=-h
|
||||
shift
|
||||
;;
|
||||
[0-9]*)
|
||||
jobs=$1
|
||||
shift
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
echo "going to submit $jobs jobs"
|
||||
|
||||
jobid=0
|
||||
REQUEST=""
|
||||
|
||||
i=1
|
||||
while [ $i -le $jobs ]; do
|
||||
if [ $i -ne 1 ]; then
|
||||
opt="-hold_jid $jobid"
|
||||
fi
|
||||
|
||||
jobid=`$QSUB $REQUEST -r y -N $name_base$i $hold $opt $SGE_ROOT/examples/jobs/sleeper.sh 10 | cut -f3 -d" "`
|
||||
if [ $i -ne 1 ]; then
|
||||
echo submitted job \#$i name = $name_base$i with jobid $jobid and $opt
|
||||
else
|
||||
echo submitted job \#$i name = $name_base$i with jobid $jobid
|
||||
fi
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
1
examples/jobs/matlab_script.sh
Symbolic link
1
examples/jobs/matlab_script.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../../local/examples/jobs/matlab_script.sh
|
||||
107
examples/jobs/pascal.sh
Executable file
107
examples/jobs/pascal.sh
Executable file
@@ -0,0 +1,107 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#___INFO__MARK_BEGIN__
|
||||
##########################################################################
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# the Sun Industry Standards Source License Version 1.2
|
||||
#
|
||||
# Sun Microsystems Inc., March, 2001
|
||||
#
|
||||
#
|
||||
# Sun Industry Standards Source License Version 1.2
|
||||
# =================================================
|
||||
# The contents of this file are subject to the Sun Industry Standards
|
||||
# Source License Version 1.2 (the "License"); You may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of the
|
||||
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
|
||||
#
|
||||
# Software provided under this License is provided on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
# See the License for the specific provisions governing your rights and
|
||||
# obligations concerning the Software.
|
||||
#
|
||||
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
#
|
||||
# Copyright: 2001 by Sun Microsystems, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
##########################################################################
|
||||
#___INFO__MARK_END__
|
||||
#
|
||||
# This is a sample script to demonstrate use of job dependencies. The
|
||||
# sample submits one job for each node in the pascal triangle:
|
||||
#
|
||||
# 1 depth 1
|
||||
# / \
|
||||
# 1 1 depth 2
|
||||
# / \ / \
|
||||
# 1 2 1 depth 3
|
||||
# / \ / \ / \
|
||||
# 1 3 3 1 depth 4
|
||||
#
|
||||
# : : : :
|
||||
#
|
||||
# Data exchange between jobs is done via files in jobnet_dir.
|
||||
#
|
||||
# Usage: pascal.sh <depth of pascal triangle>
|
||||
|
||||
jobnet_dir=$HOME/pascal_jobnet
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "usage: pascal.sh <depth of pascal triangle>" >&2
|
||||
exit 1
|
||||
fi
|
||||
n=$1
|
||||
i=1
|
||||
|
||||
mkdir $jobnet_dir
|
||||
rm $jobnet_dir/*
|
||||
|
||||
while [ $i -le $n ]; do
|
||||
j=1
|
||||
while [ $j -le $i ]; do
|
||||
prev_line=`expr $i - 1`
|
||||
|
||||
# specify own jobname
|
||||
submit_args="-N P${i}_${j}"
|
||||
|
||||
if [ $j -gt 1 -a $j -lt $i ]; then
|
||||
depend1=P${prev_line}_`expr ${j} - 1`
|
||||
depend2=P${prev_line}_${j}
|
||||
depend="$depend1 $depend2"
|
||||
submit_args="$submit_args -hold_jid $depend1,$depend2"
|
||||
elif [ $j -gt 1 ]; then
|
||||
depend=P${prev_line}_`expr ${j} - 1`
|
||||
submit_args="$submit_args -hold_jid $depend"
|
||||
elif [ $j -lt $i ]; then
|
||||
depend=P${prev_line}_${j}
|
||||
submit_args="$submit_args -hold_jid $depend"
|
||||
fi
|
||||
|
||||
echo "qsub -j y -o $jobnet_dir $submit_args -- $jobnet_dir $depend"
|
||||
qsub -r y -j y -o $jobnet_dir $submit_args -- $jobnet_dir $depend << EOF
|
||||
#!/bin/sh
|
||||
#$ -S /bin/sh
|
||||
result=0
|
||||
jobnet_dir=\$1
|
||||
shift
|
||||
while [ \$# -gt 0 ]; do
|
||||
depend=\$1
|
||||
shift
|
||||
to_add=\`cat \$jobnet_dir/DATA_\$depend\`
|
||||
result=\`expr \$result + \$to_add\`
|
||||
echo "\$REQUEST: adding \$to_add found in \$jobnet_dir/DATA_\$depend results in \$result"
|
||||
done
|
||||
if [ \$result = 0 ]; then
|
||||
result=1
|
||||
fi
|
||||
echo \$result > \$jobnet_dir/DATA_\$REQUEST
|
||||
EOF
|
||||
j=`expr $j + 1`
|
||||
done
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
1
examples/jobs/periodic_sleeper.sh
Symbolic link
1
examples/jobs/periodic_sleeper.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../../local/examples/jobs/periodic_sleeper.sh
|
||||
79
examples/jobs/pminiworm.sh
Executable file
79
examples/jobs/pminiworm.sh
Executable file
@@ -0,0 +1,79 @@
|
||||
#!/bin/sh
|
||||
#___INFO__MARK_BEGIN__
|
||||
##########################################################################
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# the Sun Industry Standards Source License Version 1.2
|
||||
#
|
||||
# Sun Microsystems Inc., March, 2001
|
||||
#
|
||||
#
|
||||
# Sun Industry Standards Source License Version 1.2
|
||||
# =================================================
|
||||
# The contents of this file are subject to the Sun Industry Standards
|
||||
# Source License Version 1.2 (the "License"); You may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of the
|
||||
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
|
||||
#
|
||||
# Software provided under this License is provided on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
# See the License for the specific provisions governing your rights and
|
||||
# obligations concerning the Software.
|
||||
#
|
||||
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
#
|
||||
# Copyright: 2001 by Sun Microsystems, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
##########################################################################
|
||||
#___INFO__MARK_END__
|
||||
|
||||
#
|
||||
#
|
||||
|
||||
# -------------------------------------------
|
||||
# -- use Bourne shell --
|
||||
#$ -S /bin/sh
|
||||
# -- our name --
|
||||
#$ -N PMiniWorm
|
||||
# -------------------------------------------
|
||||
# -- send mail if the job exits abnormally --
|
||||
#$ -m a
|
||||
# -------------------------------------------
|
||||
# -- What to redirect to where --
|
||||
#$ -e /dev/null
|
||||
#$ -o /dev/null
|
||||
|
||||
QSUB=$SGE_ROOT/bin/$ARC/qsub
|
||||
SLEEP=120
|
||||
|
||||
echo using $QSUB as qsub command
|
||||
|
||||
if [ "$1" = "" ]; then
|
||||
arg=1
|
||||
else
|
||||
arg=`expr $1 + 1`
|
||||
fi
|
||||
NAME=W$arch$arg
|
||||
|
||||
# started by SGE or manually
|
||||
if [ "$JOB_ID" = "" ]; then
|
||||
echo "submitting $NAME"
|
||||
else
|
||||
sleep $SLEEP
|
||||
fi
|
||||
|
||||
# first try
|
||||
# cmd="$QSUB -N $NAME -l arch=$arch $SGE_ROOT/examples/jobs/pminiworm.sh $arg"
|
||||
cmd="$QSUB -N $NAME $SGE_ROOT/examples/jobs/pminiworm.sh $arg"
|
||||
$cmd
|
||||
|
||||
# repeat until success
|
||||
while [ "x$?" != "x0" ]; do
|
||||
echo "pminiworm.sh: qsub failed - retrying .." >&2
|
||||
sleep $SLEEP
|
||||
$cmd
|
||||
done
|
||||
47
examples/jobs/simple.sh
Executable file
47
examples/jobs/simple.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
#___INFO__MARK_BEGIN__
|
||||
##########################################################################
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# the Sun Industry Standards Source License Version 1.2
|
||||
#
|
||||
# Sun Microsystems Inc., March, 2001
|
||||
#
|
||||
#
|
||||
# Sun Industry Standards Source License Version 1.2
|
||||
# =================================================
|
||||
# The contents of this file are subject to the Sun Industry Standards
|
||||
# Source License Version 1.2 (the "License"); You may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of the
|
||||
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
|
||||
#
|
||||
# Software provided under this License is provided on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
# See the License for the specific provisions governing your rights and
|
||||
# obligations concerning the Software.
|
||||
#
|
||||
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
#
|
||||
# Copyright: 2001 by Sun Microsystems, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
##########################################################################
|
||||
#___INFO__MARK_END__
|
||||
|
||||
# This is a simple example of a SGE batch script
|
||||
|
||||
# request Bourne shell as shell for job
|
||||
#$ -S /bin/sh
|
||||
|
||||
#
|
||||
# print date and time
|
||||
date
|
||||
# Sleep for 20 seconds
|
||||
sleep 20
|
||||
# print date and time again
|
||||
date
|
||||
1
examples/jobs/simple_conda_test.sh
Symbolic link
1
examples/jobs/simple_conda_test.sh
Symbolic link
@@ -0,0 +1 @@
|
||||
../../local/examples/jobs/simple_conda_test.sh
|
||||
63
examples/jobs/sleeper.sh
Executable file
63
examples/jobs/sleeper.sh
Executable file
@@ -0,0 +1,63 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#___INFO__MARK_BEGIN__
|
||||
##########################################################################
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# the Sun Industry Standards Source License Version 1.2
|
||||
#
|
||||
# Sun Microsystems Inc., March, 2001
|
||||
#
|
||||
#
|
||||
# Sun Industry Standards Source License Version 1.2
|
||||
# =================================================
|
||||
# The contents of this file are subject to the Sun Industry Standards
|
||||
# Source License Version 1.2 (the "License"); You may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of the
|
||||
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
|
||||
#
|
||||
# Software provided under this License is provided on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
# See the License for the specific provisions governing your rights and
|
||||
# obligations concerning the Software.
|
||||
#
|
||||
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
#
|
||||
# Copyright: 2001 by Sun Microsystems, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
##########################################################################
|
||||
#___INFO__MARK_END__
|
||||
|
||||
#
|
||||
# Usage: sleeper.sh [time [do_echo]]
|
||||
# default for time is 60 seconds
|
||||
# default for do_echo is 1 (=true)
|
||||
#
|
||||
|
||||
# -- our name ---
|
||||
#$ -N Sleeper
|
||||
#$ -S /bin/sh
|
||||
|
||||
|
||||
time=60
|
||||
do_echo=1
|
||||
if [ $# -ge 1 ]; then
|
||||
time=$1
|
||||
fi
|
||||
if [ $# -ge 2 ]; then
|
||||
do_echo=$2
|
||||
fi
|
||||
|
||||
if [ $do_echo -ne 0 ]; then
|
||||
/bin/echo Here I am: `hostname`. Sleeping now at: `date`
|
||||
fi
|
||||
|
||||
sleep $time
|
||||
|
||||
if [ $do_echo -ne 0 ]; then
|
||||
echo Now it is: `date`
|
||||
fi
|
||||
187
examples/jobs/ssession.sh
Executable file
187
examples/jobs/ssession.sh
Executable file
@@ -0,0 +1,187 @@
|
||||
#!/bin/sh
|
||||
#$ -S /bin/sh
|
||||
#$ -pe make 1
|
||||
#$ -N SSession
|
||||
#$ -v PATH
|
||||
|
||||
#___INFO__MARK_BEGIN__
|
||||
##########################################################################
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# the Sun Industry Standards Source License Version 1.2
|
||||
#
|
||||
# Sun Microsystems Inc., March, 2001
|
||||
#
|
||||
#
|
||||
# Sun Industry Standards Source License Version 1.2
|
||||
# =================================================
|
||||
# The contents of this file are subject to the Sun Industry Standards
|
||||
# Source License Version 1.2 (the "License"); You may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of the
|
||||
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
|
||||
#
|
||||
# Software provided under this License is provided on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
# See the License for the specific provisions governing your rights and
|
||||
# obligations concerning the Software.
|
||||
#
|
||||
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
#
|
||||
# Copyright: 2009 by Sun Microsystems, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
##########################################################################
|
||||
#___INFO__MARK_END__
|
||||
|
||||
|
||||
ARCH=`$SGE_ROOT/util/arch`
|
||||
ECHO="$SGE_ROOT/utilbin/$ARCH/echo_raw -e"
|
||||
|
||||
ssession_logging_enabled="false" # is logging enabled?
|
||||
ssession_logfile="/tmp/ssession.log" # logfile
|
||||
tfile="taskfile.txt" # default taskfile name if not other specified
|
||||
mfile="" # makefile name
|
||||
isource="tfile" # type of onput "tfile" or "mfile"
|
||||
|
||||
ssession_show_usage()
|
||||
{
|
||||
echo "usage: ssession [ taskfile | -mf makefile ]"
|
||||
echo
|
||||
echo " If there is neither a taskfile nor a makefile specified then"
|
||||
echo " this script assumes that there is taskfile named taskfile.txt"
|
||||
echo " in the current working directory."
|
||||
echo
|
||||
echo " taskfile - taskfile containing the tasks to be executed in the session"
|
||||
echo " makefile - makefile containing the tasks an depedency definition"
|
||||
}
|
||||
|
||||
# add start rule to makefile
|
||||
ssession_makefile_add_all()
|
||||
{
|
||||
taskfile=$1
|
||||
makefile=$2
|
||||
|
||||
start="all:"
|
||||
line_i=1
|
||||
max=`wc -l $taskfile|cut -c 1-8`
|
||||
while [ $line_i -le $max ]; do
|
||||
line=`head -$line_i $taskfile | tail -1`
|
||||
|
||||
start=`echo $start task${line_i}`
|
||||
line_i=`expr $line_i + 1`
|
||||
done
|
||||
|
||||
echo $start >>$makefile
|
||||
echo "" >>$makefile
|
||||
|
||||
unset makefile
|
||||
unset start
|
||||
unset line_i
|
||||
}
|
||||
|
||||
# add one rule for each task in taskfile
|
||||
ssession_makefile_add_task()
|
||||
{
|
||||
taskfile=$1
|
||||
makefile=$2
|
||||
|
||||
line_i=1
|
||||
max_lines=`wc -l $taskfile|cut -c 1-8`
|
||||
while [ $line_i -le $max_lines ]; do
|
||||
command=`head -$line_i $taskfile | tail -1`
|
||||
|
||||
echo "task${line_i}:" >>$makefile
|
||||
$ECHO "\t${command}" >>$makefile
|
||||
echo "" >>$makefile
|
||||
line_i=`expr $line_i + 1`
|
||||
done
|
||||
|
||||
unset max_lines
|
||||
unset taskfile
|
||||
unset makefile
|
||||
unset line_i
|
||||
}
|
||||
|
||||
# create the makefile
|
||||
ssession_makefile_create()
|
||||
{
|
||||
makefile=$1
|
||||
|
||||
if [ -f $makefile ]; then
|
||||
rm -f $makefile
|
||||
echo rm
|
||||
fi
|
||||
touch $makefile
|
||||
|
||||
unset makefile
|
||||
}
|
||||
|
||||
# destroy the taskfile
|
||||
ssession_makefile_destroy()
|
||||
{
|
||||
makefile=$1
|
||||
|
||||
# rm -f $makefile
|
||||
unset makefile
|
||||
}
|
||||
|
||||
# start a qmake job that executes tasks in taskfile
|
||||
ssession_start_qmake()
|
||||
{
|
||||
makefile=$1
|
||||
|
||||
qmake -inherit -- -f $makefile
|
||||
}
|
||||
|
||||
ssession_log()
|
||||
{
|
||||
if [ $ssession_logging_enabled = true ]; then
|
||||
echo "$@" >>$ssession_logfile
|
||||
fi
|
||||
}
|
||||
|
||||
if [ $# = 1 ]; then
|
||||
if [ -f "$1" ]; then
|
||||
tfile="$1"
|
||||
else
|
||||
ssession_show_usage
|
||||
exit
|
||||
fi
|
||||
elif [ $# = 2 ]; then
|
||||
if [ "$1" = "-mf" ]; then
|
||||
mfile="$2"
|
||||
isource="mfile"
|
||||
else
|
||||
ssession_show_usage
|
||||
exit
|
||||
fi
|
||||
else
|
||||
tfile="taskfile.txt"
|
||||
fi
|
||||
|
||||
if [ "$mfile" = "" ]; then
|
||||
if [ -d "$TMPDIR" ]; then
|
||||
mfile="${TMPDIR}/Makefile.$$"
|
||||
else
|
||||
mfile="/tmp/Makefile.$$"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$isource" = "tfile" ]; then
|
||||
ssession_log "Using taskfile \"$tfile\""
|
||||
ssession_log "Creating makefile \"$mfile\""
|
||||
|
||||
ssession_makefile_create $mfile
|
||||
ssession_makefile_add_all $tfile $mfile
|
||||
ssession_makefile_add_task $tfile $mfile
|
||||
ssession_start_qmake $mfile
|
||||
ssession_makefile_destroy $mfile
|
||||
else
|
||||
ssession_log "Using makefile \"$mfile\""
|
||||
|
||||
ssession_start_qmake $mfile
|
||||
fi
|
||||
|
||||
47
examples/jobs/step_A_array_submitter.sh
Executable file
47
examples/jobs/step_A_array_submitter.sh
Executable file
@@ -0,0 +1,47 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
#___INFO__MARK_BEGIN__
|
||||
##########################################################################
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# the Sun Industry Standards Source License Version 1.2
|
||||
#
|
||||
# Sun Microsystems Inc., March, 2001
|
||||
#
|
||||
#
|
||||
# Sun Industry Standards Source License Version 1.2
|
||||
# =================================================
|
||||
# The contents of this file are subject to the Sun Industry Standards
|
||||
# Source License Version 1.2 (the "License"); You may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of the
|
||||
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
|
||||
#
|
||||
# Software provided under this License is provided on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
# See the License for the specific provisions governing your rights and
|
||||
# obligations concerning the Software.
|
||||
#
|
||||
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
#
|
||||
# Copyright: 2001 by Sun Microsystems, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
##########################################################################
|
||||
#___INFO__MARK_END__
|
||||
|
||||
# request "/bin/sh" as shell for job
|
||||
#$ -S /bin/sh
|
||||
|
||||
QSTAT=$SGE_ROOT/bin/$ARC/qstat
|
||||
QALTER=$SGE_ROOT/bin/$ARC/qalter
|
||||
|
||||
# find out successor jobid
|
||||
# must be set by submission script
|
||||
successor=`$QSTAT -j $JOB_ID | grep context |cut -f2 -d=`
|
||||
|
||||
# release appropriate succesor task
|
||||
$QALTER -h U $successor.$SGE_TASK_ID
|
||||
39
examples/jobs/step_B_array_submitter.sh
Executable file
39
examples/jobs/step_B_array_submitter.sh
Executable file
@@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
#
|
||||
#___INFO__MARK_BEGIN__
|
||||
##########################################################################
|
||||
#
|
||||
# The Contents of this file are made available subject to the terms of
|
||||
# the Sun Industry Standards Source License Version 1.2
|
||||
#
|
||||
# Sun Microsystems Inc., March, 2001
|
||||
#
|
||||
#
|
||||
# Sun Industry Standards Source License Version 1.2
|
||||
# =================================================
|
||||
# The contents of this file are subject to the Sun Industry Standards
|
||||
# Source License Version 1.2 (the "License"); You may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of the
|
||||
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
|
||||
#
|
||||
# Software provided under this License is provided on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
|
||||
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
|
||||
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
|
||||
# See the License for the specific provisions governing your rights and
|
||||
# obligations concerning the Software.
|
||||
#
|
||||
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
|
||||
#
|
||||
# Copyright: 2001 by Sun Microsystems, Inc.
|
||||
#
|
||||
# All Rights Reserved.
|
||||
#
|
||||
##########################################################################
|
||||
#___INFO__MARK_END__
|
||||
|
||||
# request "/bin/sh" as shell for job
|
||||
#$ -S /bin/sh
|
||||
|
||||
echo $JOB_ID.$SGE_TASK_ID
|
||||
Reference in New Issue
Block a user