source: WorldVistAEHR/trunk/r/VDEF-VDEF/VDEFKIDS.m@ 1211

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

initial load of WorldVistAEHR

File size: 3.8 KB
RevLine 
[613]1VDEFKIDS ;BPOIFO/JG - VDEF Patch Pre & Post Install ; 19 Dec 2005 3:06 PM
2 ;;1.0;VDEF;**3**;Dec 28, 2004
3 ;Per VHA Directive 2004-038, this routine should not be modified.
4 ;
5 ; IA: 10063 - $$ASKSTOP^%ZTLOAD
6 ; 10063 - RTN^%ZTLOAD
7 ; 10103 - $$FMADD^XLFDT
8 ;
9PREIN ; This program will suspend all VDEF Request Queues and stop
10 ; the VDEF Monitor tasks for the install of this patch.
11 ; It is run as the KIDS Environment Check Routine because
12 ; if it is run as a Pre-Install routine, all the programs
13 ; in the build are already loaded which may cause
14 ; EDITED error trap errors.
15 ;
16 I $G(XPDNM)'?1"VDEF*".E W !,"Must be run as a KIDS Environment Check." S XPDABORT=1 Q
17 ;
18 ; Check for XU*8.0*339 patch
19 I '$L($T(JOB^%ZTLOAD)) W !,"XU*8.0*339 required for installation of this patch." S XPDABORT=1 Q
20 ;
21 ; Quit if loading a distribution, continue if installing.
22 Q:$G(XPDENV)'=1
23 W !!,"Suspending Request Queues and stopping associated TaskMan jobs"
24 NEW QUEUE,STAT,TMTASKC,TMTASKF,VDEFIDT,X,VDEFUP
25 S VDEFIDT=$$FMADD^XLFDT(DT,2)
26 K ^XTMP("VDEFP1") S ^XTMP("VDEFP1",0)=VDEFIDT_"^"_DT
27 ;
28 ; Suspend running Request Queues
29 S QUEUE=0 F S QUEUE=$O(^VDEFHL7(579.3,QUEUE)) Q:'QUEUE D
30 . S STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I") I STAT="R" D
31 .. ; Suspend the request queue
32 .. S VDEFUP(579.3,QUEUE_",",.09)="S" D FILE^DIE("","VDEFUP")
33 .. ;
34 .. ; Stop the current & future TaskMan tasks
35 .. ; Wait up to 5 seconds for tasks to stop then delete them
36 .. ; anyway since that means the process probably died.
37 .. S TMTASKF=$$GET1^DIQ(579.3,QUEUE_",",.08,"I") ; Future
38 .. I TMTASKF'="" D
39 ... N ZTSK S ZTSK=TMTASKF S X=$$ASKSTOP^%ZTLOAD(ZTSK)
40 ... N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
41 ... K I D KILL^%ZTLOAD
42 .. S TMTASKC=$$GET1^DIQ(579.3,QUEUE_",",.11,"I") ; Current
43 .. I TMTASKC'=""&(TMTASKC'=TMTASKF) D
44 ... N ZTSK S ZTSK=TMTASKC S X=$$ASKSTOP^%ZTLOAD(ZTSK)
45 ... N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
46 ... K I D KILL^%ZTLOAD
47 .. S ^XTMP("VDEFP1",QUEUE)=""
48 ;
49 ; Stop the checked out request monitor
50 W !!,"Stopping the MONITOR^VDEFCONT task"
51 S ZTSK=$$GET1^DIQ(579.5,"1,",.06)
52 I ZTSK'="" D
53 . S X=$$ASKSTOP^%ZTLOAD(ZTSK)
54 . N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
55 . K I D KILL^%ZTLOAD
56 ;
57 ; Stop the Request Queue process monitor
58 W !!,"Stopping the MONITOR^VDEFMON task"
59 N TASK D RTN^%ZTLOAD("VDEFMON","TASK")
60 S ZTSK=$O(TASK(0)) I ZTSK D
61 . S X=$$ASKSTOP^%ZTLOAD(ZTSK)
62 . N I F I=1:1:5 D STAT^%ZTLOAD Q:ZTSK(1)=0!(ZTSK(1)>2) H 1
63 . K I D KILL^%ZTLOAD
64 ;
65 ; Allow enough time for the VMS processes to quit.
66 W !!,"Waiting for processes to quit " N I F I=1:1:5 W ". " H 1
67 K I
68 Q
69 ;
70 ;
71POSTIN ; This program will restart suspended Request Queues start the VDEF
72 ; monitor processes after the KIDS install.
73 ;
74 I $G(XPDNM)'?1"VDEF*".E W !,"Must be run as a KIDS Environment Check." S XPDABORT=1 Q
75 ;
76 ; Don't start VDEF processes on test and Legacy systems
77 I '$$PROD^XUPROD(1) D BMES^XPDUTL("VDEF is not started on test systems.") Q
78 D BMES^XPDUTL("Starting the Request Queues and associated Tasks")
79 ;
80 ; For each Request Queue defined, change the status to
81 ; 'Running' and start the Request Queue process for the queue.
82 NEW QUEUE,STAT,VDEFUP,I,QUENAM
83 S QUEUE=0 F S QUEUE=$O(^XTMP("VDEFP1",QUEUE)) Q:'QUEUE D
84 . S QUENAM=$P(^VDEFHL7(579.3,QUEUE,0),U)
85 . S STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I") I STAT="S" D
86 .. S VDEFUP(579.3,QUEUE_",",.09)="R" D FILE^DIE("","VDEFUP")
87 .. F I=1:1:5 S STAT=$$GET1^DIQ(579.3,QUEUE_",",.09,"I") Q:STAT="R" H 1
88 .. I STAT="R" D REQ^VDEFCONT(QUEUE)
89 .. E D BMES^XPDUTL("**** VDEF '"_QUENAM_"' QUEUE DID NOT START. START IT FROM VDEF CONFIG MENU.")
90 K ^XTMP("VDEFP1")
91 ;
92 ; Restart the Checked Out monitor process.
93 D BMES^XPDUTL("Starting the MONITOR^VDEFCONT task")
94 D MONCHKO^VDEFCONT
95 ;
96 ; Restart the Request Queue process monitor.
97 D BMES^XPDUTL("Starting the MONITOR^VDEFMON task")
98 D START1^VDEFMON
99 Q
Note: See TracBrowser for help on using the repository browser.