PlatformISV > LSF-Base > LSF::Base

Download:
LSF_PERL_API/LSF-Base-0.06.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.06   Source  

NAME ^

LSF::Base - Object oriented Perl extension for use with the Platform Computing Corporation's Load Sharing Facility (LSF) Base product.

SYNOPSIS ^

  use LSF::Base;
  
  $base = new LSF::Base;
  
  #Cluster configuration

  $info = $base->info or die $@;

  @resources = $info->resTable;
  $res = $resources[0];

  $name  = $res->name;
  $desc  = $res->des;
  $vt    = $res->valueType; # 0,1,2 (BOOLEAN, NUMERIC, STRING)
  $ot    = $res->orderType; # 0,1,2 (INCR, DECR, NA)
  $flags = $res->flags; # RESF_BUILTIN | RESF_*
  $int   = $res->interval; #seconds

  @types   = $info->hostTypes
  @models  = $info->hostModels;
  @archs   = $info->hostArchs;
  @narch   = $info->modelRefs;
  @factors = $info->cpuFactor;
  $n_index = $info->numIndx;
  $n_usr   = $info->numUsrIndx;

  $myhost = $base->getmyhostname;

  $cluster = $base->getclustername;

  $master  = $base->getmastername($cluster);

  $type    = $base->gethosttype($host);

  $model   = $base->gethostmodel($host);

  $factor  = $base->gethostfactor($host);

  $factor  = $base->getmodelfactor($model);

  @hosts = qw(skynet alpha60 wopr ghostwheel);

  # passing in @hosts restricts the results to the listed
  # hosts. 
  @hostinfo = $base->gethostinfo($resreq, \@hosts, $options);

  #return information on all hosts.
  @hostinfo = $base->gethostinfo($resreq, NULL, $options);

  $hi = $hostinfo[0];

  $name      = $hi->hostName;
  $type      = $hi->hostType;
  $model     = $hi->hostModel;
  $factor    = $hi->cpuFactor;
  $max_cpus  = $hi->maxCpus;
  $max_mem   = $hi->maxMem;
  $max_swap  = $hi->maxSwap;
  $max_tmp   = $hi->maxTmp;
  $ndisks    = $hi->nDisks;
  @resources = $hi->resources;
  $windows   = $hi->windows;
  @threshold = $hi->busyThreshold;
  $is_server = $hi->isServer;
  $licensed  = $hi->licensed;
  $rex_pri   = $hi->rexPriority;
  $lic_feat  = $hi->licFeaturesNeeded;

  @params = qw( LSF_SERVERDIR LSF_CONFDIR LSF_SERVER_HOSTS ); # ...
  %env = $base->readconfenv(\@params, $ENV{LSF_ENVDIR});

  #load information and placement functions

  @hostload = $base->load($resreq, $numhosts, $options, $fromhost );
 
  @hostload = $base->loadofhosts( $resreq, $numhosts, $options, $fromhost, \@hosts);

  $hl = $hostload[0];

  $name = $hl->hostName;
  @status = $hl->status

  $bool = ISUNAVAIL(\@status);
  $bool = ISBUSY(\@status);
  $bool = ISBUSYON(\@status,$index);
  $bool = ISLOCKEDU(\@status);
  $bool = ISLOCKEDW(\@status);
  $bool = ISLOCKED(\@status);
  $bool = ISRESDOWN(\@status);
  $bool = ISSBDDOWN(\@status);
  $bool = ISUNLICENSED(\@status);
  $bool = ISOK(\@status);
  $bool = ISOKNRES(\@status);
 
  @where = $base->placereq( $resreq, $number, $options, $fromhost);
  @where = $base->placeofhosts( $resreq, $number, $options, $fromhost, \@hosts);
  
  $place{alpha60} = 3;
  $place{skynet} = 2;

  $base->loadadj($resreq, \%place) or die $@;

  #Task list manipulation

  $resreq = $base->resreq($task);

  ($bool, $resreq) = $base->eligible($task, $mode);

  $base->insertrtask($task);

  $base->insertltask($task);

  $base->deletertask($task);

  $base->deleteltask($task);

  @remote = $base->listrtask($sortflag);

  @local = $base->listltask($sortflag);

  # Remote Execution and task control functions

  $ports = $base->initrex($numports, $options); # or KEEPUID

  $base->ls_connect($hostname) or die $@;

  $bool = base->isconnected($hostname);

  @connections = $base->findmyconnections;

  $base->rexecv($host, \@argv, $options) or die $@;

  $base->rexecve($host, \@argv, $options, \@env) or die $@;
  
  $tid = $base->rtask($host, \@argv, $options);

  $tid = $base->rtaske($host, \@argv, $options, \@env);

  ($tid, $ru) = $base->rwait($options);
  $status = $?;

  $ru = $base->rwaittid($tid, $options);
  $status = $?;
 
  $u_sec = $ru->utime_sec;
  $u_usec = $ru->utime_usec;
  $s_sec = $ru->stime_sec;
  $s_usec = $ru->stime_usec;
  $maxrss = $ru->maxrss;
  $ixrss = $ru->ixrss;
  $idrss = $ru->idrss;
  $minflt = $ru->minflt;
  $majflt = $ru->majflt;
  $nswap = $ru->nswap;
  $inblock = $ru->inblock;
  $outblock = $ru->outblock;
  $msgsnd = $ru->msgsnd;
  $msgrcv = $ru->msgrcv;
  $nsignals = $ru->nsignals;
  $nvcsw = $ru->nvcsw;
  $nivcsw = $ru->nivcsw;

  $base->rkill($tid, $signal) or die $@;

  $base->rsetenv($host, \@env) or die $@;

  $base->chdir($host, $path) or die $@;

  $base->stdinmode($remote) or die $@;

  @tids = $base->getstdin($on, $max);

  $base->setstdin($on, \@tids) or die $@;

  $base->stoprex or die $@;

  $base->donerex or die $@;

  $socket = ls_conntaskport($tid);

  # Remote file operations

  $rfd = $base->ropen($host, $filename, $flags, $mode) or die $@;

  $base->rclose($rfd) or die $@;

  $bytes = $base->rwrite($rfd, $buf, $len);
  
  $bytes = $base->rread($rfd, $buf, $len );

  $offset = $base->rlseek($rfd, $offset, $whence );

  @stat = $base->rfstat(rfd);

  @stat = $base->rstat($host, $path);

  $host = $base->getmnthost($file);

  $host = $base->rgetmnthost($host, $file);

  $base->rfcontrol(RF_CMD_MAXHOSTS, $max);
  $base->rfcontrol(RF_CMD_TERMINATE, $hostname) or die $@;

  $base->lockhost($duration) or die $@;

  $base->unlockhost() or die $@;

  $base->limcontrol($hostname, $opcode) or die $@;

  $base->rescontrol($hostname, $opcode, $data) or die $@;

  $base->perror($message);

  $base->sysmsg;

  $base->errno;
  
  $base->errlog(FILE, $msg);

  $base->fdbusy($fd);

DESCRIPTION ^

LSF Base provides basic load sharing functionality consisting of the following services: Cluster configuration information, Load information and placement advice, Task list manipulation, Remote execution and task control, Remote file operations, Administration, and Error handling.

This library is designed to be used with LSF version 7.0 Update 2. Please see the "LSF Programmer's guide" and the LSF man pages for detailed documentation of this API.

The data structures used in the API have been wrapped in Perl objects for ease of use. The functions set $@ and $? where appropriate, or you can use the lserrno, sysmsg, and perror functions if you want.

The perl version of this API has been modified to some extent to act more "perlish" than the straightforward C API. For instance, return values have been changed to more closely match what a Perl programmer expects from a function. Other deviations from the original are noted in the documentation.

AUTHOR ^

Paul Franceus, Capita Technologies, Inc., paul@capita.com

Modifier ^

ISV Team, Platform Computing Corporation, support@platform.com

SEE ALSO ^

perl(1). LSF::Batch LSF Programmer's guide lslib(3) LSF man pages for each function.

syntax highlighting: