<commit_before>#!/bin/bash

set -e

showHelp=""

TIMEOUT=$1
if [ -z "$TIMEOUT" ]; then
	TIMEOUT=6
fi

NUMBEROFJOBS=$2
if [ -z "$NUMBEROFJOBS" ]; then
	NUMBEROFJOBS=1
fi

RSCRIPTTOEXECUTE=${RSCRIPTTOEXECUTE:-evaluateQuery.R}
NODES=${NODES:-desk}
NAME=${NAME:-default}

if [ -z "$1" -o "-h" = "$1" -o "--help" = "$1" ]; then
	showHelp="yes"
fi

if [ -n "$showHelp" ]; then
cat <<EOHELP
NAME

	submitToTorqueLocally.sh - script to submit expression QTL analyses to a local queueing system

SYNOPSIS

	submitToTorqueLocally.sh <duration> <number>

DESCRIPTION

	The default is to submit 1 jobs, otherwise the second argument
	to the script should specify the number of jobs. The number of
	jobs is not identical to the nubmer of workunits that are going
	to be calculated. There are multiple workunits per job.

	The duration is 4 hours (only time unit).  As many jobs as
	possible will be created in that time. The cputime of the job
	will be set to the duration specified this way.

ENVIRONMENT

	RSCRIPTTOEXECUTE - script to be executed by R in the queue
		(set to '$RSCRIPTTOEXECUTE')

	NODES        - the name of the nodes to submit to (set to '$NODES')

	NAME         - identifier to appear as eQTL_\${NAME}_\$jobnumber

	CALCULATIONS - number of Scanone or Scantwo calculations to
	               perform per submitted queue job

AUTHOR

	<NAME> <<EMAIL>>

EOHELP
	exit 0
fi

if [ ! -r "$RSCRIPTTOEXECUTE" ]; then
	echo "Could not find R script to execute at '$RSCRIPTTOEXECUTE'."
	exit -1
fi

for i in `seq 1 $NUMBEROFJOBS`
do
	cmd="R CMD BATCH $RSCRIPTTOEXECUTE"
	echo "Submitting job: $cmd"
	intern_nodesspec=",nodes=$NODES"
	if [ -z "$NODES" -o "any" = "$NODES" -o "all" = "$NODES" -o "ALL" = "$NODES" -o "ANY" = "$NODES" ]; then
		intern_nodesspec=""
	fi
	cat <<EOQSUB | qsub
#PBS -r y
#PBS -N eQTL_${NAME}_$i
#PBS -l cput=$TIMEOUT:59:00$intern_nodesspec
export TIMEOUT=$TIMEOUT<commit_msg>help2pod<commit_after>#!/bin/bash

set -e

showHelp=""

TIMEOUT=$1
if [ -z "$TIMEOUT" ]; then
	TIMEOUT=6
fi

NUMBEROFJOBS=$2
if [ -z "$NUMBEROFJOBS" ]; then
	NUMBEROFJOBS=1
fi

RSCRIPTTOEXECUTE=${RSCRIPTTOEXECUTE:-evaluateQuery.R}
NODES=${NODES:-desk}
NAME=${NAME:-default}

if [ -z "$1" -o "-h" = "$1" -o "--help" = "$1" ]; then
	showHelp="yes"
fi

if [ -n "$showHelp" ]; then

: <<=cut

=head1 NAME

submitToTorqueLocally.sh - script to submit expression QTL analyses to a local queueing system

=head1 SYNOPSIS

submitToTorqueLocally.sh <duration> <number>

=head1 DESCRIPTION

The default is to submit 1 jobs, otherwise the second argument
to the script should specify the number of jobs. The number of
jobs is not identical to the nubmer of workunits that are going
to be calculated. There are multiple workunits per job.

The duration is 4 hours (only time unit).  As many jobs as
possible will be created in that time. The cputime of the job
will be set to the duration specified this way.

=head1 ENVIRONMENT

=over 4

=item RSCRIPTTOEXECUTE

script to be executed by R in the queue

=item NODES

the name of the nodes to submit to

=item NAME

identifier to appear as eQTL_\${NAME}_\$jobnumber

=item CALCULATIONS

number of Scanone or Scantwo calculations to perform per submitted
queue job

=head1 AUTHOR

<NAME><ouml>ller <<EMAIL>>

=head1 COPYRIGHT

University of LE<uuml>beck, 2008-2009

=cut
        pod2man $0 | nroff -man | less
        exit
fi

if [ ! -r "$RSCRIPTTOEXECUTE" ]; then
	echo "Could not find R script to execute at '$RSCRIPTTOEXECUTE'."
	exit -1
fi

for i in `seq 1 $NUMBEROFJOBS`
do
	cmd="R CMD BATCH $RSCRIPTTOEXECUTE"
	echo "Submitting job: $cmd"
	intern_nodesspec=",nodes=$NODES"
	if [ -z "$NODES" -o "any" = "$NODES" -o "all" = "$NODES" -o "ALL" = "$NODES" -o "ANY" = "$NODES" ]; then
		intern_nodesspec=""
	fi
	cat <<EOQSUB | qsub
#PBS -r y
#PBS -N eQTL_${NAME}_$i
#PBS -l cput=$TIMEOUT:59:00$intern_nodesspec
export TIMEOUT=$TIMEOUT
{'fraction_non_alphanumeric': 0.11530506721820062, 'fraction_numerical': 0.012668045501551189, 'mean_word_length': 3.878940731399748, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5503765', 'n_tokens_mistral': 1477, 'n_tokens_neox': 1431, 'n_words': 515}