Am 17.06.2014 um 15:46 schrieb Txema Heredia:
> Hi all,
>
> I am trying to create a JSV that detects whenever a user submits a QLOGIN
> job, and forces a h_rt timelimit if they requested none.
>
> The JSV goes as follows:
>
> ---------------
> # cat /opt/gridengine/default/common/jsv.pl
>
> #!/bin/env perl
>
> use strict;
> use warnings;
> no warnings qw/uninitialized/;
>
> use Env qw(SGE_ROOT);
> use lib "$SGE_ROOT/util/resources/jsv";
> use JSV qw( :ALL jsv_show_params jsv_send_env jsv_log_info );
> use Data::Dumper;
> use Storable;
> use POSIX qw(ceil);
>
> jsv_on_start(sub {
> jsv_send_env();
> });
>
> jsv_on_verify(sub {
>
> jsv_log_warning ("INITIAL");
> jsv_show_params();
>
> # CHECK if is a QLOGIN and if it has defined a time limit. Force a limit
> and show a message.
>
> if (jsv_is_param('CLIENT') ) {
> my $cli = jsv_get_param('CLIENT');
> jsv_log_warning ("CLIENT = $cli");
> if ($cli eq 'qlogin') {
> jsv_log_warning ("QLOGIN");
> if (!jsv_sub_is_param('l_hard','h_rt') &&
> !jsv_sub_is_param('l_hard','s_rt')) {
> jsv_sub_add_param('l_hard','h_rt','02:00:00');
> jsv_log_warning ("\n");
> jsv_log_warning
> ("\t\x1b\x5b1;31;49m#################################################\x1b\x5b0;39;49m");
> jsv_log_warning ("\t\x1b\x5b1;31;49m#\t\t* W A R N I N G
> *\t\t\x1b\x5b1;31;49m#\x1b\x5b0;39;49m");
> jsv_log_warning
> ("\t\x1b\x5b1;31;49m#################################################\x1b\x5b0;39;49m");
>
> blah, blah, blah
>
> jsv_log_warning
> ("\t\x1b\x5b1;31;49m#################################################\x1b\x5b0;39;49m");
> jsv_log_warning ("\n");
> }
> }
> }
>
> # check if requested a queue. If not, force -q all.q
>
> if (!jsv_is_param('q_hard')) {
> jsv_sub_add_param('q_hard','all.q');
> }
>
> # force core binding
> my $binding=0;
> if (jsv_is_param('pe_name')) {
> if (jsv_is_param('pe_max')) {
> $binding=jsv_get_param('pe_max');
> } else{
> $binding=1;
> }
> } else {
> $binding=1;
> }
> jsv_set_param('binding_type','set');
> jsv_set_param('binding_strategy','linear');
> jsv_set_param('binding_amount',$binding);
>
> # accept job
> jsv_correct("");
> });
>
> jsv_main();
>
> ------------
>
>
> Basically, the JSV checks the CLIENT parameter. If it is equal to "qlogin",
> then checks if there is any h_rt, and sets a limit on 2h:10min if there is
> none, while showing a colorful warning message to the user so they know that
> there is a time limit.
> Then, it also sets all.q as a hard queue if there is none (or *) and also
> sets the core binding policy.
>
> This works wonders when I run it as a client jsv by using "qlogin -jsv
> /opt/gridengine/default/common/jsv.pl". The message appears, the limit is
> set, and the job runs fine.
>
> But, once I set this as a server JSV (by qconf -mconf global), the time limit
> no longer applies.
>
> As far as I've been able to find the following behaviours differ from running
> it as client or server jsv:
>
> - The 'CLIENT' parameter changed, from 'qlogin' to 'qmaster'. This skips all
> my "if" in the jsv and stops checking for time limits. Can I trust this? Why
> is this 'qmaster' appearing? Now both qsub's and qlogin's show the same
> command. How can I distinguish them?
I found the same:
http://gridengine.org/pipermail/users/2012-September/004808.html
You can check for QRSH_PORT port according to William's post.
> - The jsv_show_params() command shows nothing. Neither on stdout nor in
> /opt/gridengine/default/spool/qmaster/messages This makes debugging really
> cumbersome
For me it's working, being it Bash or Perl.
06/17/2014 17:13:30|worker|pc15370|I|got param: A='sge'
06/17/2014 17:13:30|worker|pc15370|I|got param: GROUP='users'
06/17/2014 17:13:30|worker|pc15370|I|got param: N='test.sh'
06/17/2014 17:13:30|worker|pc15370|I|got param: CMDNAME='test.sh'
06/17/2014 17:13:30|worker|pc15370|I|got param: CMDARGS='0'
06/17/2014 17:13:30|worker|pc15370|I|got param: JOB_ID='11553'
06/17/2014 17:13:30|worker|pc15370|I|got param: M='reuti@pc15370'
06/17/2014 17:13:30|worker|pc15370|I|got param: CLIENT='qmaster'
06/17/2014 17:13:30|worker|pc15370|I|got param: VERSION='1.0'
06/17/2014 17:13:30|worker|pc15370|I|got param: USER='reuti'
06/17/2014 17:13:30|worker|pc15370|I|got param: CONTEXT='server'
> - No message can be sent to the user. Being it info, warning or error. The
> user won't know if I have set a time limit to his session
Yep, only for "jsv_reject_wait" a message can be displayed. Despite the fact
that also for "jsv_correct" and "jsv_accept" a message can be specified too.
-- Reuti
> - The queue and binding parts work fine.
>
>
> So, why is my 'client' parameter different? How can I debug it? How can I
> send a message to the user?
> Should I change any of the "use something" at the beginning of my jsv? (I
> copied them from another perl jsv on the internet)
>
> Thanks in advance,
>
> Txema
>
> _______________________________________________
> users mailing list
> [email protected]
> https://gridengine.org/mailman/listinfo/users
_______________________________________________
users mailing list
[email protected]
https://gridengine.org/mailman/listinfo/users