Changeset 6698 for branches/1.7
- Timestamp:
- Sep 7, 2018 11:06:01 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.7/lang/tcl/scripts/task.tcl
r6696 r6698 33 33 private method LogSimulationUsage {} 34 34 private method LogSubmittedSimulationUsage {} 35 private method LogUQSimulationUsage {} 35 36 private method SetCpuResourceLimit {} 36 37 … … 53 54 protected method OnOutput {data} 54 55 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} 56 58 protected method GetParamsForUQ {} 57 59 … … 206 208 set _outputcb "" 207 209 set _uq(type) "" 210 set _uq(tFile) "" 211 set _uq(toolparamFile) "" 212 set _uq(paramsFile) "" 208 213 foreach {path val} $args { 209 214 if {$path == "-output"} { … … 241 246 if { !$cached } { 242 247 if { $_uq(type) != "" } { 243 set _uq(t file) [GetUQTemplateFile]248 set _uq(tFile) [GetUQTemplateFile] 244 249 } 245 250 if { $_uq(type) == "" } { … … 260 265 return [list 1 $_job(mesg)] 261 266 } 262 if { [resources -jobprotocol] == "submit" } { 267 if { $_uq(type) != "" } { 268 LogUQSimulationUsage 269 } elseif { [resources -jobprotocol] == "submit" } { 263 270 LogSubmittedSimulationUsage 264 271 } else { … … 267 274 } else { 268 275 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) 269 285 } 270 286 if { $_job(success) } { … … 286 302 # Turn the command string from tool.xml into the proper syntax to use 287 303 # 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 # ---------------------------------------------------------------------- 307 itcl::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 315 itcl::body Rappture::Task::BuildSubmitLocalCommand {cmd tFile params_file} { 292 316 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" 294 318 set cmds [split $cmd " "] 295 319 for {set i 0} {$i < [llength $cmds]} {incr i} { … … 307 331 } 308 332 if {$arg == "@driver"} { 309 set arg "\"\\\"$t file\\\"\""333 set arg "\"\\\"$tFile\\\"\"" 310 334 } 311 335 append newcmd " " $arg 312 336 } 313 regsub -all @driver $newcmd $tfile newcmd 337 regsub -all @driver $newcmd $tFile newcmd 338 314 339 return $newcmd 315 340 } … … 561 586 return "" 562 587 } 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 565 592 file delete -force puq 593 566 594 return $cmd 567 595 } … … 577 605 578 606 # Return a list of the UQ variables and their PDFs. 579 # Also turns $uq(t file) into a template file.607 # Also turns $uq(tFile) into a template file. 580 608 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 582 619 return $templateFile 583 620 } … … 779 816 # } 780 817 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 781 830 # 782 831 # Scan through stderr channel and look for statements that … … 833 882 incr jobnum $subjobs 834 883 835 # Add cputimeinfo to run.xml file884 # Add session info to run.xml file 836 885 if { [catch { 837 886 Rappture::library $_job(runfile) 838 887 } 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 897 itcl::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 } { 839 913 error "Can't create rappture library: $xmlobj" 840 914 }
Note: See TracChangeset
for help on using the changeset viewer.