| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# See copyright, etc in below POD section. |
|
2
|
|
|
|
|
|
|
###################################################################### |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Schedule::Load::ResourceReq; |
|
5
|
|
|
|
|
|
|
require 5.004; |
|
6
|
1
|
|
|
1
|
|
7
|
use Schedule::Load; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
45
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Sys::Hostname; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
46
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
42
|
|
|
10
|
1
|
|
|
1
|
|
5
|
use vars qw($VERSION $AUTOLOAD $Debug); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
71
|
|
|
11
|
1
|
|
|
1
|
|
5
|
use Carp; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
471
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
###################################################################### |
|
14
|
|
|
|
|
|
|
#### Configuration Section |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
$VERSION = '3.064'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
###################################################################### |
|
19
|
|
|
|
|
|
|
#### Creators |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
|
22
|
4
|
|
|
4
|
1
|
17
|
my $proto = shift; |
|
23
|
4
|
|
33
|
|
|
29
|
my $class = ref($proto) || $proto; |
|
24
|
4
|
|
|
|
|
19
|
my $self = {allow_reserved=>0, # Passed to Host::host_match |
|
25
|
|
|
|
|
|
|
classes=>[], # Passed to Host::host_match |
|
26
|
|
|
|
|
|
|
favor_host=>hostname(), |
|
27
|
|
|
|
|
|
|
match_cb=>undef, # Passed to Host::host_match |
|
28
|
|
|
|
|
|
|
max_jobs=> -1, # Whole clump |
|
29
|
|
|
|
|
|
|
jobs_running=>undef, |
|
30
|
|
|
|
|
|
|
rating_cb=>undef, |
|
31
|
|
|
|
|
|
|
@_,}; |
|
32
|
4
|
|
|
|
|
55
|
bless $self, $class; |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Add class_ prefix (to be back compatible with prev versions) |
|
35
|
4
|
|
|
|
|
13
|
my @classes = (); |
|
36
|
4
|
|
|
|
|
7
|
foreach (@{$self->{classes}}) { |
|
|
4
|
|
|
|
|
19
|
|
|
37
|
0
|
0
|
|
|
|
0
|
push @classes, (($_ =~ /^class_/)?$_:"class_$_"); |
|
38
|
|
|
|
|
|
|
} |
|
39
|
4
|
|
|
|
|
11
|
$self->{classes} = \@classes; |
|
40
|
|
|
|
|
|
|
|
|
41
|
4
|
50
|
|
|
|
15
|
print "new ResourceReq=", Data::Dumper::Dumper ($self) if $Debug; |
|
42
|
|
|
|
|
|
|
|
|
43
|
4
|
|
|
|
|
14
|
return $self; |
|
44
|
|
|
|
|
|
|
} |
|
45
|
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
sub set_fields { |
|
47
|
4
|
|
|
4
|
0
|
10
|
my $self = shift; |
|
48
|
4
|
|
|
|
|
39
|
my %params = (@_); |
|
49
|
4
|
|
|
|
|
7
|
foreach my $key (keys %{$self}) { |
|
|
4
|
|
|
|
|
18
|
|
|
50
|
28
|
100
|
|
|
|
355
|
$self->{$key} = $params{$key} if exists $params{$key}; |
|
51
|
|
|
|
|
|
|
} |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
###################################################################### |
|
55
|
|
|
|
|
|
|
#### Special accessors |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
###################################################################### |
|
59
|
|
|
|
|
|
|
#### Accessors |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
62
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
63
|
0
|
0
|
|
|
|
|
my $type = ref($self) or croak "$self is not an ".__PACKAGE__." object"; |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
|
(my $field = $AUTOLOAD) =~ s/.*://; # Remove package |
|
66
|
0
|
0
|
|
|
|
|
if (exists ($self->{$field})) { |
|
67
|
0
|
|
|
|
|
|
eval "sub $field { return \$_[0]->{$field}; }"; |
|
68
|
0
|
|
|
|
|
|
return $self->{$field}; |
|
69
|
|
|
|
|
|
|
} else { |
|
70
|
0
|
|
|
|
|
|
croak "$type->$field: Unknown ".__PACKAGE__." field $field"; |
|
71
|
|
|
|
|
|
|
} |
|
72
|
|
|
|
|
|
|
} |
|
73
|
0
|
|
|
0
|
|
|
sub DESTROY {} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
###################################################################### |
|
76
|
|
|
|
|
|
|
###################################################################### |
|
77
|
|
|
|
|
|
|
1; |
|
78
|
|
|
|
|
|
|
__END__ |