Adding the full JSV script (Perl):
#!/usr/bin/perl
#
######################################################
#
# JSV code for grid engine at Dialog
#
# Manfred Selz - Dialog Semiconductor GmbH - 04/2012-03/2016
#
# (for reference see also "$SGE_ROOT/util/resources/jsv/jsv.pl")
#
# Usage examples:
# o qsub -jsv ...
# o $HOME/.sge_request
# o $SGE_ROOT/$SGE_CELL/common/sge_request
# Also see "man jsv"!
#
######################################################
#
# Tasks:
# ====================================================
# o handling of LM_PROJECT
# o OS control (RHEL4/RHEL5/RHEL6)
# o new: set -P <project> if applicable
# o new: set mmtq resource for mmtoken jobs
# o new: flexible handling of RHEL5|6
#
######################################################
use strict;
use warnings;
no warnings qw/uninitialized/;
use Env qw(SGE_ROOT);
use lib "$SGE_ROOT/util/resources/jsv";
use JSV qw( :DEFAULT jsv_send_env jsv_log_info );
# my $sge_root = $ENV{SGE_ROOT};
# my $sge_arch = qx{$sge_root/util/arch};
jsv_on_start(sub {
# Leave this commented out...has problems on server-side JSV
#jsv_send_env();
});
jsv_on_verify(sub {
# setting of variables
my %params = jsv_get_param_hash();
my $do_ignore = 0;
my $rhel4 = 4;
my $rhel5 = 5;
my $rhel6 = 6;
my $rhel5or6 = '5|6';
my $os = $ENV{"RHEL_VER"};
my $myshort;
my $lmproject;
my $lmproject_first = ".";
my $lmproject_rest = ".";
my $project_defined;
my $mmtoken_set = 0;
my $incisive_set = 0;
# correct issue with resource "short" (which is for some reason set to
"short=0.000000", if set at all)
if(exists $params{l_hard}{short}) {
jsv_sub_del_param('l_hard', 'short');
jsv_sub_add_param('l_hard', 'short', '1');
#jsv_correct('Job was corrected - setting short to 1');
}
# test special resource for analog simulations
# (set if mmtoken is set, but short is not set)
if(exists $params{l_hard}{mmtoken}) {
$mmtoken_set = 1;
if(!exists $params{l_hard}{short}) {
if(!exists $params{l_hard}{local_placeholder}) {
jsv_sub_add_param('l_hard', 'mmtq', '1');
}
}
}
# test resource for digital simulations - incisive-xl resource
if(exists $params{l_hard}{'incisive-xl'}) {
$incisive_set = 1;
}
# if hard queue is defined, delete this (for default.q and short.q)
jsv_sub_del_param('q_hard', 'default.q');
jsv_sub_del_param('q_hard', 'short.q');
jsv_sub_del_param('q_hard', 'shortnightly.q');
jsv_sub_del_param('q_hard', 'local.q');
# modify the env. var. $LM_PROJECT (if set at all)
$lmproject = $ENV{"LM_PROJECT"};
# if ($lmproject =~ m/[A-Z]_(\w+)+/) {
if ($lmproject =~ m/[A-Z]_([a-zA-Z0-9\-]+)/) {
$lmproject_rest = $1;
$lmproject_first = substr($lmproject,0,1);
jsv_del_env("LM_PROJECT");
jsv_add_env("LM_PROJECT",$lmproject_first."SGE_".$lmproject_rest);
# jsv_log_info("modified LM_PROJECT");
}
# modify the -P <project> parameter if applicable;
# check if project is set (in LM_PROJECT) and available in SGE
if ($lmproject_rest eq ".") {
# jsv_log_info("LM_PROJECT not defined");
jsv_sub_add_param('P', "defProj");
} else {
# jsv_log_info("LM_PROJECT is ${lmproject_rest}");
# $project_defined = `qconf -sprjl | grep $lmproject_rest`;
$project_defined = `qconf -sprjl | grep $lmproject_rest | head -1`;
chomp($project_defined);
# jsv_log_info("defined project is ${project_defined}");
if ($lmproject_rest eq $project_defined) {
# jsv_log_info("project found - adding -P setting now");
jsv_sub_add_param('P', $project_defined);
} else {
# jsv_log_info("project not found");
jsv_sub_add_param('P', "defProj");
}
}
# check RHEL setting
# (note that this is currently predefined in global "sge_request"!)
if (exists $params{l_hard}{rhel}) {
$do_ignore = 1;
}
# proceed only if RHEL version has not been explicity specified
if ($do_ignore == 0) {
if ($os == 5) {
# if submission host OS is RHEL5:
# if ($mmtoken_set == 1 || $incisive_set == 1) {
if ($mmtoken_set == 1) {
# specify execution host as RHEL5 or RHEL6 for analog simulations
jsv_sub_add_param('l_hard','rhel',$rhel5or6);
jsv_correct('Job was corrected - setting RHEL to 5|6 (analog
simulation)');
} else {
# specify execution host as RHEL5 for all other jobs
jsv_sub_add_param('l_hard','rhel',$rhel5);
jsv_correct('Job was corrected - setting RHEL to 5');
}
} elsif ($os == 6) {
# if submission host OS is RHEL6, specify execution host as RHEL5 or
RHEL6
jsv_sub_add_param('l_hard','rhel',$rhel5or6);
jsv_correct('Job was corrected - setting RHEL to 5|6');
} elsif ($os == 4) {
# if submission host OS is RHEL4, specify that as execution host OS
requirement
jsv_sub_add_param('l_hard','rhel',$rhel4);
jsv_correct('Job was corrected - setting RHEL to 4 according to submit
host OS');
} else {
# if submission host OS is neither RHEL4 nor RHEL5 nor RHEL6, reject job
jsv_reject_wait('Job rejected - unknown OS version!')
}
} else {
jsv_accept('Job was accepted as it is');
}
});
jsv_main();
From: Manfred Selz
Sent: Montag, 13. Juni 2016 10:03
To: '[email protected]'
Subject: JSV stderr when running jsv_set_param with parameter 'P'
Hello everybody,
I am having a very odd issue with a JSV script on SGE 6.2u5.
Since a long time ago, I have been running a standard server JSV script to
check and set a few parameters, one of them being the project (parameter P).
What the server JSV script does, is (amongst lots of other stuff) to run this:
jsv_sub_add_param('P', "defProj");
(if not project is set)
While this still works fine, whenever I copy this script and run it manually on
client side like this:
qsub -jsv $SGE_ROOT/$SGE_CELL/common/jsv.perl -b y -N test1 sleep 10
I get this message:
error: JSV stderr: Can't use string ("defProj") as a HASH ref while "strict
refs" in use at /cad/eda/sge/6.2u5/util/resources/jsv/JSV.pm line 327, <> line
15.
Unable to run job: JSV stderr: Can't use string ("defProj") as a HASH ref while
"strict refs" in use at /cad/eda/sge/6.2u5/util/resources/jsv/JSV.pm line 327,
<> line 15.
JSV stderr is - Can't use string ("defProj") as a HASH ref while "strict refs"
in use at /cad/eda/sge/6.2u5/util/resources/jsv/JSV.pm line 327, <> line 15..
Exiting.
(I have tried to use different project names, existing and non existing ones)
Until a few days ago, this has also been working on client side, and this is
how I usually test my JSV scripts.
I have been trying to replace "jsv_sub_add_param" with "jsv_set_param" like
this:
jsv_set_param('P','cadtest');
with no success (same error message). Setting other parameters works fine, such
as:
jsv_set_param('N','cadtest');
Any ideas?
Best regards,
Manfred Selz
________________________________
Dialog Semiconductor GmbH
Neue Str. 95
D-73230 Kirchheim
Managing Directors: Dr. Jalal Bagherli, Carsten Dahl
Chairman of the Supervisory Board: Rich Beyer
Commercial register: Amtsgericht Stuttgart: HRB 231181
UST-ID-Nr. DE 811121668
Legal Disclaimer: This e-mail communication (and any attachment/s) is
confidential and contains proprietary information, some or all of which may be
legally privileged. It is intended solely for the use of the individual or
entity to which it is addressed. Access to this email by anyone else is
unauthorized. If you are not the intended recipient, any disclosure, copying,
distribution or any action taken or omitted to be taken in reliance on it, is
prohibited and may be unlawful.
Please consider the environment before printing this e-mail
_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users