Changeset 6205 for branches/1.6/lang


Ignore:
Timestamp:
Mar 24, 2016, 3:55:41 AM (8 years ago)
Author:
gah
Message:

fix new puq handling routine in task.tcl

File:
1 edited

Legend:

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

    r6189 r6205  
    235235    }
    236236    if { !$cached } {
    237 puts stderr "1._uq(type)=$_uq(type)"
    238237        if { $_uq(type) != "" } {
    239238            set _uq(tfile) [GetUQTemplateFile]
     
    244243            set cmd [GetUQSimulationCommand $driverFile]
    245244        }
    246 puts stderr "2. cmd=$cmd"
    247245        if { $cmd == "" } {
    248246            puts stderr "cmd is empty"
     
    254252        }
    255253        Rappture::rusage mark
    256 puts stderr "3. _uq(type)=$_uq(type)"
    257254        if { ![ExecuteSimulationCommand $cmd] } {
    258 puts stderr "4. job(mesg)=$_job(mesg)"
    259255            return [list 1 $_job(mesg)]
    260256        }
    261 puts stderr "5. _uq(type)=$_uq(type)"
    262257        if { [resources -jobprotocol] == "submit" } {
    263258            LogSubmittedSimulationUsage
     
    489484        exec puq.sh get_params $pid $_uq(varlist) $_uq(type) $_uq(args)
    490485    } errs] != 0 } {
    491         set fp [open "uq_debug.err" r]
    492         set contents [read $fp]
    493         close $fp
     486        set contents {}
     487        if { [file exists "uq_debug.err"] } {
     488            set f [open "uq_debug.err" r]
     489            set contents [read $f]
     490            close $f
     491        }
    494492        puts stderr "get_params.py failed: $contents"
    495         error "get_params.py: $errs\n$contents"
     493        error "get_params.py failed: $errs\n$contents"
    496494    }
    497495    return "params[pid].csv"
     
    574572    global rapptureInfo
    575573    # Copy xml into a new file
    576     set templateFile [file join $rapptureInfo(cwd) "template[pid].xml"]
    577     set fid [open $templateFile w]
    578     puts $fid "<?xml version=\"1.0\"?>"
    579     puts $fid [$_xmlobj xml]
    580     close $fid
     574    set templateFile "template[pid].xml"
     575    set f [open $templateFile w]
     576    puts $f "<?xml version=\"1.0\"?>"
     577    puts $f [$_xmlobj xml]
     578    close $f
    581579
    582580    # Return a list of the UQ variables and their PDFs.
     
    617615            $cmd
    618616    } result
    619 puts stderr "stderr=$_job(stderr) stdout=$_job(stdout)"
     617
    620618    # Step 4. Check the token and the exit code.
    621619    set logmesg $result
     
    651649        return 0;                       # Fail
    652650    }
    653         if { $_uq(type) != "" } {
    654             CollectUQResults
    655         }
    656     puts stderr "_job(stdout)=$_job(stdout) _job(stderr)=$_job(stderr)"
     651    if { $_uq(type) != "" } {
     652        CollectUQResults
     653    }
     654
    657655    # Step 5. Look in stdout for the name of the run file.
    658656    set pattern {=RAPPTURE-RUN=>([^\n]+)}
     
    871869        http::geturl $url -query $query -timeout 60000 -binary yes
    872870    } token] != 0 } {
    873         puts stderr "can't get query: token=$token"
     871        puts stderr "error performing cache query: token=$token"
    874872        return 0
    875873    }
     
    883881        return 0
    884882    }
     883
    885884    # Create a new run.xml file and write the results into it.
    886885    set secs [clock seconds]
     
    902901# UQ. Collect data from all jobs and put it in one xml run file.
    903902itcl::body Rappture::Task::CollectUQResults {} {
    904    puts stderr "CollectUQResult"
    905903    file delete -force -- "run_uq.xml"
    906     global rapptureInfo
    907     set puqFileName [file join $rapptureInfo(cwd) puq_[pid].hdf5]
    908     if {[catch {
    909         exec puq.sh analyze $puqFileName
    910     } fileName] != 0 } {
    911    puts stderr "puq.sh analyze failed: $fileName"
    912         set f [open "uq_debug.err" r]
    913         set rdata [read $f]
    914         close $f
    915         puts "PUQ analysis failed: $fileName\n$rdata"
    916         error "UQ analysis failed: $fileName\n$rdata"
     904    set hdfFile puq_[pid].hdf5
     905    if { [catch {
     906        exec puq.sh analyze $hdfFile
     907    } results] != 0 } {
     908        set rdata {}
     909        if { [file exists "uq_debug.err" ] } {
     910            set f [open "uq_debug.err" r]
     911            set rdata [read $f]
     912            close $f
     913        }
     914        puts stderr "UQ analysis failed: $results\n$rdata"
     915        error "UQ analysis failed: $results\n$rdata"
    917916    } else {
    918         set _job(runfile) $fileName
    919     }
    920    puts stderr "runfile=$_job(runfile)"
    921 }
     917        set _job(stdout) $results
     918    }
     919}
Note: See TracChangeset for help on using the changeset viewer.