3
#########################################################################
5
# The Contents of this file are made available subject to the terms of
6
# the Sun Industry Standards Source License Version 1.2
8
# Sun Microsystems Inc., March, 2001
11
# Sun Industry Standards Source License Version 1.2
12
# =================================================
13
# The contents of this file are subject to the Sun Industry Standards
14
# Source License Version 1.2 (the "License"); You may not use this file
15
# except in compliance with the License. You may obtain a copy of the
16
# License at http://gridengine.sunsource.net/Gridengine_SISSL_license.html
18
# Software provided under this License is provided on an "AS IS" basis,
19
# WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
20
# WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
21
# MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
22
# See the License for the specific provisions governing your rights and
23
# obligations concerning the Software.
25
# The Initial Developer of the Original Code is: Sun Microsystems, Inc.
27
# Copyright: 2001 by Sun Microsystems, Inc.
29
# All Rights Reserved.
31
#########################################################################
33
# This script forks and execs identical copies of qsub.
36
# qsub_blast.pl -n num_instances -m num_simultaneous -q -- qsub_args...
39
# qsub_blast.pl -n 30 -m 30 -- -sync yes -cwd examples/jobs/exit.sh 0
41
#########################################################################
53
# Copy the arg array, remove the number of instances, and add "qsub"
57
while ($arg ne "--") {
61
if ($arg !~ /^\d+$/) {
68
elsif ($arg eq "-m") {
71
if ($arg !~ /^\d+$/) {
78
elsif ($arg eq "-q") {
81
elsif ($arg eq "-help") {
98
unshift (@args, "qsub");
101
push (@args, "1>/dev/null");
102
push (@args, "2>&1");
105
# Fork and exec the right number of qsubs
107
while ($num_forks > 0) {
108
if ($num_forks < $per_loop) {
115
for ($count = 0; $count < $max; $count++) {
121
# Wait once for each fork
122
for ($count = 0; $count < $max; $count++) {
131
# Print the script's usage information
133
print "USAGE: qsub_blast.pl [args] -- qsub_args\n";
134
print "\t-n num_instances Number of instances to run\n";
135
print "\t-m num_simultaneous Number of instances which will run at a time\n";
136
print "\t-q Suppress qsub output\n";
137
print "\t-help Print this message\n";