File tree 2 files changed +48
-21
lines changed
2 files changed +48
-21
lines changed Original file line number Diff line number Diff line change
1
+ package Stresseaux ;
2
+
3
+ my %running = ();
4
+
5
+ sub start
6
+ {
7
+ my ($id , $workload , $cluster ) = @_ ;
8
+ print (" start stress $id : workload $workload , cluster $cluster \n " );
9
+
10
+ if (exists $running {$id })
11
+ {
12
+ print (" cannot start stress $id : that id has already been taken\n " );
13
+ return 0;
14
+ }
15
+
16
+ # FIXME: implement 'stress'/'workload' objects
17
+ $running {$id } = {hello => ' world' };
18
+
19
+ # FIXME: implement
20
+
21
+ return 1;
22
+ }
23
+
24
+ sub stop
25
+ {
26
+ my $id = shift ;
27
+ print (" stop stress $id \n " );
28
+
29
+ my $stress = delete $running {$id };
30
+
31
+ if (!defined $stress )
32
+ {
33
+ print (" cannot stop stress $id : that id is not running\n " );
34
+ return 0;
35
+ }
36
+
37
+ # FIXME: implement
38
+
39
+ return 1;
40
+ }
41
+
42
+ 1;
Original file line number Diff line number Diff line change 1
1
package Testeaux ;
2
2
3
+ use Stresseaux;
4
+
3
5
package Combineaux
4
6
{
5
7
sub combine
@@ -12,13 +14,13 @@ package Combineaux
12
14
{
13
15
foreach my $trouble (@$troubles )
14
16
{
15
- print (" run workload $workload during trouble $trouble \n " );
16
- # FIXME: generate proper id instead of 'hello'
17
- Stresseaux::start(' hello ' , $workload , $cluster );
17
+ print (" --- $workload vs. $trouble --- \n " );
18
+ my $ id = " $workload + $trouble " ;
19
+ Stresseaux::start($id , $workload , $cluster ) || die " stress wouldn't start " ;
18
20
sleep (1); # FIXME: will this work?
19
21
Troubleaux::cause($cluster , $trouble );
20
22
sleep (1); # FIXME: will this work?
21
- Stresseaux::stop(' hello ' ) ;
23
+ Stresseaux::stop($id ) || die " stress wouldn't stop " ;
22
24
Troubleaux::fix($cluster );
23
25
}
24
26
}
@@ -27,23 +29,6 @@ package Combineaux
27
29
}
28
30
}
29
31
30
- package Stresseaux
31
- {
32
- sub start
33
- {
34
- my ($id , $workload , $cluster ) = @_ ;
35
- print (" start stress $id : workload $workload , cluster $cluster \n " );
36
- # fixme: implement
37
- }
38
-
39
- sub stop
40
- {
41
- my $id = shift ;
42
- print (" stop stress $id \n " );
43
- # FIXME: implement
44
- }
45
- }
46
-
47
32
package Starteaux
48
33
{
49
34
sub deploy
You can’t perform that action at this time.
0 commit comments