Changeset e5ded116dbf8a4f73f0c6b5413b8f165f1d54285 in xas


Ignore:
Timestamp:
08/05/15 09:59:53 (2 years ago)
Author:
Kevin L. Esteb <kevin@…>
Branches:
master
Children:
3aa185bfecd34f5a0f526297df835f6484df31ac
Parents:
96f11eb731229de55299aa08ec81c182fd951cfe
git-author:
Kevin L. Esteb <kevin@…> (08/05/15 09:59:53)
git-committer:
Kevin L. Esteb <kevin@…> (08/05/15 09:59:53)
Message:

Updating documentation

Location:
trunk/lib/XAS/Lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/XAS/Lib/Batch.pm

    r257f9c4820af6bba0913ce5e778c40481ef55c05 re5ded116dbf8a4f73f0c6b5413b8f165f1d54285  
    6666=head1 NAME 
    6767 
    68 XAS::xxx - A class for the XAS environment 
     68XAS::Lib::Batch - A class for the XAS environment 
    6969 
    7070=head1 SYNOPSIS 
    7171 
    72  use XAS::XXX; 
     72 use XAS::Class 
     73   version => '0.01', 
     74   base    => 'XAS::Lib::Batch' 
     75 ; 
    7376 
    7477=head1 DESCRIPTION 
    7578 
     79This is a class for accessing a batch system. Batch systems are a controlled 
     80way to run jobs in the background. Depending on how the batch system is 
     81setup you may have access to hundreds of systems to run jobs on. These jobs  
     82can then controlled by issuing commads against the batch system. This module  
     83encapsulates those commands into Perl objects and methods.  
     84 
     85There is apparently a standardized command line interface to these batch 
     86systems. This module also helps to abstract some of the differences between  
     87those standardized commands. Because if you work in this business long enough 
     88you get to know what "standardized" really means. 
     89 
     90Since this is Perl and you are loading a mixin. You could access the mixin 
     91methods directly. But it is advisable to use the pre-defined classes to help  
     92with parameter checking and exception handling. 
     93 
    7694=head1 METHODS 
    7795 
    78 =head2 method1 
     96=head2 new 
     97 
     98This initializes the class and takes these parameters: 
     99 
     100=over 4 
     101 
     102=item B<-interface> 
     103 
     104This defines the interface to load. It defaults to L<XAS::Lib::Batch::Interface::Torque|XAS::Lib::Batch::Interface::Torque>. 
     105 
     106=back 
     107 
     108=head2 do_cmd($command) 
     109 
     110This method will run a command and capture its output. If an non zero return 
     111code is detected, it will throw an exception with that return code and the  
     112first line returned on STDOUT. 
     113 
     114=over 4 
     115 
     116=item B<$command> 
     117 
     118The command to execute in the background using Perl's backtick function. 
     119 
     120=back 
    79121 
    80122=head1 SEE ALSO 
     
    92134=head1 COPYRIGHT AND LICENSE 
    93135 
    94 Copyright (c) 2014 Kevin L. Esteb 
     136Copyright (c) 2015 Kevin L. Esteb 
    95137 
    96138This is free software; you can redistribute it and/or modify it under 
  • trunk/lib/XAS/Lib/Batch/Job.pm

    r257f9c4820af6bba0913ce5e778c40481ef55c05 re5ded116dbf8a4f73f0c6b5413b8f165f1d54285  
    99  constants => 'DELIMITER', 
    1010  constant => { 
    11     TYPES  => qr/user|other|system|,|\s/, 
     11    TYPES  => qr/user|other|system|none|,|\s/, 
     12    JTYPES => qr/oe|eo|n|,|\s/, 
    1213  } 
    1314; 
     
    148149} 
    149150 
     151sub qalter { 
     152    my $self = shift; 
     153    my $p = $self->validate_params(\@_, { 
     154        -job         => 1, 
     155        -jobname     => { optional => 1, default => undef }, 
     156        -rerunable   => { optional => 1, default => undef }, 
     157        -email       => { optional => 1, default => undef }, 
     158        -account     => { optional => 1, default => undef }, 
     159        -attributes  => { optional => 1, default => undef }, 
     160        -exclusive   => { optional => 1, default => undef }, 
     161        -resources   => { optional => 1, default => undef }, 
     162        -user        => { optional => 1, default => undef }, 
     163        -host        => { optional => 1, default => undef }, 
     164        -mail_points => { optional => 1, default => undef }, 
     165        -shell_path  => { optional => 1, default => undef }, 
     166        -hold        => { optional => 1, default => undef, regex => TYPES },  
     167        -join_path   => { optional => 1, default => undef, regex => JTYPES }, 
     168        -after       => { optional => 1, default => undef, isa => 'DateTime' }, 
     169        -out_path    => { optional => 1, default => undef, isa => 'Badger::Filesystem::File' }, 
     170        -error_path  => { optional => 1, default => undef, isa => 'Badger::Filesystem::File' }, 
     171        -priority    => { optional => 1, default => 0, callbacks => { 
     172            'out of priority range' => 
     173            sub { $_[0] > -1024 && $_[0] < 1024; }, 
     174        }} 
     175    }); 
     176 
     177    return $self->do_qalter($p); 
     178 
     179} 
     180 
    150181# ---------------------------------------------------------------------- 
    151182# Private Methods 
     
    158189=head1 NAME 
    159190 
    160 XAS::xxx - A class for the XAS environment 
     191XAS::Lib::Batch::Job - A class for the XAS environment 
    161192 
    162193=head1 SYNOPSIS 
    163194 
    164  use XAS::XXX; 
     195 use XAS::Lib::Batch::Job; 
     196 
     197 my $batch = XAS::Lib::Batch::Job->new(); 
     198 
     199 my $id = $batch->qsub(...); 
     200  
     201 printf("job %s has started\n", $id); 
     202 
     203 while (my $stat = $batch->qstat(-job => $id)) { 
     204 
     205     if ($stat->{job_state} eq 'C') { 
     206 
     207         printf("job %s has finished\n", $id); 
     208 
     209     } 
     210 
     211     sleep 10; 
     212 
     213 } 
    165214 
    166215=head1 DESCRIPTION 
     
    176225=item L<XAS|XAS> 
    177226 
     227=item L<XAS::Lib::Batch|XAS::Lib::Batch> 
     228 
    178229=back 
    179230 
     
    184235=head1 COPYRIGHT AND LICENSE 
    185236 
    186 Copyright (c) 2014 Kevin L. Esteb 
     237Copyright (c) 2015 Kevin L. Esteb 
    187238 
    188239This is free software; you can redistribute it and/or modify it under 
Note: See TracChangeset for help on using the changeset viewer.