Ignore:
Timestamp:
Mar 22, 2016, 7:16:03 AM (9 years ago)
Author:
gah
Message:

update w/ changes to cache hit reporting

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/1.6/lang/tcl/scripts/task.tcl

    r6169 r6176  
    1919
    2020itcl::class Rappture::Task {
    21     private method CheckCacheForRunFile { driverFile }
     21    private method CheckForCachedRunFile { driverFile }
    2222    private method CollectUQResults {}
    2323    private method ExecuteSimulationCommand { cmd }
     
    5050    public method save {xmlobj {name ""}}
    5151
    52     protected method _output {data}
     52    protected method OnOutput {data}
    5353    protected method Log {args}
    5454    protected method BuildSubmitCommand {cmd tfile params_file}
     
    138138itcl::body Rappture::Task::GetSignal {code} {
    139139    set signals {
    140         HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV
     140        xxx HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV
    141141        USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN
    142142        TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS
     
    229229    set cached 0
    230230    if { [IsCacheable] } {
     231puts stderr "Cache checking: [time {
    231232        set cached [CheckForCachedRunFile $driverFile]
     233     } ]"
     234puts stderr "checking cache=$cached"
    232235    }
    233236    if { !$cached } {
     237puts stderr "1._uq(type)=$_uq(type)"
    234238        if { $_uq(type) != "" } {
    235239            set _uq(tfile) [GetUQTemplateFile]
     
    240244            set cmd [GetUQSimulationCommand $driverFile]
    241245        }
     246puts stderr "2. cmd=$cmd"
    242247        if { $cmd == "" } {
    243248            puts stderr "cmd is empty"
     
    249254        }
    250255        Rappture::rusage mark
     256puts stderr "3. _uq(type)=$_uq(type)"
    251257        if { ![ExecuteSimulationCommand $cmd] } {
     258puts stderr "4. job(mesg)=$_job(mesg)"
    252259            return [list 1 $_job(mesg)]
    253260        }
    254         if { $_uq(type) != "" } {
    255             CollectUQResults
    256         }
     261puts stderr "5. _uq(type)=$_uq(type)"
    257262        if { [resources -jobprotocol] == "submit" } {
    258263            LogSubmittedSimulationUsage
     
    412417
    413418# ----------------------------------------------------------------------
    414 # USAGE: _output <data>
     419# USAGE: OnOutput <data>
    415420#
    416421# Used internally to send each bit of output <data> coming from the
    417422# tool onto the caller, so the user can see progress.
    418423# ----------------------------------------------------------------------
    419 itcl::body Rappture::Task::_output {data} {
     424itcl::body Rappture::Task::OnOutput {data} {
    420425    if {[string length $_outputcb] > 0} {
    421426        uplevel #0 $_outputcb [list $data]
     
    461466        return 0
    462467    }
    463     set state [$_xmlobj get "tool.cached"]
     468if 0 {
     469    set state [$_xmlobj get "tool.cache"]
    464470    if { $state == "" } {
    465471        return 0
    466472    }
     473} else {
     474    set state 1
     475}
    467476    if { ![string is boolean $state] } {
    468477        return 0
     
    603612            -keepnewline yes \
    604613            -killsignal  SIGTERM \
    605             -onoutput    [list [itcl::code $this _output]] \
     614            -onoutput    [list [itcl::code $this OnOutput]] \
    606615            -output      [list [itcl::scope _job(stdout)]] \
    607616            -error       [list [itcl::scope _job(stderr)]] \
    608617            $cmd
    609618    } result
    610 
     619puts stderr "stderr=$_job(stderr) stdout=$_job(stdout)"
    611620    # Step 4. Check the token and the exit code.
    612621    set logmesg $result
     
    642651        return 0;                       # Fail
    643652    }
    644    
     653        if { $_uq(type) != "" } {
     654            CollectUQResults
     655        }
     656    puts stderr "_job(stdout)=$_job(stdout) _job(stderr)=$_job(stderr)"
    645657    # Step 5. Look in stdout for the name of the run file.
    646658    set pattern {=RAPPTURE-RUN=>([^\n]+)}
     
    839851    }
    840852    # Get the session from runfile
    841     set session [$xmlobj get "tool.session"]
    842     catch exec {submit --cache $session} result
     853    set session [$xmlobj get "output.session"]
     854    if { [catch {exec submit --cache $session} result] != 0 } {
     855       puts stderr "submit --cache failed: $result"
     856    }
    843857    set _job(xmlobj) $xmlobj
    844858}
    845859
    846860
    847 itcl::body Rappture::Task::CheckCacheForRunFile { driverFile } {
     861itcl::body Rappture::Task::CheckForCachedRunFile { driverFile } {
    848862
    849863    # Read the driver file and collect its contents as the query.
     
    880894    close $f
    881895    set _job(runfile) $fileName
     896    set _job(success) 1
     897    set _job(stderr) "Loading cached results\n"
     898    OnOutput "Loading cached results\n"
    882899    return 1
    883900}
     
    885902# UQ. Collect data from all jobs and put it in one xml run file.
    886903itcl::body Rappture::Task::CollectUQResults {} {
     904   puts stderr "CollectUQResult"
    887905    file delete -force -- "run_uq.xml"
    888906    global rapptureInfo
     
    891909        exec puq analyze $puqFileName
    892910    } fileName] != 0 } {
     911   puts stderr "puq analyze failed: $fileName"
    893912        set f [open "uq_debug.err" r]
    894913        set rdata [read $f]
     
    899918        set _job(runfile) $fileName
    900919    }
    901 }
     920   puts stderr "runfile=$_job(runfile)"
     921}
Note: See TracChangeset for help on using the changeset viewer.