line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# |
2
|
|
|
|
|
|
|
# (c) Jan Gehring |
3
|
|
|
|
|
|
|
# |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package Rex::Batch; |
6
|
|
|
|
|
|
|
|
7
|
16
|
|
|
16
|
|
210
|
use v5.12.5; |
|
16
|
|
|
|
|
59
|
|
8
|
16
|
|
|
16
|
|
79
|
use warnings; |
|
16
|
|
|
|
|
47
|
|
|
16
|
|
|
|
|
622
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.14.3'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
16
|
|
|
16
|
|
83
|
use Rex::Logger; |
|
16
|
|
|
|
|
32
|
|
|
16
|
|
|
|
|
104
|
|
13
|
16
|
|
|
16
|
|
338
|
use Rex::TaskList; |
|
16
|
|
|
|
|
30
|
|
|
16
|
|
|
|
|
91
|
|
14
|
|
|
|
|
|
|
|
15
|
16
|
|
|
16
|
|
546
|
use vars qw(%batchs); |
|
16
|
|
|
|
|
21
|
|
|
16
|
|
|
|
|
5037
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub create_batch { |
18
|
1
|
|
|
1
|
0
|
3
|
my $class = shift; |
19
|
1
|
|
|
|
|
3
|
my $batch_name = shift; |
20
|
1
|
|
|
|
|
3
|
my $batch_desc = pop; |
21
|
1
|
|
|
|
|
6
|
my @task_names = @_; |
22
|
1
|
|
|
|
|
4
|
my $task_list = Rex::TaskList->create; |
23
|
|
|
|
|
|
|
|
24
|
1
|
|
|
|
|
29
|
for my $task_name (@task_names) { |
25
|
2
|
50
|
|
|
|
16
|
die "ERROR: no task: $task_name" |
26
|
|
|
|
|
|
|
unless $task_list->is_task($task_name); |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
1
|
|
|
|
|
11
|
$batchs{$batch_name} = { |
30
|
|
|
|
|
|
|
desc => $batch_desc, |
31
|
|
|
|
|
|
|
task_names => \@task_names |
32
|
|
|
|
|
|
|
}; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub get_batch { |
36
|
1
|
|
|
1
|
0
|
9
|
my $class = shift; |
37
|
1
|
|
|
|
|
3
|
my $batch_name = shift; |
38
|
|
|
|
|
|
|
|
39
|
1
|
|
|
|
|
10
|
return @{ $batchs{$batch_name}->{'task_names'} }; |
|
1
|
|
|
|
|
8
|
|
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub get_desc { |
43
|
0
|
|
|
0
|
0
|
0
|
my $class = shift; |
44
|
0
|
|
|
|
|
0
|
my $batch_name = shift; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
return $batchs{$batch_name}->{'desc'}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
sub get_batchs { |
50
|
1
|
|
|
1
|
0
|
8
|
my $class = shift; |
51
|
1
|
|
|
|
|
7
|
my @a = sort { $a cmp $b } keys %batchs; |
|
0
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub is_batch { |
55
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
56
|
0
|
|
|
|
|
|
my $batch_name = shift; |
57
|
|
|
|
|
|
|
|
58
|
0
|
0
|
|
|
|
|
if ( defined $batchs{$batch_name} ) { return 1; } |
|
0
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
return 0; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |