Changeset b68f597 for fedkit/splitter.pl


Ignore:
Timestamp:
Sep 21, 2007 10:26:25 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:
4e794c9f
Parents:
fe459d0
Message:

Support starting experiments remotely again, which tarfile support broke.

Tarfiles are now stored directly under /proj/PROJECT/tarfiles/EXPERIMENT rather than /proj/PROJECT/exp/EXPERIMENT/tarfiles which was a bad idea.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/splitter.pl

    rfe459d0 rb68f597  
    112112# current user is used.
    113113sub scp_file {
    114     my($file, $where, $dest) = @_;
     114    my($file, $user, $host, $dest) = @_;
    115115
    116116    # XXX system with a relative pathname is sort of gross
    117     system("scp $file $where:$dest");
     117    system("scp $file $user\@$host:$dest");
    118118    if ($?) {
    119119        warn "scp failed $?\n";
     
    149149    &ssh_cmd($user, $host, "mkdir -p $dest_dir");
    150150    for $s (@scripts) {
    151         &scp_file("$local_script_dir/$s", "$user\@$host", $dest_dir) ||
     151        &scp_file("$local_script_dir/$s", $user, $host, $dest_dir) ||
    152152            return 0;
    153153    }
     
    174174        }
    175175        else {
    176             &scp_file("$src_dir/$f", "$user\@$host", $dest_dir) || return 0;
     176            &scp_file("$src_dir/$f", $user, $host, $dest_dir) || return 0;
    177177        }
    178178    }
     
    200200                                            # sub-experiment
    201201    my($proj_dir) = "/proj/$pid/exp/$eid/tmp";  # Where to stash federation stuff
     202    my($tarfiles_dir) = "/proj/$pid/tarfiles/$eid";  # Where to stash tarfiles
    202203    my($to_hostname) = "$proj_dir/hosts";   # remote hostnames file
    203204    my($status) = new IO::Pipe;             # The pipe to get status
     
    217218    # Copy the experiment definition data over
    218219    print "transferring subexperiment to $tb\n" if $verbose;
    219     &scp_file("$tmpdir/$tb/$tclfile", "$user\@$host") || return 0;
     220    &scp_file("$tmpdir/$tb/$tclfile", $user, $host) || return 0;
    220221    # Clear out any old experiment data; if not deleted, copies over it by
    221222    # different users will fail.
     
    227228    &ssh_cmd($user, $host, "/bin/sh -c \\'/bin/rm -rf $proj_dir/*\\'") ||
    228229        return 0;
     230    print "clearing experiment tarfiles subdirs on $tb\n" if $verbose;
     231    &ssh_cmd($user, $host, "/bin/rm -rf $tarfiles_dir/") ||
     232        return 0;
     233    print "creating tarfiles subdir $tarfiles_dir on $tb\n" if $verbose;
     234    &ssh_cmd($user, $host, "mkdir -p $tarfiles_dir", "create tarfiles") ||
     235        return 0;
    229236    # Remote experiment is active.  Modify it.
    230237    if ($state eq "active") {
    231238        print "Transferring federation support files to $tb\n" if $verbose;
    232239        # First copy new scripts and hostinfo into the remote /proj
    233         &scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||
     240        &scp_file("$tmpdir/hostnames", $user, $host, $to_hostname) ||
    234241            return 0;
    235242        &ship_scripts($host, $user, $proj_dir) || return 0;
    236243        &ship_configs($host, $user, "$tmpdir/$tb", $proj_dir) || return 0;
     244        if ( -d "$tmpdir/tarfiles") {
     245            &ship_configs($host, $user, "$tmpdir/tarfiles", $tarfiles_dir) ||
     246                return 0;
     247        }
    237248
    238249        print "Modifying $eid in place on $tb\n" if $verbose;
     
    247258        # First copy new scripts and hostinfo into the remote /proj (because
    248259        # the experiment exists, the directory tree should be there.
    249         &scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||
     260        &scp_file("$tmpdir/hostnames", $user, $host, $to_hostname) ||
    250261            return 0;
    251262        &ship_scripts($host, $user, $proj_dir) || return 0;
    252263        &ship_configs($host, $user, "$tmpdir/$tb", $proj_dir) || return 0;
     264        if ( -d "$tmpdir/tarfiles") {
     265            &ship_configs($host, $user, "$tmpdir/tarfiles", $tarfiles_dir) ||
     266                return 0;
     267        }
    253268
    254269        print "Modifying $eid on $tb\n" if $verbose;
     
    265280    # the configuration files and scripts into the new experiment directories.
    266281    if ($state eq "none") {
     282
     283        if ( -d "$tmpdir/tarfiles") {
     284            # Tarfiles have to exist for the creation to work
     285            print "copying tarfiles to $tb\n";
     286            &ship_configs($host, $user, "$tmpdir/tarfiles", $tarfiles_dir) ||
     287                return 0;
     288        }
    267289        print "Creating $eid on $tb\n" if $verbose;
    268290        &ssh_cmd($user, $host, "/usr/testbed/bin/startexp -i -f -w -p " .
     
    270292        print "Transferring federation support files to $tb\n" if $verbose;
    271293        # First copy new scripts and hostinfo into the remote /proj
    272         &scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||
     294        &scp_file("$tmpdir/hostnames", $user, $host, $to_hostname) ||
    273295            return 0;
    274296        &ship_scripts($host, $user, $proj_dir) || return 0;
     
    574596    # XXX: oh is this bad
    575597    s#GWCONF#FEDDIR\`hostname\`.gw.conf#g;
     598    s#PROJDIR#/proj/$project{$ctb}/#g;
     599    s#EID#$eid#g;
    576600    s#FEDDIR#/proj/$project{$ctb}/exp/$eid/tmp/#g;
    577601    print FILE;
     
    582606for $t (@tarfiles) {
    583607    die "tarfile '$t' unreadable: $!\n" unless -r $t;
    584     for $tb (keys %allocated) {
    585         unless (-d "$tmpdir/$tb/tarfiles") {
    586             mkdir("$tmpdir/$tb/tarfiles") ||
    587                 die "Can't create $tmpdir/$tb/tarfiles:$!\n";
    588         }
    589         copy($t, "$tmpdir/$tb/tarfiles") ||
    590                 die "Can't copy $t to  $tmpdir/$tb/tarfiles:$!\n";
    591     }
     608    unless (-d "$tmpdir/tarfiles") {
     609        mkdir("$tmpdir/tarfiles") ||
     610            die "Can't create $tmpdir/tarfiles:$!\n";
     611    }
     612    copy($t, "$tmpdir/tarfiles") ||
     613        die "Can't copy $t to  $tmpdir/tarfiles:$!\n";
    592614}
    593615
Note: See TracChangeset for help on using the changeset viewer.