[Swift-commit] r3531 - usertools/swift/swiftconfig/bin
noreply at svn.ci.uchicago.edu
noreply at svn.ci.uchicago.edu
Fri Aug 13 13:46:32 CDT 2010
Author: davidk
Date: 2010-08-13 13:46:31 -0500 (Fri, 13 Aug 2010)
New Revision: 3531
Modified:
usertools/swift/swiftconfig/bin/swiftrun
Log:
run.####
Modified: usertools/swift/swiftconfig/bin/swiftrun
===================================================================
--- usertools/swift/swiftconfig/bin/swiftrun 2010-08-13 15:43:27 UTC (rev 3530)
+++ usertools/swift/swiftconfig/bin/swiftrun 2010-08-13 18:46:31 UTC (rev 3531)
@@ -88,21 +88,19 @@
);
-# Verify user-created profile info exists
-my ( $seconds, $minutes, $hours, $days, $months, $years, @junk ) =
- localtime(time);
-my $date_string = sprintf "%04s-%02s-%02s-%02s%02s%02s-%s", $years + 1900,
- $months + 1, $days, $hours, $minutes, $seconds, getpgrp(0);
+# Create run directory
+my $script_filename = strip_directory($option_script);
my $dotswift_directory = "$ENV{'HOME'}/.swift";
+my @run_directories = <run.????>;
+if(!@run_directories) {
+ $run_directories[0] = "run.0000";
+}
+my ($run_number) = $run_directories[-1] =~ m{(\d+)};
+$run_number++;
+my $run_directory = getcwd() . "/" . sprintf "run.%04s", $run_number;
+create_directory($run_directory);
+copy_file( "$option_script", "$run_directory" );
-# Run job
-my $script_filename = strip_directory($option_script);
-create_directory("$dotswift_directory/jobs");
-create_directory("$dotswift_directory/jobs/$script_filename");
-create_directory("$dotswift_directory/jobs/$script_filename/$date_string");
-copy_file( "$option_script",
- "$dotswift_directory/jobs/$script_filename/$date_string" );
-
# Create configuration files for run
foreach my $site (@option_sites) {
# Handle 'all' to use all available configurations at once
@@ -117,10 +115,8 @@
if ( !-e "$all_site/tc.data" ) {
die "Unable to find tc.data for $all_site\n";
}
- cat_file( "$all_site/sites.xml",
- "$dotswift_directory/jobs/$script_filename/$date_string/sites.xml" );
- cat_file( "$all_site/tc.data",
- "$dotswift_directory/jobs/$script_filename/$date_string/tc.data" );
+ cat_file( "$all_site/sites.xml", "$run_directory/sites.xml" );
+ cat_file( "$all_site/tc.data", "$run_directory/tc.data" );
}
}
@@ -136,15 +132,14 @@
die "Unable to find tc.data for $site\n";
}
cat_file( "$dotswift_directory/sites/$site/sites.xml",
- "$dotswift_directory/jobs/$script_filename/$date_string/sites.xml" );
+ "$run_directory/sites.xml" );
cat_file( "$dotswift_directory/sites/$site/tc.data",
- "$dotswift_directory/jobs/$script_filename/$date_string/tc.data" );
+ "$run_directory/tc.data" );
}
}
# Link input data
foreach my $input_file (@option_inputs) {
-
# Check for relative path
my $first_char = substr $input_file, 0, 1;
if( $first_char ne '/') {
@@ -154,27 +149,27 @@
if ( !-e $input_file ) {
die "Unable to find requested input file: $input_file\n";
}
- my $new_path = "$dotswift_directory/jobs/$script_filename/$date_string/"
- . strip_directory($input_file);
+ my $new_path = "$run_directory/" . strip_directory($input_file);
symlink $input_file, $new_path
|| die "Unable to create symlink to $new_path\n";
}
# Complete XML tags
-my $site_filename =
- "$dotswift_directory/jobs/$script_filename/$date_string/sites.xml";
-open( SITEFILE, "$site_filename" ) || die "Unable to open $site_filename\n";
+open( SITEFILE, "$run_directory/sites.xml" )
+ || die "Unable to open $run_directory/sites.xml\n";
my @sitedata = <SITEFILE>;
close(SITEFILE);
-open( SITEFILE, ">$site_filename" ) || die "Unable to open $site_filename\n";
+open( SITEFILE, ">$run_directory/sites.xml" )
+ || die "Unable to open $run_directory/sites.xml for writing\n";
print SITEFILE "<config>\n at sitedata</config>\n";
close(SITEFILE);
# Run swift
-my $run_directory = "$dotswift_directory/jobs/$script_filename/$date_string";
chdir("$run_directory") || die "Unable to chdir to $run_directory\n";
print "Submitting job. Check $run_directory for details\n";
-my $system_command = "swift -sites.file $site_filename "
+my $system_command =
+ 'swift '
+ . "-sites.file $run_directory/sites.xml "
. "-tc.file $run_directory/tc.data "
. "$option_script ";
More information about the Swift-commit
mailing list