File tree Expand file tree Collapse file tree 2 files changed +48
-21
lines changed Expand file tree Collapse file tree 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 11package Testeaux ;
22
3+ use Stresseaux;
4+
35package Combineaux
46{
57 sub combine
@@ -12,13 +14,13 @@ package Combineaux
1214 {
1315 foreach my $trouble (@$troubles )
1416 {
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 " ;
1820 sleep (1); # FIXME: will this work?
1921 Troubleaux::cause($cluster , $trouble );
2022 sleep (1); # FIXME: will this work?
21- Stresseaux::stop(' hello ' ) ;
23+ Stresseaux::stop($id ) || die " stress wouldn't stop " ;
2224 Troubleaux::fix($cluster );
2325 }
2426 }
@@ -27,23 +29,6 @@ package Combineaux
2729 }
2830}
2931
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-
4732package Starteaux
4833{
4934 sub deploy
You can’t perform that action at this time.
0 commit comments