Changeset 2ef2c5b for fedkit


Ignore:
Timestamp:
Sep 14, 2007 11:50:23 AM (17 years ago)
Author:
Ted Faber <faber@…>
Branches:
axis_example, compt_changes, info-ops, master, version-1.30, version-2.00, version-3.01, version-3.02
Children:
321c0cb
Parents:
c9f5490
Message:

collect tarfiles info and stage them for federated experiments

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/splitter.pl

    rc9f5490 r2ef2c5b  
    8383    my($s);
    8484
     85    &ssh_cmd($user, $host, "mkdir -p $dest_dir");
    8586    for $s (@scripts) {
    8687        &scp_file("$local_script_dir/$s", "$user\@$host", $dest_dir) ||
     
    9697    my($d, $f);
    9798
     99
    98100    $d = IO::Dir->new($src_dir) || return 0;
    99101
     102    &ssh_cmd($user, $host, "mkdir -p $dest_dir");
    100103    while ( $f = $d->read()) {
    101104        next if $f =~ /^\./;
    102         &scp_file("$src_dir/$f", "$user\@$host", $dest_dir) || return 0;
     105        if ( -d "$src_dir/$f" ) {
     106            &ship_configs($host, $user, "$src_dir/$f", "$dest_dir/$f") || 0;
     107        }
     108        else {
     109            &scp_file("$src_dir/$f", "$user\@$host", $dest_dir) || return 0;
     110        }
    103111    }
    104112    return 1;
     
    156164    # Remote experiment is swapped out, modify it and swap it in.
    157165    if ($state eq "swapped") {
    158         &ssh_cmd($user, $host, "/usr/testbed/bin/modexp -w $pid $eid $tclfile",
    159             "modexp") || return 0;
    160         # First copy new scripts and hostinfo into the remote /proj
     166        # First copy new scripts and hostinfo into the remote /proj (because
     167        # the experiment exists, the directory tree should be there.
    161168        &scp_file("./hostnames", "$user\@$host", $to_hostname) || return 0;
    162169        &ship_scripts($host, $user, $proj_dir) || return 0;
    163170        &ship_configs($host, $user, "$tmpdir/$tb", $proj_dir) || return 0;
     171        &ssh_cmd($user, $host, "/usr/testbed/bin/modexp -w $pid $eid $tclfile",
     172            "modexp") || return 0;
    164173        # Now start up
    165174        &ssh_cmd($user, $host, "/usr/testbed/bin/swapexp -w $pid $eid in",
     
    276285# Open a pipe to the splitter program and start it parsing the experiments
    277286$pipe = new IO::Pipe;
    278 $pipe->reader("$tclsh $tcl_splitter -s -m $master -p $pid $gid $eid $tcl") ||
    279     die "Cannot execute $tclsh $tcl_splitter -s -p $pid $gid $eid $tcl:$!\n";
     287# NB no more -p call on parse call.
     288$pipe->reader("$tclsh $tcl_splitter -s -m $master  $pid $gid $eid $tcl") ||
     289    die "Cannot execute $tclsh $tcl_splitter -s -m $master $pid $gid $eid $tcl:$!\n";
    280290
    281291# Parse the splitter output.  This loop creates the sub experiments, gateway
     
    406416        next;
    407417    };
    408 
     418    (/^#\s+Begin\s+tarfiles/../^#\s+End\s+tarfiles/) && do {
     419        next if /^#/;
     420        chomp;
     421        push(@tarfiles, $_);
     422        next;
     423    };
    409424
    410425    next unless $destfile;  # Unidentified testbed, ignore config
     
    428443$pipe->close();
    429444die "No nodes in master testbed ($master)\n" unless $allocated{$master};
     445
     446for $t (@tarfiles) {
     447    die "tarfile '$t' unreadable: $!\n" unless -r $t;
     448    for $tb (keys %allocated) {
     449        unless (-d "$tmpdir/$tb/tarfiles") {
     450            mkdir("$tmpdir/$tb/tarfiles") ||
     451                die "Can't create $tmpdir/$tb/tarfiles:$!\n";
     452        }
     453        copy($t, "$tmpdir/$tb/tarfiles") ||
     454                die "Can't copy $t to  $tmpdir/$tb/tarfiles:$!\n";
     455    }
     456}
    430457
    431458exit(0) unless $startem;
Note: See TracChangeset for help on using the changeset viewer.