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/_ZTM0.m@ 808

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

initial load of WorldVistAEHR

File size: 3.7 KB
Line 
1%ZTM0 ;SEA/RDS-TaskMan: Manager, Part 2 (Begin) ;09/29/2004 08:42
2 ;;8.0;KERNEL;**42,36,67,88,118,127,136,175,275,355**;Jul 10, 1995;Build 9
3 ;
4START ;Entry Point--start Task Manager at system startup
5 S $ETRAP="D ER^%ZTM5",^%ZTSCH("ER")="",U="^"
6 D STATUS^%ZTM("RUN","Startup")
7 L ^%ZTSCH:10 G:'$T RESTART ;Someone already running
8 K ^%ZTSCH("DEV"),^("DEVOPEN"),^("LOAD"),^("LOADA"),^("STATUS"),^("STOP"),^("UPDATE")
9 D I6^%ZTM ;Handle Persistent Jobs
10 S ZTSK=0 F S ZTSK=$O(^%ZTSCH("TASK",ZTSK)) Q:'ZTSK D
11 . D TSKSTAT^%ZTM1("E","Interrupted While Running")
12 . K ^%ZTSCH("TASK",ZTSK)
13 D SETUP
14 K ^%ZTSCH("TASK"),^%ZTSCH("SUB")
15 S ^%ZTSCH("IDLE")=0,^%ZTSCH("SUB",%ZTPAIR)=0,^(%ZTPAIR,0)=0
16 D STATUS^%ZTM("RUN","Startup Hang")
17 I "CFO"[%ZTYPE G BADTYPE
18 H %ZTPFLG("TM-DELAY") ;Wait for system stability.
19S1 ;
20 D STATUS^%ZTM("RUN","Startup jobs")
21 S %ZTLOOP=0 D CHECK^%ZTM
22 D STRTUP
23 S ZTU="" F S ZTU=$O(^%ZTSCH("C",ZTU)) Q:ZTU="" S ^%ZTSCH("C",ZTU)=0 ;Reset VS counts in C list.
24 K %ZTI,%ZTY,ZTIO,ZTO,ZTP,ZTSK,ZTU
25 I %ZTPFLG("XUSCNT") D COUNT^XUSCNT(1)
26 G ^%ZTM
27 ;
28RESTART ;Entry Point--restart Task Manager
29 S $ETRAP="D ER^%ZTM5",^%ZTSCH("ER")="",U="^"
30 D STATUS^%ZTM("RUN","Restart")
31 K ^%ZTSCH("STATUS"),^("STOP")
32 D SETUP
33 I '$D(^%ZTSCH("IDLE")) S ^%ZTSCH("IDLE")=0
34 I '$D(^%ZTSCH("SUB",%ZTPAIR)) S ^%ZTSCH("SUB",%ZTPAIR)=0
35 I "CFO"[%ZTYPE G BADTYPE
36 I %ZTPFLG("XUSCNT") D COUNT^XUSCNT(1)
37 G ^%ZTM
38 ;
39 ;
40SETUP ;Setup Task Manager's Environment
41 N X,Y,Z,ZT
42ST2 S ^%ZTSCH("RUN")=$H,%ZTPAIR="ROU"
43 D STATUS^%ZTM("RUN","Setup")
44 D ZOSF I Y]"" D STATUS^%ZTM("PAUSE","The following required ^%ZOSF nodes are undefined: "_Y_".") H 60 G ST2
45 D UPDATE^%ZTM5 I $D(ZTREQUIR)#2 D STATUS^%ZTM("PAUSE","Required link to "_ZTREQUIR_" is down.") H 60 G ST2
46 ;Clear the NOT Responding count
47 S X="" F S X=$O(^%ZTSCH("C",X)) Q:X="" S ^%ZTSCH("C",X)=0
48 D JOB,NOLOG^%ZOSV S %ZTNLG=Y,DTIME=0,DUZ=0,DUZ(0)="@"
49 K Z D NAME K X,Y,Z,ZT
50 Q
51STRTUP ;Queue the entries from the STARTUP X-ref
52 ;After talking with the DBA, All STARTUP jobs will have DUZ=.5
53 N ZTU,ZTO,ZTSAVE,ZTRTN,DUZ
54 S DUZ=.5,DUZ(0)="@"
55 S ZTU="" F S ZTU=$O(^%ZTSCH("STARTUP",ZTU)),ZTO="" Q:ZTU="" F S ZTO=$O(^%ZTSCH("STARTUP",ZTU,ZTO)) Q:ZTO="" D
56 . S ZTSAVE("XQY")=$P(ZTO,"Q",2) ;This must be set for %ZTLOAD
57 . S ZTDTH=$H,ZTIO=$P(^%ZTSCH("STARTUP",ZTU,ZTO),"^",2),ZTRTN="ZTSK^XQ1",ZTSAVE($S(ZTO["Q":"XQSCH",1:"XQY"))=+ZTO,ZTUCI=$P(ZTU,","),ZTCPU=$P(ZTU,",",2)
58 . D ^%ZTLOAD
59 . Q
60 Q
61 ;
62ZOSF ;SETUP--determine whether any required ^%ZOSF nodes are missing
63 S Y=""
64 F X="ACTJ","OS","PROD","UCI","UCICHECK","VOL" I $D(^%ZOSF(X))[0 S Y=Y_","_X
65 S:$T(ACTJ^%ZOSV)="" Y=Y_",ACTJ^%ZOSV"
66 I Y]"" S Y=$E(Y,2,$L(Y))
67 Q
68 ;
69JOB ;SETUP--setup JOB command
70 I %ZTOS["VAX DSM" D Q
71 . S:'$L(%ZTPFLG("DCL")) %ZTJOB="J ^%ZTMS:(OPTION=""/UCI=""_$P(ZTUCI,"","")_""/VOL=""_ZTDVOL):5"
72 . S:$L(%ZTPFLG("DCL")) %ZTJOB="D ^%ZTMDCL"
73 . Q
74 I %ZTOS["OpenM" D Q
75 . S:'$L(%ZTPFLG("DCL")) %ZTJOB="J ^%ZTMS::5" ;"J ^%ZTMS:ZTUCI:5"
76 . S:$L(%ZTPFLG("DCL")) %ZTJOB="D ^%ZTMDCL"
77 . Q
78 I %ZTOS["GT.M" S %ZTJOB="J GTM^%ZTMS::5",$ZINTERRUPT="I $$JOBEXAM^ZU($ZPOSITION)" Q
79 I %ZTOS["M/SQL" S %ZTJOB="J ^%ZTMS:ZTUCI" Q
80 I %ZTOS["MSM" S %ZTJOB="J ^%ZTMS[ZTUCI,ZTDVOL]:%ZTSIZ:5" Q ;Set Maxpartsiz
81 I %ZTOS["DTM" S %ZTJOB="J ^%ZTMS:(NSPACE=ZTUCI)" Q
82 S %ZTJOB="J ^%ZTMS::5"
83 Q
84 ;
85NAME ;Give a name to process.
86 N $ETRAP,ZQ S $ETRAP="S ZQ=0,$EC="""" Q"
87 F Z=1:1:9 S X="Taskman "_%ZTVOL_" "_Z,ZQ=1 D SETENV^%ZOSV Q:ZQ
88 Q
89BADTYPE ;Taskman should not run on this type of node.
90 K ^%ZTSCH("STATUS")
91 S ^%ZTSCH("RUN")=%ZTPAIR_" is the wrong type in taskman site parameters."
92 Q
93 ;
94HALT ;Cleanup and halt
95 I %ZTPFLG("XUSCNT") D COUNT^XUSCNT(-1)
96 K ^%ZTSCH("STATUS",$J),^%ZTSCH("RUN"),^%ZTSCH("UPDATE",$J)
97 K ^%ZTSCH("LOADA",%ZTPAIR)
98 HALT
Note: See TracBrowser for help on using the repository browser.