require 5.004
  ; # A good idea as versions previous to this have a known buffer overflow problem

###############################################################################
#
# Sun Grid Engine
#
###############################################################################

# If you are using Perl 5.004 or later, then use the FindBin lines. Otherwise
# you will need to pass the TSI installation directory on the command line
# using "-I" or modify the line below
#use lib "<install directory>";

use FindBin qw($Bin)
  ;    # determines dynamically the directory containing this script
   # and from there the module files (which are installed in the same directory)
use lib $FindBin::Bin;
use strict;

use Reporting
  qw(debug_report failed_report ok_report start_report command_report report_and_die);

use SharedConfiguration qw(configure_common startup);
$main::tsi_props = shift || "./tsi.properties";
configure_common();

# The TSI code is split into a number of Perl modules to
# allow for easier maintenance. This file contains batch system or
# operating system specific options, while the SharedConfiguration.pm
# the common settings. You should review both files.

# BSS/OS SPECIFIC CONFIGURATION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

# type of system (=1 machine with 1 node!)
$main::is_pvp = 0;    # Set to 1 if target is a PVP system

# Where to find the SGE commands used by the TSI

my $sge_dir = "/opt/gridengine/bin/lx26-x86";

$main::submit_cmd = "$sge_dir/qsub";

$main::abort_cmd =
  "$sge_dir/qdel ";    # delete a job from SGE, returning stdout/stderr
$main::cancel_cmd =
  "$sge_dir/qdel ";    # delete a job from SGE, deleting stdout/stderr

# Do we do anything in response to a hold?
$main::site_sez_no_holds = 1;    # 0 => holding allowed

$main::hold_cmd   = "$sge_dir/qhold";    # suspend execution of a batch job
$main::resume_cmd = "$sge_dir/qrls";     # resume execution of a batch job

$main::qstat_cmd =
  "$sge_dir/qstat -u '*'";    # show _all_ jobs on SGE submitted by TSI

# Try to determine the parallel environment to use for UNICORE jobs.
# This will just pick the first pe that is found, if this is not
# appropriate, manually set the value of $main::pe_name
my @pe_names = `$sge_dir/qconf -spl`;
die
  "No SGE parallel environment found! Please configure one or edit the file $0"
  unless ( $#pe_names > -1 );
chomp( my $first = $pe_names[0] );
$main::pe_name = $first;
die
  "No SGE parallel environment found! Please configure one or edit the file $0"
  if ( $first eq "" );
start_report(
"Setting SGE parallel environment to '$main::pe_name'. Please edit $0 if this is undesired!"
);

# The path from a setuid script is not the correct user path and
# this line should be enabled with a suitable path for user level
# scripts. This line is a minimal set and should be extended with
# any site specific values, particularly those needed for SGE to
# work correctly (note that "interesting" scripts are run in batch mode
# and so SGE should ensure that a proper environment is set for these.
# This line just needs to get the scripts into a batch subsystem.)
#
# Disabling this line may make the TSI user's PATH to some user tasks.
$ENV{PATH} = "/usr/bin";

$main::my_os = "Linux SGE";

# END OF CONFIGURATION <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

startup();

#
# 16-09-08 Bernd Schuller : updated using the patches from Nadya Williams UZH
# 08-11-01 Sven van den Berghe fecit Removed : from PATH (puts . in PATH, UQR128)
# 04-05-01 Sven van den Berghe fecit Created from 3.0 TSI for Unicore 3.5
#
#                  Copyright (c) Fujitsu Ltd 2000 - 2002
#
#     Use and distribution is subject to the Community Source Licence.
#
# Further information is available from www.unicore.org or arcon@fecit.co.uk.
#
