Changeset 6698 for branches/1.7


Ignore:
Timestamp:
Sep 7, 2018 11:06:01 AM (6 years ago)
Author:
clarksm
Message:

Added click and click-uq event reports
Added option to replace local uq sweep with Boinc uq sweep

File:
1 edited

Legend:

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

    r6696 r6698  
    3333    private method LogSimulationUsage {}
    3434    private method LogSubmittedSimulationUsage {}
     35    private method LogUQSimulationUsage {}
    3536    private method SetCpuResourceLimit {}
    3637
     
    5354    protected method OnOutput {data}
    5455    protected method Log {args}
    55     protected method BuildSubmitCommand {cmd tfile params_file}
     56    protected method BuildSubmitBoincCommand {tFile toolparamFile params_file}
     57    protected method BuildSubmitLocalCommand {cmd tFile params_file}
    5658    protected method GetParamsForUQ {}
    5759
     
    206208    set _outputcb ""
    207209    set _uq(type) ""
     210    set _uq(tFile) ""
     211    set _uq(toolparamFile) ""
     212    set _uq(paramsFile) ""
    208213    foreach {path val} $args {
    209214        if {$path == "-output"} {
     
    241246    if { !$cached } {
    242247        if { $_uq(type) != "" } {
    243             set _uq(tfile) [GetUQTemplateFile]
     248            set _uq(tFile) [GetUQTemplateFile]
    244249        }
    245250        if { $_uq(type) == "" } {
     
    260265            return [list 1 $_job(mesg)]
    261266        }
    262         if { [resources -jobprotocol] == "submit" } {
     267        if { $_uq(type) != "" } {
     268            LogUQSimulationUsage
     269        } elseif { [resources -jobprotocol] == "submit" } {
    263270            LogSubmittedSimulationUsage
    264271        } else {
     
    267274    } else {
    268275        LogCachedSimulationUsage
     276    }
     277    if { $_uq(tFile) ne "" } {
     278        file delete -force -- $_uq(tFile)
     279    }
     280    if { $_uq(toolparamFile) ne "" } {
     281        file delete -force -- $_uq(toolparamFile)
     282    }
     283    if { $_uq(paramsFile) ne "" } {
     284        file delete -force -- $_uq(paramsFile)
    269285    }
    270286    if { $_job(success) } {
     
    286302#  Turn the command string from tool.xml into the proper syntax to use
    287303#  with a submit parameter sweep with a temlate file.  Proper quoting
    288 # of the template file is necessary to prevent submit from being too smart
    289 # and converting it to a full pathname.
    290 # ----------------------------------------------------------------------
    291 itcl::body Rappture::Task::BuildSubmitCommand {cmd tfile params_file} {
     304#  of the template file is necessary to prevent submit from being too smart
     305#  and converting it to a full pathname.
     306# ----------------------------------------------------------------------
     307itcl::body Rappture::Task::BuildSubmitBoincCommand {tFile toolparamFile params_file} {
     308    set toolId   [$_xmlobj get tool.id]
     309    set toolVers [$_xmlobj get tool.version.application.revision]
     310    set newcmd "submit --venue boinc --progress submit --runName=puq --inputfile @:$tFile --data $params_file --env TOOL_PARAMETERS=$toolparamFile ${toolId}_r${toolVers} -w headless"
     311
     312    return $newcmd
     313}
     314
     315itcl::body Rappture::Task::BuildSubmitLocalCommand {cmd tFile params_file} {
    292316    set quote_next 0
    293     set newcmd "submit --progress submit --runName=puq -l -i @:$tfile -d $params_file"
     317    set newcmd "submit --local --progress submit --runName=puq --inputfile @:$tFile --data $params_file"
    294318    set cmds [split $cmd " "]
    295319    for {set i 0} {$i < [llength $cmds]} {incr i} {
     
    307331        }
    308332        if {$arg == "@driver"} {
    309             set arg "\"\\\"$tfile\\\"\""
     333            set arg "\"\\\"$tFile\\\"\""
    310334        }
    311335        append newcmd " " $arg
    312336    }
    313     regsub -all @driver $newcmd $tfile newcmd
     337    regsub -all @driver $newcmd $tFile newcmd
     338
    314339    return $newcmd
    315340}
     
    561586        return ""
    562587    }
    563     set paramsFile [GetParamsForUQ]
    564     set cmd [BuildSubmitCommand $cmd $_uq(tfile) $paramsFile]
     588    set _uq(paramsFile) [GetParamsForUQ]
     589#   set cmd [BuildSubmitBoincCommand $_uq(tFile) $_uq(toolparamFile) $_uq(paramsFile)]
     590    set cmd [BuildSubmitLocalCommand $cmd $_uq(tFile) $_uq(paramsFile)]
     591
    565592    file delete -force puq
     593
    566594    return $cmd
    567595}
     
    577605
    578606    # Return a list of the UQ variables and their PDFs.
    579     # Also turns $uq(tfile) into a template file.
     607    # Also turns $uq(tFile) into a template file.
    580608    set _uq(varlist) [lindex [$_xmlobj uq_get_vars $templateFile] 0]
    581     set _uq(tfile) $templateFile
     609    set _uq(tFile) $templateFile
     610
     611    # Create toolparameter file
     612    set toolParameterFile "toolParameter[pid].hz"
     613    set f [open $toolParameterFile w]
     614    puts $f "file(execute):$templateFile"
     615    close $f
     616
     617    set _uq(toolparamFile) $toolParameterFile
     618
    582619    return $templateFile
    583620}
     
    779816#   }
    780817       
     818# [click] messages go here
     819    if { [string length $jobstats] > 0} {
     820        lappend args \
     821            "job"      [incr jobnum] \
     822            "event"    "\[click\]" \
     823            "start"    $times(start) \
     824            "walltime" 0 \
     825            "cputime"  0 \
     826            "status"   0
     827        uplevel #0 $jobstats $args
     828    }
     829       
    781830    #
    782831    # Scan through stderr channel and look for statements that
     
    833882    incr jobnum $subjobs
    834883
    835     # Add cputime info to run.xml file
     884    # Add session info to run.xml file
    836885    if { [catch {
    837886        Rappture::library $_job(runfile)
    838887    } xmlobj] != 0 } {
     888        error "Can't create rappture library: $xmlobj"
     889    }
     890    global env
     891    if {[info exists env(SESSION)]} {
     892        $xmlobj put output.session $env(SESSION)
     893    }
     894    set _job(xmlobj) $xmlobj
     895}
     896
     897itcl::body Rappture::Task::LogUQSimulationUsage {} {
     898    array set times [Rappture::rusage measure]
     899
     900    if { [string length $jobstats] > 0} {
     901        lappend args \
     902            "job"      [incr jobnum] \
     903            "event"    "\[click-uq\]" \
     904            "start"    $times(start) \
     905            "walltime" 0 \
     906            "cputime"  0 \
     907            "status"   0
     908        uplevel #0 $jobstats $args
     909    }
     910
     911    # Add session info to run.xml file
     912    if { [catch { Rappture::library $_job(runfile) } xmlobj] != 0 } {
    839913        error "Can't create rappture library: $xmlobj"
    840914    }
Note: See TracChangeset for help on using the changeset viewer.