blib/lib/XAS/Lib/Batch/Queue.pm untested

filter: Statementstmt 0.0% 0 / 14 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 3 totaltotal 0.0% 0 / 21 CC 1 SCAR 6.9
CC
1
Cov
0%
qstat
2.0
qstart
2.0
qstop
2.0
CRAP 2.0
1 package XAS::Lib::Batch::Queue;
2  
3 our $VERSION = '0.01';
4  
5 use XAS::Class
6 debug => 0,
7 version => $VERSION,
8 base => 'XAS::Lib::Batch',
9 ;
10  
11 # ----------------------------------------------------------------------
12 # Public Methods
13 # ----------------------------------------------------------------------
14  
15 sub qstat {
16 my $self = shift;
17 my $p = $self->validate_params(\@_, {
18 -queue => { optional => 1, default => undef },
19 -host => { optional => 1, default => undef },
20 });
21  
22 return $self->do_queue_stat($p);
23  
24 }
25  
26 sub qstart {
27 my $self = shift;
28 my $p = $self->validate_params(\@_, {
29 -queue => { optional => 1, default => undef },
30 -host => { optional => 1, default => undef },
31 });
32  
33 return $self->do_queue_start($p);
34  
35 }
36  
37 sub qstop {
38 my $self = shift;
39 my $p = $self->validate_params(\@_, {
40 -queue => { optional => 1, default => undef },
41 -host => { optional => 1, default => undef },
42 });
43  
44 return $self->do_queue_stop($p);
45  
46 }
47  
48 # ----------------------------------------------------------------------
49 # Private Methods
50 # ----------------------------------------------------------------------
51  
52 1;
53  
54 __END__
55  
56 =head1 NAME
57  
58 XAS::Lib::Batch::Queue - A class for the XAS environment
59  
60 =head1 SYNOPSIS
61  
62 use XAS::Lib::Batch::Queue;
63  
64 my $queue = XAS::Lib::Batch::Queue->new();
65  
66 $queue->qstop(-queue => 'batch');
67  
68 ...
69  
70 $queue->qstart(-queue => 'batch');
71  
72 =head1 DESCRIPTION
73  
74 This module provides an interface for manipulating queues in a Batch System.
75 Each available method is a wrapper around a given command. A command line
76 is built, executed, and the return code is checked. If the return code is
77 non-zero an exception is thrown. The exception will include the return code
78 and the first line from stderr.
79  
80 Since each method is a wrapper, there is a corresponding man page for the
81 actual command. They should also be checked when problems arise.
82  
83 =head1 METHODS
84  
85 =head2 new
86  
87 This method initializes the module and takes these parameters:
88  
89 =over 4
90  
91 =item B<-interface>
92  
93 The command line interface to use. This defaults to 'XAS::Lib::Batch::Interface::Torque'.
94  
95 =back
96  
97 =head2 qstat(...)
98  
99 This method returns that status of a queue. This status will be a hash reference
100 of the parsed output on stdout. It takes the following paramters:
101  
102 =over 4
103  
104 =item B<-queue>
105  
106 The name of the queue.
107  
108 =item B<-host>
109  
110 The optional host that the queue may be on.
111  
112 =back
113  
114 =head2 qstart(...)
115  
116 This method start a queue. It takes the following paramters:
117  
118 =over 4
119  
120 =item B<-queue>
121  
122 The name of the queue.
123  
124 =item B<-host>
125  
126 The optional host that the queue may be on.
127  
128 =back
129  
130 =head2 qstop(...)
131  
132 This method will stop a queue. It takes the following paramters:
133  
134 =over 4
135  
136 =item B<-queue>
137  
138 The name of the queue.
139  
140 =item B<-host>
141  
142 The optional host that the queue may be on.
143  
144 =back
145  
146  
147 =head1 SEE ALSO
148  
149 =over 4
150  
151 =item L<XAS::Lib::Batch|XAS::Lib::Batch>
152  
153 =item L<XAS|XAS>
154  
155 =back
156  
157 =head1 AUTHOR
158  
159 Kevin L. Esteb, E<lt>kevin@kesteb.usE<gt>
160  
161 =head1 COPYRIGHT AND LICENSE
162  
163 Copyright (c) 2015 Kevin L. Esteb
164  
165 This is free software; you can redistribute it and/or modify it under
166 the terms of the Artistic License 2.0. For details, see the full text
167 of the license at http://www.perlfoundation.org/artistic_license_2_0.
168  
169 =cut