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

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

initial load of FOIAVistA 6/30/08 version

File size: 2.4 KB
Line 
1ZTMON ;SEA/RDS-TaskMan: Option, ZTMON, Part 1 (Main Loop) ;05/12/2005 13:21
2 ;;8.0;KERNEL;**118,127,136,355**;Jul 10, 1995;Build 9
3 ;
4ENV ;Main Entry Point For Taskman Status Monitor
5 D EN(1) ;Long mode
6 Q
7EN(MODE) ;
8 D HOME^%ZIS N %,%H,X,Y,Z,ZT,ZT1,ZT2,ZT3,ZT4,ZTC,ZTCO,ZTD,ZTENV,ZTH,ZTR,ZTUCI,ZTX,ZTY
9 S U="^" X ^%ZOSF("UCI") S ZTUCI=Y W @IOF
10MON D RUN,STATUS,SCHQ
11 ;Continued in ZTMON1
12 G ^ZTMON1
13 ;
14EN2 ;A shorter monitor
15 D EN(0)
16 Q
17 ;
18RUN ;Evaluate RUN-Node
19 W @IOF,!!,"Checking Taskman."
20 S ZTH=$H,ZTR=$G(^%ZTSCH("RUN"))
21 I ZTR]"" S ZTD=$$DIFF^%ZTM(ZTH,ZTR,0)
22 S ZTY=$S(ZTR="":0,ZTD>20:0,1:1)
23 W ?20,"Current $H=",ZTH," (",$$HTE^%ZTLOAD7(ZTH),")"
24 W !,?22,"RUN NODE=",$S(ZTR]"":ZTR,1:"<Undefined>") I ZTR]"" W " (",$$HTE^%ZTLOAD7(ZTR),")"
25 W !,"Taskman is ",$S(ZTY:"current.",ZTR]"":"late by "_(ZTD-15)_" seconds."_$C(7),1:"")
26 W:$D(^%ZTSCH("STOP")) " shutting down" W:'$D(^%ZTSCH("STATUS")) " not running."_$C(7) W "."
27 Q
28 ;
29STATUS ;Evaluate Status List
30 K X,ZTC S ZT="",ZTH=$$H3^%ZTM($H),ZT2=""
31 M ZTC("S")=^%ZTSCH("STATUS"),ZTC("L")=^%ZTSCH("LOADA")
32 F S ZT=$O(ZTC("S",ZT)) Q:ZT="" S X=ZTC("S",ZT) I $L($P(X,U,3)) S ZTC("D",$P(X,U,3),ZT)=ZT
33 W !,"Checking the Status List:",!," Node weight status",?32,"time",?42," $J"
34 S ZT=""
35 F S ZT=$O(ZTC("D",ZT)),ZT1="" Q:ZT="" F S ZT1=$O(ZTC("D",ZT,ZT1)) Q:ZT1="" D
36 . S %=ZTC("S",ZT1),ZT2=1
37 . W !?1,ZT W ?13,$S($D(ZTC("L",ZT)):$J($P(ZTC("L",ZT),U,2),3),1:""),?20,$P(%,U,2),?29,$$STIME($P(%,U)) W ?42,ZT1,?52,$P(%,U,4)
38 . Q
39 I 'ZT2 W !?5,"The Status List is ",$S(ZTY:"temporarily ",1:""),"empty."
40 Q
41 ;
42SCHQ ;Evaluate Schedule List
43 N X,ZTL
44 W !!,"Checking the Schedule List:"
45 S ZT1=0,ZTCO=0,ZTC=0,ZTH=$$H3^%ZTM($H)
46 S X=$O(^%ZTSCH(0)),ZTL=$$DIFF(ZTH,X,1)
47 F S ZT1=$O(^%ZTSCH(ZT1)) Q:'ZT1 D
48 . F ZT2=0:0 S ZT2=$O(^%ZTSCH(ZT1,ZT2)) Q:ZT2="" S ZTC=ZTC+1 I $$DIFF(ZTH,ZT1,1)>0 S ZTCO=ZTCO+1
49 W !?5,"Taskman has ",$S('ZTC:"no",1:ZTC)," task",$S(ZTC'=1:"s",1:"")," scheduled."
50 I ZTC=1 W !?5,"It is ",$S('ZTCO:"not ",1:""),"overdue."
51 I ZTC>1 W !?5,$S('ZTCO:"None",ZTCO=ZTC&(ZTCO=2):"Both",ZTCO=ZTC:"All",1:ZTCO)," of them ",$S(ZTCO=1:"is",1:"are")," overdue." W:ZTCO>10 *7
52 I ZTC>0,ZTL>0 W " First task is ",ZTL," seconds late."
53 Q
54 ;
55DIFF(N,O,T) ;Diff in sec.
56 Q:$G(T) N-O ;For new seconds times
57 Q N-O*86400-$P(O,",",2)+$P(N,",",2)
58 ;
59STIME(%H) ;Status time
60 I +$H=+%H Q "T@"_$P($$HTE^%ZTLOAD7(%H),"@",2)
61 Q "T-"_($H-%H)_"@"_$P($$HTE^%ZTLOAD7(%H),"@",2)
Note: See TracBrowser for help on using the repository browser.