[Swift-commit] r7598 - branches/release-0.95/bin
davidk at ci.uchicago.edu
davidk at ci.uchicago.edu
Sun Feb 16 13:44:27 CST 2014
Author: davidk
Date: 2014-02-16 13:44:27 -0600 (Sun, 16 Feb 2014)
New Revision: 7598
Modified:
branches/release-0.95/bin/swiftrun
Log:
Some fixes for config.rundir=false
Start run directories at run001 instead of run000
Modified: branches/release-0.95/bin/swiftrun
===================================================================
--- branches/release-0.95/bin/swiftrun 2014-02-16 16:44:22 UTC (rev 7597)
+++ branches/release-0.95/bin/swiftrun 2014-02-16 19:44:27 UTC (rev 7598)
@@ -348,14 +348,22 @@
swiftquit "Error: Missing value for property \"$property_input\"";
}
- $key = lc($key);
+ if( $key !~ m/^app\./) { $key = lc($key); }
$value =~ s/^\s+//g;
if($key eq "sites") { $key = "site"; }
- $value =~ s/\$(\w+)/$ENV{$1}/g;
$properties{ $key } = $value;
}
+# Replace environment variables in properties
+sub env_replace {
+ foreach my $key (sort keys %properties) {
+ my $value = $properties{$key};
+ $value =~ s/\$(\w+)/$ENV{$1}/g;
+ $properties{$key} = $value;
+ }
+}
+
# Getopt::Long can't accept dots in arguments, work around to make things easy
foreach my $arg(@ARGV) {
$arg =~ s/sites.file/sitesfile/g;
@@ -386,7 +394,7 @@
}
# Create/increment run directory
-my $run_number = 0;
+my $run_number = 1;
my @run_directories = <run[0-9][0-9][0-9]>;
if(@run_directories) {
@@ -395,12 +403,6 @@
$run_number++;
}
-$run_directory = getcwd() . "/" . sprintf "run%03s", $run_number;
-$ENV{RUNDIRECTORY} = "$run_directory";
-if(!$option_listconfig) {
- mkdir($run_directory) || &swiftquit("Unable to create run directory $run_directory");
-}
-
# Set @sites array from comma separated list of sites
if(defined($option_siteslist)) {
@sites = split(',', $option_siteslist);
@@ -441,7 +443,6 @@
&record_property( $prefix . ".$_" );
}
}
-
else {
&record_property($_);
}
@@ -462,15 +463,26 @@
exit;
}
+# Determine run directory situation
if(!defined($properties{"config.rundirs"}) || $properties{"config.rundirs"} ne "false") {
+ $run_directory = getcwd() . "/" . sprintf "run%03s", $run_number;
+ if(!$option_listconfig) {
+ mkdir($run_directory) || &swiftquit("Unable to create run directory $run_directory");
+ }
+
@new_swift_args = ("-Dscript.dir=$run_directory/scripts");
push(@new_swift_args, "-Drestart.log.name=$run_directory/restart.log");
push(@new_swift_args, "-swiftoutlog=$run_directory/swift.out");
push(@new_swift_args, "-runid " . basename($run_directory));
push(@new_swift_args, "-Ddebug.dir.prefix=" . basename($run_directory) . "/");
push(@new_swift_args, sprintf( "-logfile $run_directory/run%03s.log", $run_number ));
+} else {
+ $run_directory = getcwd();
}
+$ENV{RUNDIRECTORY} = "$run_directory";
+&env_replace();
+
# Write swift configuration files
&write_sites("sites.xml") if defined( $option_siteslist ) || defined($properties{site});
&write_apps("apps") if !defined( $option_tcfile ) && ( defined( $option_siteslist ) || defined($properties{site}));
More information about the Swift-commit
mailing list