Skip to content

Commit 0f96817

Browse files
committed
Move Stresseaux to a separate file.
1 parent 10fe0d0 commit 0f96817

File tree

2 files changed

+48
-21
lines changed

2 files changed

+48
-21
lines changed

contrib/mmts/testeaux/Stresseaux.pm

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
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;

contrib/mmts/testeaux/Testeaux.pm

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package Testeaux;
22

3+
use Stresseaux;
4+
35
package 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-
4732
package Starteaux
4833
{
4934
sub deploy

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy