Thanks, Bergman.



-Noel Benitez, Salk iT Dept.


-----Original Message-----
From: berg...@merctech.com [mailto:berg...@merctech.com] 
Sent: Monday, May 07, 2018 11:28 AM
To: Noel Benitez <nbeni...@salk.edu>
Subject: Re: [gridengine users] How do I use JSV to check for h_vmem and h_rt?

In the message dated: Mon, 07 May 2018 18:02:30 -0000, The pithy ruminations 
from Noel Benitez on [[gridengine users] How do I use JSV to check for h_vmem 
and h_rt?] were:
=> Hi all.
=>
=> If using perl to create a jsv script, what is the perl command to check => 
if both h_vmem and h_rt are specified and if the values are within a => certain 
range?

We don't use h_rt, but here's a perl example of some of what we do with h_vem:

------------------------
#!/usr/bin/perl

use strict;
use warnings;
use Data::Dumper;
use Storable;

my $SGE_ROOT=$ENV{SGE_ROOT};
if ( $SGE_ROOT =~ /^\s*$/ )
{
        printf "Missing SGE_ROOT environment variable.\n";
        exit 1;
}

if ( ! -d $SGE_ROOT )
{
        printf "No such directory \"$SGE_ROOT\" (\$SGE_ROOT)\n";
        exit 1;
}

use lib "$ENV{SGE_ROOT}/util/resources/jsv";
use JSV qw( :DEFAULT jsv_add_env jsv_show_params jsv_send_env jsv_log_info );

        my $HVMEMDEF=4; # 4GB default for h_vmem
        my $adjusted_hvmem=0;
        my $orig_hvmem;
        my $unit;
        if ((exists $params{l_hard}{h_vmem})) {
                $orig_hvmem=$params{l_hard}{h_vmem};
                $unit=$orig_hvmem;
                $unit=~s/^[0-9\.]*//;   # last char in the string
                $orig_hvmem=~s/$unit$//;
                if ( $unit =~ /g/i && $orig_hvmem > $HVMEMDEF * 5 ) 
                {
                        # the job is requesting more than 5x the default 
memory...set an advance reservation
                        jsv_set_param('R','y');
                         ## jsv_log_info ('Adding resource reservation due to 
high memory request ($params{l_hard}{hvmem}).');
                }
        }
        else
        {
                $adjusted_hvmem=$HVMEMDEF;
        }
------------------------

=>
=> I apologize if I'm not a perl script programmer. Something simple should => 
do it.
=>
=> Thank you so much for any help.
=>
=>
=>
=>
=> -Noel Benitez, Salk iT Dept.
=>
=>
=>
=>
=> _______________________________________________
=> users mailing list
=> users@gridengine.org
=> https://gridengine.org/mailman/listinfo/users
=> 

_______________________________________________
users mailing list
users@gridengine.org
https://gridengine.org/mailman/listinfo/users

Reply via email to