[Swift-commit] r7253 - in trunk: . bin
davidk at ci.uchicago.edu
davidk at ci.uchicago.edu
Wed Oct 30 13:10:44 CDT 2013
Author: davidk
Date: 2013-10-30 13:10:44 -0500 (Wed, 30 Oct 2013)
New Revision: 7253
Removed:
trunk/bin/grid/
trunk/bin/slurm-qdel
trunk/bin/slurm-qstat
trunk/bin/slurm-qsub
trunk/bin/slurm-qsub-emulator
trunk/bin/swiftconfig
trunk/bin/swiftstat
Modified:
trunk/build.xml
Log:
Some bin/ directory cleanup
Removed the slurm-* commands since they are now replaced with the slurm provider
Removed the bin/grid directory - the older scripts for submitting directly to OSG
Deleted: trunk/bin/slurm-qdel
===================================================================
--- trunk/bin/slurm-qdel 2013-10-30 17:47:19 UTC (rev 7252)
+++ trunk/bin/slurm-qdel 2013-10-30 18:10:44 UTC (rev 7253)
@@ -1,8 +0,0 @@
-#! /bin/sh
-
-now=$(date "+%Y.%m%d.%H:%M:%S")
-echo $now $0: $* >> $HOME/pbslog
-
-qdel $*
-
-
Deleted: trunk/bin/slurm-qstat
===================================================================
--- trunk/bin/slurm-qstat 2013-10-30 17:47:19 UTC (rev 7252)
+++ trunk/bin/slurm-qstat 2013-10-30 18:10:44 UTC (rev 7253)
@@ -1,13 +0,0 @@
-#! /bin/sh
-
-now=$(date "+%Y.%m%d.%H:%M:%S")
-echo $now $0: $* >> $HOME/pbslog
-
-#echo 'Job id Name User Time Use S Queue'
-#echo '------------------- ---------------- --------------- -------- - -----'
-
-#/software/slurm-2.4-el6-x86_64/bin/qstat $* | tail -n +2
-qstat $* | sed -e 's/\t/ /' -e 's/: */: /'
-
-
-
Deleted: trunk/bin/slurm-qsub
===================================================================
--- trunk/bin/slurm-qsub 2013-10-30 17:47:19 UTC (rev 7252)
+++ trunk/bin/slurm-qsub 2013-10-30 18:10:44 UTC (rev 7253)
@@ -1,78 +0,0 @@
-#! /bin/sh
-
-now=$(date "+%Y.%m%d.%H:%M:%S")
-echo $now $0: $* >> $HOME/pbslog
-
-slurmqsub=$( which slurm-qsub-emulator )
-script=$1.slurm
-echo '#! /bin/sh' >$script
-# echo 'export PBS_NODELIST=SLURM_NODELIST'' >>$script # FIXME: convert SLURM_NODELIST to PBS_NODEFILE here...
-cat $1 | grep -v '^#PBS' >>$script
-chmod +x $script
-
-srunargs=$(awk <$1 '
-/#PBS -S/ { shell=$3 }
-/#PBS -N/ { jobname=$3 }
-/#PBS -m/ { m = $3 }
-/#PBS -l nodes/ { nodes = $3; ppn=$3;
- sub(/nodes=/,"",nodes); sub(/:.*/,"",nodes);
- sub(/^.*ppn=/,"",ppn); }
-/#PBS -l walltime/ { walltime = $3; sub(/walltime=/,"",walltime);}
-#/#PBS -l advres/ { advres = "," $3; sub(/advres=/,"",advres); advres="," advres }
-/#PBS -l advres/ { advres = "," $3; }
-/#PBS -q/ { queue = $3 }
-/#PBS -o/ { sofile = $3 }
-/#PBS -e/ { sefile = $3 }
-
-END {
- #printf("shell=%s jobname=%s m=%s nodespec=%s nodes=%s ppn=%s walltime=%s queue=%s sofile=%s sefile=%s\n",
- # shell, jobname, m, nodespec, nodes, ppn, walltime, queue, sofile, sefile);
- #printf("-p %s -t %s -N %s -D %s -J %s -e %s -o %s", queue, walltime, nodes, "/tmp", jobname, sefile, sofile);
-
-# printf("-S %s -N %s -m %s -l nodes=%s:ppn=%s -l walltime=%s -q %s -o %s -e %s",
-# shell, jobname, m, nodes, ppn, walltime, queue, sofile, sefile);
- printf("-N %s -m %s -l nodes=%s:ppn=%s,walltime=%s%s -q %s -o %s -e %s",
- jobname, m, nodes, ppn, walltime, advres, queue, sofile, sefile);
-
-}')
-
-echo " " qsub args: $slurmqsub $srunargs $script >>$HOME/pbslog
-job=$($slurmqsub $srunargs $script)
-echo " " qsub output: $job >>$HOME/pbslog
-
-jid=$(echo $job | sed -e 's/^.* //')
-echo " " qsub job id: $jid >>$HOME/pbslog
-echo $jid
-
-# srun $srunargs $script
-
-# cqsub -q ${QUEUE} \
-# -k zeptoos \
-# -t ${MAXTIME} \ # minutes
-# -n ${NODES} \
-# --cwd ${LOGDIR} \
-# -E ${LOGDIR}/cobalt.${$}.stderr \
-# -o ${LOGDIR}/cobalt.${$}.stdout \
-# -e "WORKER_LOGGING_LEVEL=DEBUG:ZOID_ENABLE_NAT=true" \
-# $WORKER $EXECUTION_URL $ID $LOG_DIR
-
-# LOGDIR=/tmp/swiftlog
-#
-# WORKER_LOGGING_LEVEL=DEBUG srun \
-# -p ${QUEUE} \
-# -t ${MAXTIME} \
-# -N ${NODES} \
-# -D ${LOGDIR} \
-# -J swift-worker \
-# -e ${LOGDIR}/cobalt.${$}.stderr \
-# -o ${LOGDIR}/cobalt.${$}.stdout \
-# $SWIFT_BIN/$WORKER $EXECUTION_URL $ID $LOG_DIR
-
-#PBS -S /bin/bash
-#PBS -N cog-000000
-#PBS -m n
-#PBS -l nodes=1:ppn=1
-#PBS -l walltime=00:05:00
-#PBS -q sandyb
-#PBS -o /home/wilde/.globus/scripts/PBS4051523028032512638.submit.stdout
-#PBS -e /home/wilde/.globus/scripts/PBS4051523028032512638.submit.stderr
Deleted: trunk/bin/slurm-qsub-emulator
===================================================================
--- trunk/bin/slurm-qsub-emulator 2013-10-30 17:47:19 UTC (rev 7252)
+++ trunk/bin/slurm-qsub-emulator 2013-10-30 18:10:44 UTC (rev 7253)
@@ -1,433 +0,0 @@
-#! /usr/bin/perl -w
-###############################################################################
-#
-# qsub - submit a batch job in familar pbs format.
-#
-#
-###############################################################################
-# Copyright (C) 2007 The Regents of the University of California.
-# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
-# Written by Danny Auble <auble1 at llnl.gov>.
-# CODE-OCEC-09-009. All rights reserved.
-#
-# This file is part of SLURM, a resource management program.
-# For details, see <http://www.schedmd.com/slurmdocs/>.
-# Please also read the included file: DISCLAIMER.
-#
-# SLURM is free software; you can redistribute it and/or modify it under
-# the terms of the GNU General Public License as published by the Free
-# Software Foundation; either version 2 of the License, or (at your option)
-# any later version.
-#
-# In addition, as a special exception, the copyright holders give permission
-# to link the code of portions of this program with the OpenSSL library under
-# certain conditions as described in each individual source file, and
-# distribute linked combinations including the two. You must obey the GNU
-# General Public License in all respects for all of the code used other than
-# OpenSSL. If you modify file(s) with this exception, you may extend this
-# exception to your version of the file(s), but you are not obligated to do
-# so. If you do not wish to do so, delete this exception statement from your
-# version. If you delete this exception statement from all source files in
-# the program, then also delete it here.
-#
-# SLURM is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
-# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
-# details.
-#
-# You should have received a copy of the GNU General Public License along
-# with SLURM; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-###############################################################################
-
-use strict;
-use FindBin;
-use Getopt::Long 2.24 qw(:config no_ignore_case require_order);
-use lib qw(/software/slurm-2.4-el6-x86_64/lib64/perl5);
-use autouse 'Pod::Usage' => qw(pod2usage);
-use Slurm ':all';
-use Switch;
-
-my ($start_time,
- $account,
- # $checkpoint_interval,
- $directive_prefix,
- $err_path,
- $interactive,
- $hold,
-# $join,
-# $keep,
- $resource_list,
- $mail_options,
- $mail_user_list,
- $job_name,
- $out_path,
- $priority,
- $destination,
-# $rerunable,
-# $script_path,
-# $running_user_list,
-# $variable_list,
-# $all_env,
- $additional_attributes,
-# $no_std,
- $help,
- $man);
-
-# my $sbatch = "${FindBin::Bin}/sbatch";
-# my $salloc = "${FindBin::Bin}/salloc";
-# my $srun = "${FindBin::Bin}/srun";
-
-my $sbatch = "sbatch";
-my $salloc = "salloc";
-
-GetOptions('a=s' => \$start_time,
- 'A=s' => \$account,
-# 'c=i' => \$checkpoint_interval,
- 'C=s' => \$directive_prefix,
- 'e=s' => \$err_path,
- 'h' => \$hold,
- 'I' => \$interactive,
- 'j:s' => sub { warn "option -j is the default, " .
- "stdout/stderr go into the same file\n" },
-# 'k=s' => \$keep,
- 'l=s' => \$resource_list,
- 'm=s' => \$mail_options,
- 'M=s' => \$mail_user_list,
- 'N=s' => \$job_name,
- 'o=s' => \$out_path,
- 'p=i' => \$priority,
- 'q=s' => \$destination,
-# 'r=s' => \$rerunable,
-# 'S=s' => \$script_path,
-# 'u=s' => \$running_user_list,
- 'v=s' => sub { warn "option -v is not supported, " .
- "since the current environment " .
- "is exported by default\n" },
- 'V' => sub { warn "option -V is not necessary, " .
- "since the current environment " .
- "is exported by default\n" },
- 'W' => \$additional_attributes,
-# 'z' => \$no_std,
- 'help|?' => \$help,
- 'man' => \$man,
- )
- or pod2usage(2);
-
-# Display usage if necessary
-pod2usage(0) if $help;
-if ($man) {
- if ($< == 0) { # Cannot invoke perldoc as root
- my $id = eval { getpwnam("nobody") };
- $id = eval { getpwnam("nouser") } unless defined $id;
- $id = -2 unless defined $id;
- $< = $id;
- }
- $> = $<; # Disengage setuid
- $ENV{PATH} = "/bin:/usr/bin"; # Untaint PATH
- delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
- if ($0 =~ /^([-\/\w\.]+)$/) { $0 = $1; } # Untaint $0
- else { die "Illegal characters were found in \$0 ($0)\n"; }
- pod2usage(-exitstatus => 0, -verbose => 2);
-}
-
-# Use sole remaining argument as jobIds
-my $script;
-if ($ARGV[0]) {
- foreach (@ARGV) {
- $script .= "$_ ";
- }
-} else {
- pod2usage(2);
-}
-my %res_opts;
-my %node_opts;
-
-if($resource_list) {
- %res_opts = %{parse_resource_list($resource_list)};
-
-# while((my $key, my $val) = each(%res_opts)) {
-# print "$key = ";
-# if($val) {
-# print "$val\n";
-# } else {
-# print "\n";
-# }
-# }
-
- if($res_opts{nodes}) {
- %node_opts = %{parse_node_opts($res_opts{nodes})};
- }
-}
-
-my $command;
-
-if($interactive) {
- $command = "$salloc";
-
-} else {
- $command = "$sbatch";
-
- $command .= " -D $directive_prefix" if $directive_prefix;
- $command .= " -e $err_path" if $err_path;
- $command .= " -o $out_path" if $out_path;
-}
-
-$command .= " -N$node_opts{node_cnt}" if $node_opts{node_cnt};
-$command .= " -n$node_opts{task_cnt}" if $node_opts{task_cnt};
-$command .= " -w$node_opts{hostlist}" if $node_opts{hostlist};
-
-if($res_opts{walltime}) {
- $command .= " -t$res_opts{walltime}";
-} elsif($res_opts{cput}) {
- $command .= " -t$res_opts{cput}";
-} elsif($res_opts{pcput}) {
- $command .= " -t$res_opts{pcput}";
-}
-
-$command .= " --tmp=$res_opts{file}" if $res_opts{file};
-$command .= " --mem=$res_opts{mem}" if $res_opts{mem};
-$command .= " --nice=$res_opts{nice}" if $res_opts{nice};
-$command .= " --reservation=$res_opts{advres}" if $res_opts{advres};
-# Cray-specific options
-$command .= " -n$res_opts{mppwidth}" if $res_opts{mppwidth};
-$command .= " -w$res_opts{mppnodes}" if $res_opts{mppnodes};
-$command .= " --cpus-per-task=$res_opts{mppdepth}" if $res_opts{mppdepth};
-$command .= " --ntasks-per-node=$res_opts{mppnppn}" if $res_opts{mppnppn};
-
-$command .= " --begin=$start_time" if $start_time;
-$command .= " --account=$account" if $account;
-$command .= " -H" if $hold;
-
-if($mail_options) {
- $command .= " --mail-type=FAIL" if $mail_options =~ /a/;
- $command .= " --mail-type=BEGIN" if $mail_options =~ /b/;
- $command .= " --mail-type=END" if $mail_options =~ /e/;
-}
-$command .= " --mail-user=$mail_user_list" if $mail_user_list;
-$command .= " -J $job_name" if $job_name;
-$command .= " --nice=$priority" if $priority;
-$command .= " -p $destination" if $destination;
-$command .= " -C $additional_attributes" if $additional_attributes;
-
-$command .= " --exclusive"; # MWilde: added for midway, which schedules by core.
-
-$command .= " $script";
-
-system("(echo; echo $command; echo) >> \$HOME/pbslog");
-
-system($command);
-
-
-sub parse_resource_list {
- my ($rl) = @_;
- my %opt = ('arch' => "",
- 'cput' => "",
- 'file' => "",
- 'host' => "",
- 'mem' => "",
- 'nice' => "",
- 'nodes' => "",
- 'opsys' => "",
- 'other' => "",
- 'pcput' => "",
- 'pmem' => "",
- 'pvmem' => "",
- 'software' => "",
- 'vmem' => "",
- 'advres' => "",
- # Cray-specific resources
- 'mppwidth' => "",
- 'mppdepth' => "",
- 'mppnppn' => "",
- 'mppmem' => "",
- 'mppnodes' => "",
- 'walltime' => ""
- );
- my @keys = keys(%opt);
-
- foreach my $key (@keys) {
- # print "key=$key rl=$rl\n";
- ($opt{$key}) = $rl =~ m/$key=([-\w:\+=+]+)/;
- # print " set to $opt{$key}\n";
- }
- if($opt{cput}) {
- $opt{cput} = get_minutes($opt{cput});
- }
-
- if($opt{mppmem}) {
- $opt{mem} = convert_mb_format($opt{mppmem});
- } elsif($opt{mem}) {
- $opt{mem} = convert_mb_format($opt{mem});
- }
-
- if($opt{file}) {
- $opt{file} = convert_mb_format($opt{file});
- }
-
- return \%opt;
-}
-
-sub parse_node_opts {
- my ($node_string) = @_;
- my %opt = ('node_cnt' => 0,
- 'hostlist' => "",
- 'task_cnt' => 0
- );
- while($node_string =~ /ppn=(\d+)/g) {
- $opt{task_cnt} += $1;
- }
-
- my $hl = Slurm::Hostlist::create("");
-
- my @parts = split(/\+/, $node_string);
- foreach my $part (@parts) {
- my @sub_parts = split(/:/, $part);
- foreach my $sub_part (@sub_parts) {
- if($sub_part =~ /ppn=(\d+)/) {
- next;
- } elsif($sub_part =~ /^(\d+)/) {
- $opt{node_cnt} += $1;
- } else {
- if(!Slurm::Hostlist::push($hl, $sub_part)) {
- print "problem pushing host $sub_part onto hostlist\n";
- }
- }
- }
- }
-
- $opt{hostlist} = Slurm::Hostlist::ranged_string($hl);
-
- my $hl_cnt = Slurm::Hostlist::count($hl);
- $opt{node_cnt} = $hl_cnt if $hl_cnt > $opt{node_cnt};
-
- # we always want at least one here
- if(!$opt{node_cnt}) {
-
- $opt{node_cnt} = 1;
- }
-
- # figure out the amount of tasks based of the node cnt and the amount
- # of ppn's in the request
- if($opt{task_cnt}) {
- $opt{task_cnt} *= $opt{node_cnt};
- }
-
- return \%opt;
-}
-
-sub get_minutes {
- my ($duration) = @_;
- $duration = 0 unless $duration;
- my $minutes = 0;
-
- # Convert [[HH:]MM:]SS to duration in minutes
- if ($duration =~ /^(?:(\d+):)?(\d*):(\d+)$/) {
- my ($hh, $mm, $ss) = ($1 || 0, $2 || 0, $3);
- $minutes += 1 if $ss > 0;
- $minutes += $mm;
- $minutes += $hh * 60;
- } elsif ($duration =~ /^(\d+)$/) { # Convert number in minutes to seconds
- my $mod = $duration % 60;
- $minutes = int($duration / 60);
- $minutes++ if $mod;
- } else { # Unsupported format
- die("Invalid time limit specified ($duration)\n");
- }
-
- return $minutes;
-}
-
-sub convert_mb_format {
- my ($value) = @_;
- my ($amount, $suffix) = $value =~ /(\d+)($|[KMGT])/i;
- return if !$amount;
- $suffix = lc($suffix);
-
- if (!$suffix) {
- $amount /= 1048576;
- } elsif ($suffix eq "k") {
- $amount /= 1024;
- } elsif ($suffix eq "m") {
- #do nothing this is what we want.
- } elsif ($suffix eq "g") {
- $amount *= 1024;
- } elsif ($suffix eq "t") {
- $amount *= 1048576;
- } else {
- print "don't know what to do with suffix $suffix\n";
- return;
- }
-
- $amount .= "M";
-
- return $amount;
-}
-##############################################################################
-
-__END__
-
-=head1 NAME
-
-B<qsub> - submit a batch job in a familiar pbs format
-
-=head1 SYNOPSIS
-
-qsub [-a date_time]
- [-A account_string]
- [-b secs]
- [-C directive_prefix]
- [-e path]
- [-I]
- [-l resource_list]
- [-m mail_options] [-M user_list]
- [-N name]
- [-o path]
- [-p priority]
- [-q destination]
- [-W additional_attributes]
- [-h]
- [script]
-
-=head1 DESCRIPTION
-
-The B<qsub> command displays information about nodes. It is aimed to be feature-compatible with PBS' qsub.
-
-=head1 OPTIONS
-
-=over 4
-
-=item B<-a>
-
-Display information for all nodes. This is the default if no node name is specified.
-
-=item B<-I>
-
-Interactive execution.
-
-=item B<-j> join
-
-It is not necessary (currently also not possible) since stderr/stdout are always joined.
-
-=item B<-v> [variable_list]
-
-Exporting single variables via -v is not supported, since the entire login environment
-is exported by the default.
-
-=item B<-V>
-
-The -V option to export the current environment is not required since it is done by default.
-
-=item B<-?> | B<--help>
-
-brief help message
-
-=item B<--man>
-
-full documentation
-
-=back
-
-=cut
-
Deleted: trunk/bin/swiftconfig
===================================================================
--- trunk/bin/swiftconfig 2013-10-30 17:47:19 UTC (rev 7252)
+++ trunk/bin/swiftconfig 2013-10-30 18:10:44 UTC (rev 7253)
@@ -1,419 +0,0 @@
-#!/usr/bin/perl -w
-
-use strict;
-
-use File::Copy;
-use File::Path;
-use Pod::Usage;
-use Cwd;
-use Cwd qw(abs_path);
-use FindBin qw($Bin);
-use lib "$FindBin::Bin/../lib/perl"; # Use libs in swiftconfig_home/lib/perl
-use SwiftConfig;
-use Getopt::Long;
-use XML::Simple;
-use File::Which qw(which where);
-use Data::Dumper;
-
-# Variables for command line options
-my $option_list = q{}; # List information about config
-my $option_remove = q{}; # Remove entry from sites.xml
-my $option_edit = q{}; # Edit mode
-my $option_default = q{}; # When adding a site, use all defaults
-my @option_templates = (); # Create config from template specified
-my $option_copy = q{}; # Copy an existing configuration
-my $option_applications = q{}; # Edit applications
-my $option_import = q{}; # Import existing configuration
-my @option_profiles = (); # Specify one or more profiles to edit
-my $option_groups = q{}; # Edit site groupings
-
-# Assign variables from command line options
-GetOptions(
- 'remove=s' => \$option_remove,
- 'default|defaults' => \$option_default,
- 'full' => sub { $option_default = 0; },
- 'template|templates=s{,}' => \@option_templates,
- 'edit=s' => \$option_edit,
- 'copy=s' => \$option_copy,
- 'apps|applications' => \$option_applications,
- 'import=s' => \$option_import,
- 'list=s' => \$option_list,
- 'help|man|h' => sub { pod2usage(-verbose => 2); },
- 'profile|profiles=s{,}' => \@option_profiles,
- 'group|groups' => \$option_groups,
-);
-
-# Prepare data
-my $xml = new XML::Simple();
-initialize_swiftconfig();
-
-# Check command line options
-if( !$option_remove
- && !@option_templates
- && !$option_edit
- && !$option_copy
- && !$option_applications
- && !$option_import
- && !$option_list
- && !$option_groups) {
- print "Incorrect usage. See swiftconfig -help for more information\n";
- exit;
-}
-
-# Create all required directories
-my $dotswift_directory = "$ENV{'HOME'}/.swift";
-create_directory("$ENV{'HOME'}/.ssh");
-create_directory("$dotswift_directory");
-create_directory("$dotswift_directory/sites");
-
-# Determine the template directory
-my @execution_path = split( '/', abs_path($0) );
- at execution_path = splice( @execution_path, 0, $#execution_path - 1 );
-my $template_directory = join( '/', @execution_path ) . '/etc/sites';
-
-# Add configuration from a template
-if (@option_templates) {
-
- foreach my $option_template(@option_templates) {
- # Update XML info
- my $from_directory = "$template_directory/$option_template";
- my $sites_input_file = "$from_directory/sites.xml";
- if ( !-e "$sites_input_file" ) {
- die "Unable to find template for $option_template\n";
- }
- my $xml_ref = update_xml("$sites_input_file", 0, $option_default);
- my $new_sitename = $xml_ref->{handle};
- my $output_directory = "$dotswift_directory/sites/$new_sitename";
- if ( -d "$output_directory" ) {
- print "Configuration for $new_sitename already exists\n";
- next;
- }
-
- # Update and copy files to reflect input
- my @files_to_copy = <$from_directory/*>;
- create_directory("$output_directory");
- foreach my $file_to_copy (@files_to_copy) {
- copy_file($file_to_copy, $output_directory);
- }
- my $xml_out_ref = $xml->XMLout(
- $xml_ref,
- RootName => 'pool',
- SuppressEmpty => 1,
- );
- write_file( "$output_directory/sites.xml", $xml_out_ref );
- update_site_applications($new_sitename, $option_default);
-
- # Handle SSH
- if ( $xml_ref->{execution}{provider} eq 'ssh' ) {
- add_ssh( $new_sitename, $xml_ref->{execution}{url} );
- }
-
- print "Successfully added $option_template\n";
- }
-}
-
-# Remove an entry
-if ($option_remove) {
-
- if ( !-d "$dotswift_directory/sites/$option_remove" ) {
- die "Unable to find configuration named $option_remove\n";
- }
-
- # Remove directory
- rmtree("$dotswift_directory/sites/$option_remove")
- || die 'Unable to remove directory '
- . "$dotswift_directory/sites/$option_remove\n";
-}
-
-# Modify a site entry
-if ($option_edit) {
- my $output_directory = "$dotswift_directory/sites/$option_edit";
-
- my $xml_filename = "$output_directory/sites.xml";
- if ( !-e "$xml_filename" ) {
- die "Unable to find configuration for $option_edit\n";
- }
-
- my $xml_ref = $xml->XMLin(
- $xml_filename,
- ForceArray => [qw(workdirectory profile)],
- KeyAttr => [],
- );
-
- if(@option_profiles) {
- $xml_ref = edit_profile($xml_filename, @option_profiles);
- }
- else {
- $xml_ref = update_xml("$xml_filename", 1, $option_default);
- update_site_applications($option_edit, $option_default);
- }
-
- # Save
- my $xml_out_ref = $xml->XMLout(
- $xml_ref,
- RootName => 'pool',
- SuppressEmpty => 1,
- );
- write_file( "$output_directory/sites.xml", $xml_out_ref );
-
- # Add/modify/remove ssh entries as needed
- if ( $xml_ref->{execution}{provider} eq 'ssh' ) {
- add_ssh( $xml_ref->{handle}, $xml_ref->{execution}{url} );
- }
-}
-
-# Copy a configuration
-if($option_copy) {
- my $input_directory = "$dotswift_directory/sites/$option_copy";
- my $input_site = "$input_directory/sites.xml";
- if( !-e $input_site) {
- die "Unable to find configuration for $option_copy\n";
- }
-
- my $new_config_name = get_entry( 'New Configuration Name', '', 0);
- my $output_directory = "$dotswift_directory/sites/$new_config_name";
- if(-d "$output_directory") {
- die "Configuration for $new_config_name already exists\n";
- }
- create_directory($output_directory);
-
- my @files_to_copy = <$input_directory/*>;
- foreach my $file_to_copy (@files_to_copy) {
- copy_file($file_to_copy, $output_directory);
- }
-
- # Rename and save
- my $xml_filename = "$output_directory/sites.xml";
- my $xml_ref = $xml->XMLin(
- $xml_filename,
- ForceArray => [qw(workdirectory profile)],
- KeyAttr => [],
- );
- $xml_ref->{handle} = $new_config_name;
- my $xml_out_ref = $xml->XMLout(
- $xml_ref,
- RootName => 'pool',
- SuppressEmpty => 1,
- );
- write_file( "$output_directory/sites.xml", $xml_out_ref );
-
- # Edit sites
- my $initial_exurl = $xml_ref->{execution}{url};
- $xml_ref = update_xml( "$output_directory/sites.xml", 1, $option_default,);
- my $new_exurl = $xml_ref->{execution}{url};
-
- $xml_out_ref = $xml->XMLout(
- $xml_ref,
- RootName => 'pool',
- SuppressEmpty => 1,
- );
-
- write_file( "$output_directory/sites.xml", $xml_out_ref );
-
- # Add ssh entries as needed
- if ( $xml_ref->{execution}{provider} eq 'ssh' ) {
- add_ssh( $xml_ref->{handle}, $xml_ref->{execution}{url} );
- }
-}
-
-# Edit site groupings
-if($option_groups) {
- my @groups = glob("$dotswift_directory/groups/*");
- foreach(@groups) {
- $_ = strip_directory($_);
- my ($base, $ext) = split('\.');
- $_ = $base;
- }
- push(@groups, 'new');
- my $group_selection = get_entry('Select group', 'new', 0, @groups);
- if($group_selection eq 'new') {
- $group_selection = get_entry('Name of new group', '', 0);
- if(-e "$dotswift_directory/groups/$group_selection.group") {
- print "Group named $group_selection already exists!\n";
- exit;
- }
- open(GROUPFILE, ">$dotswift_directory/groups/$group_selection.group")
- || die "Unable to create group file $dotswift_directory/groups/$group_selection.group";
- print "Group $group_selection created\n";
- close(GROUPFILE);
- }
-
- my $quit = 0;
- my $group_filename = "$dotswift_directory/groups/$group_selection.group";
-
- while($quit == 0) {
- print "\n(A)dd, (r)emove, (l)ist, or (q)uit: ";
- my $command = <STDIN>;
- chomp($command);
-
- if(lc($command) eq 'a') {
- add_to_group($group_filename);
- }
- elsif(lc($command) eq 'q') {
- $quit = 1;
- }
- elsif(lc($command) eq 'r') {
- remove_from_group($group_filename);
- }
- elsif(lc($command) eq 'l') {
- list_group($group_filename);
- }
- else {
- print "Unknown option: $command\n";
- }
- }
-}
-
-# Add/Edit applications
-if($option_applications) {
- my @applications = glob("$dotswift_directory/apps/*");
- foreach(@applications) {
- $_ = strip_directory($_);
- my ($base, $ext) = split('\.');
- $_ = $base;
- }
- push(@applications, 'new');
-
- my $application_set = get_entry('Select application set', 'linux', 0,
- @applications);
- if($application_set eq 'new') {
- $application_set = get_entry('Name of new application set', '', 0);
- my $now = time();
- if(-e "$dotswift_directory/apps/$application_set.apps") {
- print "Set named $application_set already exists\n";
- exit;
- }
- open(APPFILE, ">$dotswift_directory/apps/$application_set.apps")
- || die "Unable to create file $dotswift_directory/apps/$application_set.apps";
- print "$application_set set created\n";
- close(APPFILE);
- }
-
- my $quit = 0;
- while($quit == 0) {
- print "\n(E)dit, (a)dd, (r)emove, (l)ist, or (q)uit: ";
- my $command = <STDIN>;
- chomp($command);
-
- if(lc($command) eq 'a') {
- add_application("$dotswift_directory/apps/$application_set.apps");
- }
- elsif(lc($command) eq 'q') {
- $quit = 1;
- }
- elsif(lc($command) eq 'r') {
- remove_application("$dotswift_directory/apps/$application_set.apps");
- }
- elsif(lc($command) eq 'l') {
- list_applications("$dotswift_directory/apps/$application_set.apps");
- }
- elsif(lc($command) eq 'e') {
- edit_application("$dotswift_directory/apps/$application_set.apps");
- }
- else {
- print "Unknown option: $command\n";
- }
- }
-}
-
-# Import existing configurations
-if($option_import) {
- if($option_import =~ m/\.xml/gi) {
- import_xml($option_import);
- }
- if($option_import =~ m/\.data/gi) {
- import_tc($option_import);
- }
-}
-
-# List various about swiftconfig
-if($option_list) {
-
- if ($option_list eq "templates") {
- print_directory($template_directory);
- }
- elsif ($option_list eq "configs" || $option_list eq "sites") {
- print_directory("$dotswift_directory/sites");
- }
- # Assume it's the name of a configuration
- else {
- my @matched_configs = glob("$dotswift_directory/sites/$option_list");
- foreach my $site (@matched_configs) {
- if(-e "$site/sites.xml") {
- print "sites.xml:\n";
- system("cat $site/sites.xml");
- print "\n";
- }
- else {
- print "Unable to find configuration $option_list\n";
- }
- if(-e "$site/apps") {
- open(APPFILE, "$site/apps") || die "Unable to open $site/apps";
- my @appdata = <APPFILE>;
- close(APPFILE);
- print "Application sets: ";
- foreach my $app(@appdata) {
- chomp($app);
- print "$app ";
- }
- print "\n\n";
- }
- }
- }
-}
-
-
-__END__
-
-=head1 NAME
-
-swiftconfig - Utility for managing Swift configuration
-
-=head1 SYNOPSIS
-
-swiftconfig [B<-option> value]
-
-=head1 OVERVIEW
-
-The swiftconfig program allows users to configure Swift. It enables users to
-add configurations based on templates, copy configurations, remove configurations,
-and edit configurations.
-
-=head1 DESCRIPTION
-
-General operations:
- -template sitename Add a configuration based on a template
- -remove site Removes a site configuration
- -edit site Specifies the name of a configuration to edit
- -copy site Copies a configuration
- -defaults Do not prompt for values, always use defaults
- -full Edit every available configuration option
- -import Import a sites.xml file into swiftconfig
- -list Options: templates, configs, or a config
- -apps Edit or create application sets
- -groups Edit site groupings
-
-=head1 EXAMPLES
-
-List all templates available for adding
- swiftconfig -list templates
-
-Add a site from template into a working configuration
- swiftconfig -template ssh
-
-Edit a configuration
- swiftconfig -edit teraport
-
-Remove a site
- swiftconfig -remove teraport
-
-Edit application sets
- swiftconfig -apps
-
-List all configurations
- swiftconfig -list configs
-
-List information about one particular configuration
- swiftconfig -list configuration_name
-
-=cut
Deleted: trunk/bin/swiftstat
===================================================================
--- trunk/bin/swiftstat 2013-10-30 17:47:19 UTC (rev 7252)
+++ trunk/bin/swiftstat 2013-10-30 18:10:44 UTC (rev 7253)
@@ -1,3 +0,0 @@
-#!/bin/bash
-
-watch --no-title -n 5 "find -L $HOME/.swift/runs/current -name swift.out -exec echo \; -exec dirname {} \; -exec tail -1 {} \;"
Modified: trunk/build.xml
===================================================================
--- trunk/build.xml 2013-10-30 17:47:19 UTC (rev 7252)
+++ trunk/build.xml 2013-10-30 18:10:44 UTC (rev 7253)
@@ -75,8 +75,8 @@
<copy todir="${dist.dir}/libexec">
<fileset dir="${cog.dir}/modules/${module.name}/libexec"/>
</copy>
- <copy todir="${dist.dir}/bin" flatten="true">
- <fileset dir="${cog.dir}/modules/${module.name}/bin" excludes="grid/TODO,grid/README"/>
+ <copy todir="${dist.dir}/bin">
+ <fileset dir="${cog.dir}/modules/${module.name}/bin"/>
</copy>
<copy todir="${dist.dir}/lib/perl">
<fileset dir="${cog.dir}/modules/${module.name}/lib/perl"/>
@@ -85,41 +85,15 @@
<chmod perm="+x">
<fileset dir="${dist.dir}/bin">
- <include name="VDL2Karajan"/>
- <include name="vdlc"/>
- <include name="swift-plot-log"/>
- <include name="swiftconfig"/>
- <include name="swiftrun"/>
- <include name="nswift"/>
<include name="gensites"/>
- <include name="chxml"/>
+ <include name="nswift"/>
<include name="start-coaster-service"/>
<include name="stop-coaster-service"/>
- <include name="run-worker.sh"/>
- <include name="start-grid-service"/>
- <include name="run-gwms-workers"/>
- <include name="foreachsite"/>
- <include name="gen_gridsites"/>
- <include name="get_greensites"/>
- <include name="maketcfrominst"/>
- <include name="mk_catalog.rb"/>
- <include name="mk_cats.rb"/>
- <include name="mk_osg_sitetest.rm"/>
- <include name="osgcat"/>
- <include name="ress.rb"/>
- <include name="ressfields"/>
- <include name="run_workers"/>
- <include name="sites"/>
- <include name="start-ranger-service"/>
- <include name="start-swift-service"/>
- <include name="swift-workers"/>
- <include name="worker.sh"/>
- <include name="workers.ranger.sh"/>
- <include name="slurm-qsub"/>
- <include name="slurm-qsub-emulator"/>
- <include name="slurm-qdel"/>
- <include name="slurm-qstat"/>
+ <include name="swiftrun"/>
+ <include name="swift-plot-log"/>
<include name="swift-service"/>
+ <include name="VDL2Karajan"/>
+ <include name="vdlc"/>
</fileset>
</chmod>
<chmod perm="+x">
More information about the Swift-commit
mailing list