[GE users] JSV - Server-Side example script - enforce runlimits

elauzier elauzier2 at perlstar.com
Sun Dec 13 17:44:43 GMT 2009


Here is a script that I have been experimenting with to enforce wallclock time for projects.  It's a server-side script and is works well as long as the jsv_send_env() function is commented out...

The JSV is a great feature, similar to the esub in LSF.

Not many examples out there yet, hopefully this will help.  Comments welcome...
=======================================

#!/usr/bin/perl
#
######################################################
#
# Modified from original SGE 6.2u4  example jsv.pl code...
# Example Server Side JSV
# Ed Lauzier  December 2009
# Tested on SGE 6.2u4
#
######################################################

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 {
   my %params = jsv_get_param_hash();
   my $do_correct = 0;
   my $do_wait = 0;

##########################################################
# Project runtime limit enforcement
# Keep it simple...In this example, only wallclock time...
# SGE JSV config by default does not allow users to
# qalter l_hard, so this is great to enforce runlimits...
##########################################################

   my $vshort_rt_limit 	= 900;    #  15 minutes
   my $short_rt_limit 	= 3600;   #   1 hour
   my $normal_rt_limit 	= 28800;  #   8 hours
   my $long_rt_limit 	= 86400;  #  24 hours 

   if($params{P} eq 'vshort') {
        jsv_sub_add_param('l_hard','h_rt',$vshort_rt_limit);
        $do_correct = 1;
   }

   if($params{P} eq 'short') {
        jsv_sub_add_param('l_hard','h_rt',$short_rt_limit);
        $do_correct = 1;
   }

   if($params{P} eq 'normal') {
        jsv_sub_add_param('l_hard','h_rt',$normal_rt_limit);
        $do_correct = 1;
   }

   if($params{P} eq 'long') {
        jsv_sub_add_param('l_hard','h_rt',$normal_rt_limit);
        $do_correct = 1;
   }

####################################################

   if ($do_wait) {
      jsv_reject_wait('Job is rejected. It might be submitted later.');
   } elsif ($do_correct) {
      jsv_correct('Job was modified before it was accepted');
   } else {
      jsv_accept('Job is accepted');
   }
});

jsv_main();

===================================

------------------------------------------------------
http://gridengine.sunsource.net/ds/viewMessage.do?dsForumId=38&dsMessageId=233100

To unsubscribe from this discussion, e-mail: [users-unsubscribe at gridengine.sunsource.net].



More information about the gridengine-users mailing list