|
You are here: Appendices > Appendix G: Integrating Other Resources with Moab > Compute Resource Managers > LSF Integration via the Native Interface
|
|
LSF Integration via the Native Interface |
|
------ # moab.cfg # Using the native interface to run query commands. RMCFG[native] TYPE=NATIVE FLAGS=queueisprivate RMCFG[native] CLUSTERQUERYURL=/usr/local/etc/node.query.lsf.pl TIMEOUT=30 RMCFG[native] PARTITION=lsf # Only use some features from the LSF (non-native) interface. RMCFG[lsf] TYPE=LSF FLAGS=executionserver,ignqueuestate RMCFG[lsf] FNLIST=queuequery,workloadquery,jobstart ------
------
#!/usr/bin/perl
use strict;
# Extract node data from LSF and pass it to Moab.
# Note: Should pay attention to command line,
# but currently doesn't.
# Note: Other node information can be passed along,
# for now this is the bare minimum required.
my $command = "bhosts -w |";
my $current_time = time();
my %job_state;
my $num_nodes;
my $node_id;
my $state;
open (DATA, $command);
for (<DATA>)
{
if (/^HOST_NAME/)
{
# NO-OP
}
elsif (/(\S+)\s+(\S+)/)
{
$job_state{$1} = $2;
}
}
close DATA;
$num_nodes = scalar keys %job_state;
# If no nodes are found, assume an error.
if ($num_nodes == 0)
{
print "SC=-1";
}
# Output the data in the format Moab is expecting.
for $node_id (sort keys %job_state)
{
if ($job_state{$node_id} =~ /ok/)
{
$state = 'Idle';
}
elsif ($job_state{$node_id} =~ /unavail/)
{
$state = 'Down';
}
elsif ($job_state{$node_id} =~ /unreach/)
{
$state = 'Down';
}
elsif ($job_state{$node_id} =~ /closed_Adm/)
{
$state = 'Drained';
}
elsif ($job_state{$node_id} =~ /closed_Full/)
{
$state = 'Drained';
}
elsif ($job_state{$node_id} =~ /closed_Excl/)
{
$state = 'Busy';
}
else
{
$state = 'Unknown';
}
print "$node_id STATE=$state UPDATETIME=$current_time CPROC=2\n";
}
------
Copyright © 2012 Adaptive Computing Enterprises, Inc.®