-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinitcluster.pl
More file actions
67 lines (51 loc) · 1.63 KB
/
initcluster.pl
File metadata and controls
67 lines (51 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/perl -w
use strict;
use warnings;
use pexacc2conf;
sub readClusterIPs( $ );
if ( scalar( @ARGV ) != 1 ) {
die( "initcluster.pl <cluster.info file>\n" );
}
my( $pexaccconf ) = pexacc2conf->new( {} );
my( %machips ) = readClusterIPs( $ARGV[0] );
my( $workingdir ) = $pexaccconf->{"PEXACCWORKINGDIR"};
my( $tmpdir ) = $pexaccconf->{"TMPDIR"};
my( $newdictdir ) = $pexaccconf->{"GIZAPPNEWDICTDIR"};
#Local cleanup
qx/rm -fv ${workingdir}\/*.in 1>&2/;
qx/rm -fv ${workingdir}\/*.out 1>&2/;
qx/rm -fv ${workingdir}\/*.ready 1>&2/;
qx/rm -fv ${tmpdir}\/* 1>&2/;
qx/rm -fv ${newdictdir}\/* 1>&2/;
qx/killall pdataworker.pl/;
print( STDERR "\nNEFERTITI:\n" );
qx/ps rU rion/;
print( STDERR "\n" );
#Remote cleanup
foreach my $ip ( keys( %machips ) ) {
next if ( $ip eq $pexaccconf->{"MASTERIP"} || $ip eq "127.0.0.1" );
qx/ssh rion\@${ip} rm -fv ${workingdir}\/*.in 1>&2/;
qx/ssh rion\@${ip} rm -fv ${workingdir}\/*.out 1>&2/;
qx/ssh rion\@${ip} rm -fv ${workingdir}\/*.ready 1>&2/;
qx/ssh rion\@${ip} rm -fv ${tmpdir}\/* 1>&2/;
qx/ssh rion\@${ip} rm -fv ${newdictdir}\/* 1>&2/;
qx/ssh rion\@${ip} killall pdataworker.pl/;
print( STDERR "\n" . uc( $machips{$ip} ) . ":\n" );
qx/ssh rion\@${ip} ps rU rion/;
print( STDERR "\n" );
}
#pexacc2 ok.
sub readClusterIPs( $ ) {
my( %cluster ) = ();
open( CLST, "< $_[0]" ) or die( "pexacc2::readClusterIPs: cannot open file '$_[0]' !\n" );
while ( my $line = <CLST> ) {
$line =~ s/^\s+//;
$line =~ s/\s+$//;
next if ( $line =~ /^#/ );
next if ( $line =~ /^$/ );
my( $hostname, $ip, $cpuid ) = split( /\s+/, $line );
$cluster{$ip} = $hostname;
}
close( CLST );
return %cluster;
}