Changeset 6176 for branches/1.6/lang/tcl/scripts/task.tcl
- Timestamp:
- Mar 22, 2016, 7:16:03 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/1.6/lang/tcl/scripts/task.tcl
r6169 r6176 19 19 20 20 itcl::class Rappture::Task { 21 private method Check CacheForRunFile { driverFile }21 private method CheckForCachedRunFile { driverFile } 22 22 private method CollectUQResults {} 23 23 private method ExecuteSimulationCommand { cmd } … … 50 50 public method save {xmlobj {name ""}} 51 51 52 protected method _output {data}52 protected method OnOutput {data} 53 53 protected method Log {args} 54 54 protected method BuildSubmitCommand {cmd tfile params_file} … … 138 138 itcl::body Rappture::Task::GetSignal {code} { 139 139 set signals { 140 HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV140 xxx HUP INT QUIT ILL TRAP ABRT BUS FPE KILL USR1 SEGV 141 141 USR2 PIPE ALRM TERM STKFLT CHLD CONT STOP TSTP TTIN 142 142 TTOU URG XCPU XFSZ VTALRM PROF WINCH POLL PWR SYS … … 229 229 set cached 0 230 230 if { [IsCacheable] } { 231 puts stderr "Cache checking: [time { 231 232 set cached [CheckForCachedRunFile $driverFile] 233 } ]" 234 puts stderr "checking cache=$cached" 232 235 } 233 236 if { !$cached } { 237 puts stderr "1._uq(type)=$_uq(type)" 234 238 if { $_uq(type) != "" } { 235 239 set _uq(tfile) [GetUQTemplateFile] … … 240 244 set cmd [GetUQSimulationCommand $driverFile] 241 245 } 246 puts stderr "2. cmd=$cmd" 242 247 if { $cmd == "" } { 243 248 puts stderr "cmd is empty" … … 249 254 } 250 255 Rappture::rusage mark 256 puts stderr "3. _uq(type)=$_uq(type)" 251 257 if { ![ExecuteSimulationCommand $cmd] } { 258 puts stderr "4. job(mesg)=$_job(mesg)" 252 259 return [list 1 $_job(mesg)] 253 260 } 254 if { $_uq(type) != "" } { 255 CollectUQResults 256 } 261 puts stderr "5. _uq(type)=$_uq(type)" 257 262 if { [resources -jobprotocol] == "submit" } { 258 263 LogSubmittedSimulationUsage … … 412 417 413 418 # ---------------------------------------------------------------------- 414 # USAGE: _output <data>419 # USAGE: OnOutput <data> 415 420 # 416 421 # Used internally to send each bit of output <data> coming from the 417 422 # tool onto the caller, so the user can see progress. 418 423 # ---------------------------------------------------------------------- 419 itcl::body Rappture::Task:: _output {data} {424 itcl::body Rappture::Task::OnOutput {data} { 420 425 if {[string length $_outputcb] > 0} { 421 426 uplevel #0 $_outputcb [list $data] … … 461 466 return 0 462 467 } 463 set state [$_xmlobj get "tool.cached"] 468 if 0 { 469 set state [$_xmlobj get "tool.cache"] 464 470 if { $state == "" } { 465 471 return 0 466 472 } 473 } else { 474 set state 1 475 } 467 476 if { ![string is boolean $state] } { 468 477 return 0 … … 603 612 -keepnewline yes \ 604 613 -killsignal SIGTERM \ 605 -onoutput [list [itcl::code $this _output]] \614 -onoutput [list [itcl::code $this OnOutput]] \ 606 615 -output [list [itcl::scope _job(stdout)]] \ 607 616 -error [list [itcl::scope _job(stderr)]] \ 608 617 $cmd 609 618 } result 610 619 puts stderr "stderr=$_job(stderr) stdout=$_job(stdout)" 611 620 # Step 4. Check the token and the exit code. 612 621 set logmesg $result … … 642 651 return 0; # Fail 643 652 } 644 653 if { $_uq(type) != "" } { 654 CollectUQResults 655 } 656 puts stderr "_job(stdout)=$_job(stdout) _job(stderr)=$_job(stderr)" 645 657 # Step 5. Look in stdout for the name of the run file. 646 658 set pattern {=RAPPTURE-RUN=>([^\n]+)} … … 839 851 } 840 852 # 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 } 843 857 set _job(xmlobj) $xmlobj 844 858 } 845 859 846 860 847 itcl::body Rappture::Task::Check CacheForRunFile { driverFile } {861 itcl::body Rappture::Task::CheckForCachedRunFile { driverFile } { 848 862 849 863 # Read the driver file and collect its contents as the query. … … 880 894 close $f 881 895 set _job(runfile) $fileName 896 set _job(success) 1 897 set _job(stderr) "Loading cached results\n" 898 OnOutput "Loading cached results\n" 882 899 return 1 883 900 } … … 885 902 # UQ. Collect data from all jobs and put it in one xml run file. 886 903 itcl::body Rappture::Task::CollectUQResults {} { 904 puts stderr "CollectUQResult" 887 905 file delete -force -- "run_uq.xml" 888 906 global rapptureInfo … … 891 909 exec puq analyze $puqFileName 892 910 } fileName] != 0 } { 911 puts stderr "puq analyze failed: $fileName" 893 912 set f [open "uq_debug.err" r] 894 913 set rdata [read $f] … … 899 918 set _job(runfile) $fileName 900 919 } 901 } 920 puts stderr "runfile=$_job(runfile)" 921 }
Note: See TracChangeset
for help on using the changeset viewer.