src/hg/utils/automation/HgAutomate.pm 1.27
1.27 2009/06/08 18:40:49 hiram
Generalize the ssh command to avoid questions to the shell for new hosts
Index: src/hg/utils/automation/HgAutomate.pm
===================================================================
RCS file: /projects/compbio/cvsroot/kent/src/hg/utils/automation/HgAutomate.pm,v
retrieving revision 1.26
retrieving revision 1.27
diff -b -B -U 4 -r1.26 -r1.27
--- src/hg/utils/automation/HgAutomate.pm 8 May 2009 23:05:21 -0000 1.26
+++ src/hg/utils/automation/HgAutomate.pm 8 Jun 2009 18:40:49 -0000 1.27
@@ -36,9 +36,9 @@
),
# Hardcoded paths/commands/constants:
qw( $gensub2 $para $paraRun $centralDbSql $cvs
$clusterData $trackBuild $goldenPath $images $gbdb
- $splitThreshold $setMachtype
+ $splitThreshold $runSSH $setMachtype
),
);
#########################################################################
@@ -197,9 +197,9 @@
# If it doesn't produce a recognizable uptime result, return a
# very high load.
my ($mach) = @_;
confess "Must have exactly 1 argument" if (scalar(@_) != 1);
- my $cmd = "ssh -x $mach uptime 2>&1 | grep load";
+ my $cmd = "$HgAutomate::runSSH $mach uptime 2>&1 | grep load";
verbose(4, "about to run '$cmd'\n");
my $load = `$cmd`;
if ($load =~ s/.*load average: (\d+\.\d+).*/$1/) {
return $load;
@@ -214,10 +214,10 @@
# swarm and hgwdev are now valid workhorses since they have access to hive.
confess "Too many arguments" if (scalar(@_) != 0);
my %horses = ();
foreach my $machLine ('swarm', 'kolossus', 'hgwdev',
- `ssh -x encodek parasol list machines | grep idle`,
- `ssh -x memk parasol list machines | grep idle`) {
+ `$HgAutomate::runSSH encodek parasol list machines | grep idle`,
+ `$HgAutomate::runSSH memk parasol list machines | grep idle`) {
my $mach = $machLine;
$mach =~ s/[\. ].*//;
chomp $mach;
$horses{$mach} = &getLoadFactor($mach) if (! exists $horses{$mach});
@@ -314,9 +314,9 @@
foreach my $paraHub (keys %cluster) {
my $clusterInfo = $cluster{$paraHub};
next if (! $clusterInfo->{'enabled'});
next if ($onlySmallFast && $clusterInfo->{'gigaHz'} < 2.0);
- my @machInfo = `ssh -x $paraHub parasol list machines | grep -v dead`;
+ my @machInfo = `$HgAutomate::runSSH $paraHub parasol list machines | grep -v dead`;
my $idleCount = 0;
my $busyCount = 0;
foreach my $info (@machInfo) {
if ($info =~ /idle$/) {
@@ -325,9 +325,9 @@
$busyCount++;
}
}
my $batchCount =
- `ssh -x $paraHub parasol list batches | grep -v ^# | wc -l`;
+ `$HgAutomate::runSSH $paraHub parasol list batches | grep -v ^# | wc -l`;
my $expectedPortion = 1 / (1 + $batchCount);
my $oomph = (($idleCount + ($busyCount * $expectedPortion)) *
$clusterInfo->{'gigaHz'});
&verbose(3, "chooseClusterByBandwidth: " .
@@ -480,12 +480,12 @@
#########################################################################
# Hardcoded paths/command sequences:
use vars qw( $gensub2 $para $paraRun $centralDbSql $cvs
$clusterData $trackBuild $goldenPath $images $gbdb
- $splitThreshold $setMachtype
+ $splitThreshold $runSSH $setMachtype
);
use vars qw( $gensub2 $para $paraRun $clusterData $trackBuild
- $goldenPath $gbdb $centralDbSql $splitThreshold );
+ $goldenPath $gbdb $centralDbSql $splitThreshold $runSSH );
$gensub2 = '/parasol/bin/gensub2';
$para = '/parasol/bin/para';
$paraRun = ("$para make jobList\n" .
"$para check\n" .
@@ -506,8 +506,12 @@
# as opposed to "scaffold-based" (no split tables; multi-level directory for
# per-seq files, or use set of multi-seq files).
$splitThreshold = 100;
+# ssh command and its options, the extra -o options prevent asking
+# questions about adding machines to known hosts
+$runSSH = "ssh -x -o 'StrictHostKeyChecking = no' -o 'BatchMode = yes'";
+
$setMachtype = "setenv MACHTYPE `uname -m | sed -e 's/i686/i386/;'`";
#########################################################################
# General utility subroutines:
@@ -569,9 +573,9 @@
my ($dbHost, $db) = @_;
confess "Must have exactly 2 arguments" if (scalar(@_) != 2);
my $query = "select genome,description,sourceName from dbDb " .
"where name = \"$db\";";
- my $line = `echo '$query' | ssh -x $dbHost $centralDbSql`;
+ my $line = `echo '$query' | $HgAutomate::runSSH $dbHost $centralDbSql`;
chomp $line;
my ($genome, $date, $source) = split("\t", $line);
return ($genome, $date, $source);
}
@@ -581,9 +585,9 @@
my ($dbHost, $db) = @_;
confess "Must have exactly 2 arguments" if (scalar(@_) != 2);
my $query = "select scientificName from dbDb " .
"where name = \"$db\";";
- my $line = `echo '$query' | ssh -x $dbHost $centralDbSql`;
+ my $line = `echo '$query' | $HgAutomate::runSSH $dbHost $centralDbSql`;
chomp $line;
my ($scientificName) = split("\t", $line);
return ($scientificName);
} # getSpecies
@@ -593,9 +597,9 @@
# does not.
my ($mach, $file) = @_;
confess "Must have exactly 2 arguments" if (scalar(@_) != 2);
confess "undef input" if (! defined $mach || ! defined $file);
- my $count = `ssh -x $mach ls -1 $file 2>>/dev/null | wc -l`;
+ my $count = `$HgAutomate::runSSH $mach ls -1 $file 2>>/dev/null | wc -l`;
chomp $count;
return $count + 0;
}