source: WorldVistAEHR/trunk/r/KERNEL-XU-A4A7-USC-XG-XLF-XNOA-XPD-XQ-XVIR-ZI-ZOSF-ZOSV-ZT-ZU-%Z-XIP--XQAB--XUC--XUR--ZIN--ZTED/ZTMON1.m@ 1432

Last change on this file since 1432 was 613, checked in by George Lilly, 15 years ago

initial load of WorldVistAEHR

File size: 4.0 KB
Line 
1ZTMON1 ;SEA/RDS-TaskMan: Option, ZTMON, Part 2 (Main Loop) ;11/03/2003 13:42
2 ;;8.0;KERNEL;**36,118,127,275**;Jul 10, 1995
3MON D IO:MODE,JOB,SUB
4 G DONE
5 ;
6IO ;Evaluate Waiting Lists
7 N X,X1
8 S ZT1=$$H3($H),ZT2=$G(^%ZTSCH("IO")),ZT=$$DIFF^%ZTMS1(ZT1,+ZT2,1)
9 W !!,"Checking the IO Lists:" I $D(^%ZTSCH("IO"))>2 W:+ZT2 " Last TM scan: ",ZT," sec, " W:$P(ZT2,"^",2)]"" "Last Dev: ",$P(ZT2,"^",2)
10 S ZT1="",ZTT=0
11I1 S ZT1=$O(^%ZTSCH("IO",ZT1)) I ZT1="" W:ZTT=0 !?5,"There are no tasks waiting for devices." Q
12 I $D(^%ZTSCH("IO",ZT1))<9 G I1 ;Skip devices without tasks
13 W !?5,"Device: ",ZT1 S Y=1 I ZT1'=$I S X=ZT1,X1=$G(^%ZTSCH("IO",ZT1)) D DEVOK^%ZOSV
14 W $S(Y:" is not available,",$D(^%ZTSCH("DEV",ZT1)):" is allocated,",1:" is AVAILABLE,")
15 S ZTC=0,ZT2="" F ZT=0:0 S ZT2=$O(^%ZTSCH("IO",ZT1,ZT2)),ZT3="" Q:'ZT2 F ZT=0:0 S ZT3=$O(^%ZTSCH("IO",ZT1,ZT2,ZT3)) Q:ZT3="" S ZTC=ZTC+1,ZTT=1
16 W " with ",$S(ZTC=1:"one task",1:ZTC_" tasks")," waiting." W:ZTC>50 $C(7)
17 G I1
18 ;
19JOB ;Evaluate Job List
20 W !!,"Checking the Job List:"
21 S ZTC=0,ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH("JOB",ZT1)),ZT2=0 Q:ZT1="" F ZT=0:0 S ZT2=$O(^%ZTSCH("JOB",ZT1,ZT2)) Q:'ZT2 S ZTC=ZTC+1
22 W !?5,"There ",$S(ZTC=0:"are no tasks",ZTC=1:"is 1 task",1:"are "_ZTC_" tasks")," waiting for ",$S(ZTC'=1:"partitions.",1:"a partition.") W:ZTC>20 $C(7)
23 ;
24C ;Evaluate Cross CPU list
25 S ZT1=""
26 F S ZT1=$O(^%ZTSCH("C",ZT1)) Q:ZT1="" S ZTC=+$G(^(ZT1)) D
27 . S ZTCO=0,ZT2=""
28 . F S ZT2=$O(^%ZTSCH("C",ZT1,ZT2)),ZT3=0 Q:ZT2="" F S ZT3=$O(^%ZTSCH("C",ZT1,ZT2,ZT3)) Q:ZT3="" S ZTCO=ZTCO+1
29 . W !?5,"For ",ZT1," there ",$S(ZTCO=1:"is ",1:"are "),ZTCO," tasks. "
30 . W $S(ZTC>8:"Not responding",$$OOS^%ZTM(ZT1):"Out Of Service",'$D(^%ZIS(14.7,"B",ZT1)):"Not defined",1:"")
31 . Q
32TASK ;Evaluate Task List
33 W !!,"Checking the Task List:"
34 S ZTC=0 F ZT1=0:0 S ZT1=$O(^%ZTSCH("TASK",ZT1)) Q:'ZT1 S ZTC=ZTC+1
35 W !?5,"There ",$S(ZTC=0:"are no tasks",ZTC=1:"is 1 task",1:"are "_ZTC_" tasks")," currently running."
36 Q
37 ;
38SUB ;Look for idle submanagers
39 D SUBCHK^%ZTMS5
40 N %N,ZT1,ZT2,ZT3,ZT4 L +^%ZTSCH("SUB"):1
41 I $D(^%ZTSCH("WAIT","SUB")) W !,"Sub-Managers told to Wait."
42 S %N=""
43 F S %N=$O(^%ZTSCH("SUB",%N)) Q:%N="" D
44 . S %=$G(^(%N)),ZT4=+$G(^%ZTSCH("LOADA",%N))
45 . W !?5,"On node ",%N," there ",$S('%:"are no",%=1:"is 1",1:"are "_$J(%,2))," free Sub-Manager(s)."
46 . W " Status: ",$S($D(^%ZTSCH("STOP","SUB",%N)):"Stop",ZT4:"BWait",1:"Run")
47 . I $G(^%ZTSCH("SUB",%N,0))>5 W !?10,"SUB-MANAGERS ARE NOT STARTING."
48 . Q
49 L -^%ZTSCH("SUB")
50 Q
51 ;
52DONE ;Prompt to Quit Or Continue
53 W !!,"Enter monitor action: UPDATE// "
54 R ZTR:$S($D(DTIME)#2:DTIME,1:60) S:ZTR="" ZTR="U"
55 I "Uu"[$E(ZTR) G MON^ZTMON
56 I "Ee"[$E(ZTR) Q:$$CALL("LIST^XUTMKE") G DONE
57 I "Ss"[$E(ZTR) W @IOF X ^%ZOSF("SS") G DONE
58 I "Pp"[$E(ZTR) W @IOF D PARAMS^ZTMCHK G DONE
59 I "Rr"[$E(ZTR) W @IOF D RES G DONE
60 I "Tt"[$E(ZTR) S MODE='MODE W !,"Mode set to ",$S(MODE:"normal",1:"short") G DONE
61 I ZTR="^"!(ZTR="@") Q
62 I ZTR'["?" G MON^ZTMON
63 I ZTR="??" Q:$$CALL("SELECT^XUTMONH") G MON^ZTMON
64 W !!?5,"Enter <RETURN> to update the monitor screen."
65 W !?5,"Enter ^ to exit the monitor."
66 W !?5,"Enter E to inspect the TaskMan Error file."
67 W !?5,"Enter P to see taskman parameters."
68 W !?5,"Enter R to see busy Resource slots."
69 W !?5,"Enter S to see a system status listing."
70 W !?5,"Enter ? to see this message."
71 W !?5,"Enter ?? to inspect the tasks in the monitor's lists."
72 G DONE
73 ;
74H3(%) ;Convert $H to seconds.
75 Q 86400*%+$P(%,",",2)
76 ;
77CALL(RTN) ;Check for called routine
78 N DUOUT
79 I $D(^DIC(19,0))[0 W !,"In the wrong account." Q 0
80 D @RTN Q $D(DUOUT)
81 ;
82RES ;Check on resource devices
83 N ZT1,ZT2,ZT3,ZTIM,X
84 S ZT1=""
85 F S ZT1=$O(^%ZTSCH("IO",ZT1)) Q:ZT1="" I ^%ZTSCH("IO",ZT1)="RES" D
86 . ;Q:$D(^%ZTSCH("IO",ZT1))<9
87 . S ZT2=$O(^%ZISL(3.54,"B",ZT1,0)),ZT3=0 Q:ZT2'>0
88 . S X=$G(^%ZISL(3.54,ZT2,0))
89 . W !,"Resource ",ZT1," Aval. Slots: ",$P(X,U,2)
90 . F S ZT3=$O(^%ZISL(3.54,ZT2,1,ZT3)) Q:ZT3'>0 D
91 . . S X=^%ZISL(3.54,ZT2,1,ZT3,0),ZTIM=$P(X,U,5) I ZTIM]"",ZTIM'["," S ZTIM=$$H0^%ZTM(ZTIM)
92 . . W !,?10,"Slot: ",$J(ZT3,2)," Job: ",$P(X,U,3)," Task: ",$P(X,U,4)
93 . . W " time: ",$$HDIFF^%ZTLOAD7($H,ZTIM,2)
94 . . Q
95 . Q
96 Q
Note: See TracBrowser for help on using the repository browser.