Changeset a835df7 for fedkit


Ignore:
Timestamp:
Sep 18, 2007 9:36:56 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:
c8c45ee
Parents:
0e23fdb
Message:

Add more progress printouts via -d or -v
flatten the config filenames to lower case so the hacky hostname trick to find config files works.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • fedkit/splitter.pl

    r0e23fdb ra835df7  
    126126# of the experiment determined using expinfo.  From that state, the experiment
    127127# is either created, modified or spapped in.  If everything succeeds, true is
    128 # returned.
     128# returned.  If the global verbose is set progress messages are printed.
    129129sub start_segment {
    130130    my($tb, $eid) = @_;                     # testbed and experiment ID
     
    152152
    153153    # Copy the experiment definition data over
     154    print "transferring subexperiment to $tb\n" if $verbose;
    154155    &scp_file("$tmpdir/$tb/$tclfile", "$user\@$host") || return 0;
    155156    # Clear out any old experiment data; if not deleted, copies over it by
     
    159160    # tmp around))  Again, this needs to be done more properly once we have a
    160161    # non-ssh interface here.)
     162    print "clearing experiment subdirs on $tb\n" if $verbose;
    161163    &ssh_cmd($user, $host, "/bin/sh -c \\'/bin/rm -rf $proj_dir/*\\'") ||
    162164        return 0;
    163165    # Remote experiment is active.  Modify it.
    164166    if ($state eq "active") {
     167        print "Transferring federation support files to $tb\n" if $verbose;
    165168        # First copy new scripts and hostinfo into the remote /proj
    166169        &scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||
     
    168171        &ship_scripts($host, $user, $proj_dir) || return 0;
    169172        &ship_configs($host, $user, "$tmpdir/$tb", $proj_dir) || return 0;
     173
     174        print "Modifying $eid in place on $tb\n" if $verbose;
    170175        &ssh_cmd($user, $host, "/usr/testbed/bin/modexp -r -s -w $pid " .
    171176            "$eid $tclfile", "modexp") || return 0;
     
    175180    # Remote experiment is swapped out, modify it and swap it in.
    176181    if ($state eq "swapped") {
     182        print "Transferring federation support files to $tb\n" if $verbose;
    177183        # First copy new scripts and hostinfo into the remote /proj (because
    178184        # the experiment exists, the directory tree should be there.
     
    181187        &ship_scripts($host, $user, $proj_dir) || return 0;
    182188        &ship_configs($host, $user, "$tmpdir/$tb", $proj_dir) || return 0;
     189
     190        print "Modifying $eid on $tb\n" if $verbose;
    183191        &ssh_cmd($user, $host, "/usr/testbed/bin/modexp -w $pid $eid $tclfile",
    184192            "modexp") || return 0;
     193        print "Swapping $eid in on $tb\n" if $verbose;
    185194        # Now start up
    186195        &ssh_cmd($user, $host, "/usr/testbed/bin/swapexp -w $pid $eid in",
     
    192201    # the configuration files and scripts into the new experiment directories.
    193202    if ($state eq "none") {
     203        print "Creating $exp on $tb\n" if $verbose;
    194204        &ssh_cmd($user, $host, "/usr/testbed/bin/startexp -f -w -p " .
    195205            "$pid -e $eid $tclfile", "startexp") || return 0;
     206        print "Transferring federation support files to $tb\n" if $verbose;
    196207        # First copy new scripts and hostinfo into the remote /proj
    197208        &scp_file("$tmpdir/hostnames", "$user\@$host", $to_hostname) ||
     
    200211        &ship_configs($host, $user, "$tmpdir/$tb", $proj_dir) || return 0;
    201212        # Now start up
     213        print "Swapping $eid in on $tb\n" if $verbose;
    202214        &ssh_cmd($user, $host, "/usr/testbed/bin/swapexp -w $pid $eid in",
    203215            "swapexp") || return 0;
     
    220232    my($pid) = $project{$tb};
    221233
     234    print "Stopping $eid on $tb\n" if $verbose;
    222235    &ssh_cmd($user, $host, "/usr/testbed/bin/swapexp -w $pid $eid out",
    223236        "swapexp (out)") || return 0;
     
    232245                                    # keep our changes to the parser minimal.
    233246# Argument processing.
    234 getopts('c:f:nd', \%opts);
     247getopts('c:f:ndv', \%opts);
    235248$splitter_config = $opts{'c'} || "./splitter.conf";
    236249$debug = $opts{'d'};
     250$verbose = $opts{'v'} || $opts{'d'};
     251
    237252&parse_config("$splitter_config", \%opts) ||
    238253    die "Cannot read config file $splitter_conf: $!\n";
     
    266281$tmpdir .= "/split$$";
    267282
     283print "Temp files are in $tmpdir\n" if $verbose;
    268284# Create a workspace
    269285unless (-d "$tmpdir") {
     
    410426        $ddomain = ".$eid.$project{$dtb}$ddomain";
    411427
     428        my($conf_file) = "$myname$sdomain.gw.conf";
     429        # translate to lower case so the `hostname` hack for specifying
     430        # configuration files works.
     431        $conf_file =~ tr/A-Z/a-z/;
     432
    412433        # If either end of this link is in the master side of the testbed, that
    413434        # side is the active end. Otherwise the first testbed encountered in
     
    424445
    425446        # Write out the file
    426         $gwconfig= new IO::File(">$tmpdir/$gateways/$myname$sdomain.gw.conf")||
    427             die "can't open $tmpdir/$gateways/$myname$sdomain.gw.conf: $!\n";
     447        $gwconfig= new IO::File(">$tmpdir/$gateways/$conf_file")||
     448            die "can't open $tmpdir/$gateways/$conf_file: $!\n";
    428449
    429450        print $gwconfig "Active: $active\n";
     
    521542}
    522543print "Experiment started\n";
     544print "Deleting $tmpdir (-d to leave them in place)\n" if $verbose && !$debug;
    523545system("rm -rf $tmpdir") unless $debug;
    524546exit(0);    # set the exit value
Note: See TracChangeset for help on using the changeset viewer.