[Swift-commit] r2561 - trunk/bin
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Tue Feb 17 10:42:29 CST 2009
Author: benc
Date: 2009-02-17 10:42:29 -0600 (Tue, 17 Feb 2009)
New Revision: 2561
Added:
trunk/bin/swift-osg-ress-site-catalog
Log:
A script which queries the OSG Resource Selection System (ReSS) for site
information and builds a Swift site catalog.
This commit contributed by Mats Rynge <rynge at renci.org>
Added: trunk/bin/swift-osg-ress-site-catalog
===================================================================
--- trunk/bin/swift-osg-ress-site-catalog (rev 0)
+++ trunk/bin/swift-osg-ress-site-catalog 2009-02-17 16:42:29 UTC (rev 2561)
@@ -0,0 +1,155 @@
+#!/usr/bin/perl
+
+use strict;
+
+use Pod::Usage;
+use Getopt::Long;
+use File::Temp qw/ tempfile tempdir mktemp /;
+
+my $opt_help = 0;
+my $opt_vo = 'engage';
+my $opt_engage_verified = 0;
+my $opt_gt4 = 0;
+my $opt_out = '&STDOUT';
+
+Getopt::Long::Configure('bundling');
+GetOptions(
+ "help" => \$opt_help,
+ "vo=s" => \$opt_vo,
+ "engage-verified" => \$opt_engage_verified,
+ "gt4" => \$opt_gt4,
+ "out=s" => \$opt_out,
+) or pod2usage(1);
+
+if ($opt_help) {
+ pod2usage(1);
+}
+
+if ($opt_engage_verified && $opt_vo ne "engage") {
+ die("You can not specify a vo when using --engage-verified\n");
+}
+
+# make sure condor_status is in the path
+my $out = `which condor_status 2>/dev/null`;
+if ($out eq "") {
+ die("This tool depends on condor_status.\n" .
+ "Please make sure condor_status in your path.\n");
+}
+
+my %ads;
+my %tmp;
+my $cmd = "condor_status -any -long -constraint" .
+ " 'StringlistIMember(\"VO:$opt_vo\";GlueCEAccessControlBaseRule)'" .
+ " -pool osg-ress-1.fnal.gov";
+# if we want the engage verified sites, ignore opt_vo and query against
+# engage central collector
+if ($opt_engage_verified) {
+ $cmd = "condor_status -any -long -constraint" .
+ " 'SiteVerified==TRUE'" .
+ " -pool engage-central.renci.org"
+}
+open(STATUS, "$cmd|");
+while(<STATUS>) {
+ chomp;
+ if ($_ eq "") {
+ if ($tmp{'GlueSiteName'} ne "") {
+ my %copy = %tmp;
+ $ads{$tmp{'GlueSiteName'}} = \%copy;
+ undef %tmp;
+ }
+ }
+ else {
+ my ($key, $value) = split(/ = /, $_, 2);
+ $value =~ s/^"|"$//g; # remove quotes from Condor strings
+ $tmp{$key} = $value;
+ }
+}
+close(STATUS);
+
+# lowercase vo
+my $lc_vo = lc($opt_vo);
+
+open(FH, ">$opt_out") or die("Unable to open $opt_out");
+print FH "<config>\n";
+foreach my $sitename (keys %ads) {
+ my $contact = $ads{$sitename}->{'GlueCEInfoContactString'};
+ my $host = $contact;
+ $host =~ s/:.*//;
+ my $jm = $contact;
+ $jm =~ s/.*jobmanager-//;
+ if ($jm eq "pbs") {
+ $jm = "PBS";
+ }
+ elsif ($jm eq "lsf") {
+ $jm = "LSF";
+ }
+ elsif ($jm eq "sge") {
+ $jm = "SGE";
+ }
+ elsif ($jm eq "condor") {
+ $jm = "Condor";
+ }
+ my $workdir = $ads{$sitename}->{'GlueCEInfoDataDir'};
+ print FH "\n";
+ print FH " <!-- $sitename -->\n";
+ print FH " <pool handle=\"$sitename\" >\n";
+ print FH " <gridftp url=\"gsiftp://$host/\" />\n";
+ if ($opt_gt4) {
+ print FH " <execution provider=\"gt4\" jobmanager=\"$jm\" url=\"$host:9443\" />\n";
+ }
+ else {
+ print FH " <jobmanager universe=\"vanilla\" url=\"$contact\" major=\"2\" />\n";
+ }
+ print FH " <workdirectory >$workdir/$lc_vo/tmp</workdirectory>\n";
+ print FH " </pool>\n";
+}
+print FH "\n</config>\n";
+close(FH);
+
+exit(0);
+
+__END__
+
+=head1 NAME
+
+swift-osg-ress-site-catalog - converts ReSS data to Swift site catalog
+
+=head1 SYNOPSIS
+
+swift-osg-ress-site-catalog [options]
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<--help>
+
+Show this help message
+
+=item B<--vo=[name]>
+
+Set what VO to query ReSS for
+
+=item B<--engage-verified>
+
+Only retrieve sites verified by the Engagement VO site verification tests
+This can not be used together with --vo, as the query will only work for
+sites advertising support for the Engagement VO.
+
+This option means information will be retrieved from the Engagement collector
+instead of the top-level ReSS collector.
+
+=item B<--out=[filename]>
+
+Write to [filename] instead of stdout
+
+=back
+
+=head1 DESCRIPTION
+
+B<swift-osg-ress-site-catalog> converts ReSS data to Swift site catalog
+
+=cut
+
+
+
Property changes on: trunk/bin/swift-osg-ress-site-catalog
___________________________________________________________________
Name: svn:executable
+ *
More information about the Swift-commit
mailing list