XUTMTZ ;SEA/RDS - Taskman: Toolkit: Test Utilities (General) ;10/01/97 15:11
;;8.0;KERNEL;**67**;Jul 10, 1995
LOAD ;Load up Queue jobs
W !,"This call will allow you to start a large number of tasks for",!,"TaskMan to run."
R !,"Enter the number of jobs to start: ",JOBS:DTIME Q:+JOBS'>0
L +^TMP("XUTMTZ") K ^TMP("XUTMTZ"),ZTIO,ZTUCI,ZTCPU W !,"use '^' for no device."
S %ZIS="Q" D ^%ZIS S TASKIO=POP
S %DT="AETSX",%DT("B")="NOW" D ^%DT Q:Y<1 S XUDTH=Y
LD2 R !,"Entry point to use: ",RTN:DTIME
I RTN["?" D G LD2
. F I=3:1 S X=$T(+I) Q:X="" W:$E($P(X," ",2),1,2)=";;" !,X
I $T(@RTN)'[";;" W !,"Not valid" G LD2
W !,"=============================================================="
W !,"New Batch: ",$H,"...",$J,!,"Tasks: "
F QUASI=1:1:JOBS S ZTRTN=RTN_"^XUTMTZ",ZTDTH=XUDTH,ZTDESC=$T(@RTN)_", Job #"_QUASI S:TASKIO ZTIO="" D ^%ZTLOAD W ZTSK,", "
W !,"..............................................................."
D HOME^%ZIS L -^TMP("XUTMTZ")
Q
;
ERROR ;;Test Taskman's Error Handling
S ^TMP("XUTMTZ",$H,$J)=ZTSK_", TEST ERROR HANDLING"
H 1 X "ERROR "
;
BASIC ;;Basic Test With Hang
L +^TMP("XUTMTZ") S ^TMP("XUTMTZ",$H,$J)=ZTSK_", BASIC TEST"_U_ZTDESC
I IO]"" W "." S IONOFF=1
H 1 L -^TMP("XUTMTZ") Q
;
QUICK ;;Quick Test To Exercise Submanager
S FRANK="HONEST" Q
;
STOP ;;Test Stop Code
S ^TMP("XUTMTZ",$H,$J)=ZTSK_", STOP CODE TEST: "
H 60
I $$S^%ZTLOAD S ZTSTOP=1,^TMP("XUTMTZ",$H,$J)="Stop Request Acknowledged." Q
S ^TMP("XUTMTZ",$H,$J)="No Stop Request Detected." Q
;
SIZE ;TOOL--SIZE OF ROUTINES
X ^%ZOSF("RSEL") S ZT1="" F ZT=0:0 S ZT1=$O(^TMP($J,ZT1)) Q:ZT1="" X "ZL @ZT1 X ^%ZOSF(""SIZE"") W !,ZT1,?10,Y,?15,"" "",$P($P($T(+1),"";"",2),""-"",2,999)"
K ^TMP($J) Q
;
MULTPL ;test task--Test running multiple managers on different nodes of VAXcluster
L +^TMP("XUTMTZ") H 1
W !,"..............................................................."
W !,ZTSK,": ",$H,"...",$J
L -^TMP("XUTMTZ") Q
;
STOP2 ;;Test ZTSTOP code
F ZT=1:1:792 S X=$$S^%ZTLOAD Q:X W 9
I X S ZTSTOP=1
Q
;
WATCH ;DON'T QUEUE--watch tasks as they are scheduled and unscheduled
S ZTSK=0
F ZT=0:0 D LOOKUP W !,"Update: ",ZTU,?15,"Queued: ",ZTS,?30,"Late: ",ZTO,?40,"New: ",ZTN,?50,"Subs: ",ZTSU,?60,"Free Subs: ",ZTF R X:1 Q:X="^"
Q
;
LOOKUP ;WATCH--get data to show
S ZTH=$H,ZTR=$S($D(^%ZTSCH("RUN"))#2:^("RUN"),1:""),ZTU="off"
I ZTR S ZTU=ZTH-ZTR*86400+$P(ZTH,",",2)-$P(ZTR,",",2) I ZTU>99 S ZTU="late"
S ZT1=0,ZTO=0,ZTS=0 F ZT=0:0 S ZT1=$O(^%ZTSCH(ZT1)),ZT2="" Q:'ZT1 F ZT=0:0 S ZT2=$O(^%ZTSCH(ZT1,ZT2)) Q:'ZT2 S ZTS=ZTS+1,ZTH=$H I ZTH-ZT1*86400+$P(ZTH,",",2)-$P(ZT1,",",2)>0 S ZTO=ZTO+1
S ZTN=^%ZTSK(-1)-ZTSK,ZTSK=^(-1)
S ZTSU=0,ZT1="" F ZT=0:0 S ZT1=$O(^%ZTSCH("TASK",ZT1)) Q:ZT1="" S ZTSU=ZTSU+1
S ZTF=0 I $D(^%ZTSCH("SUB"))#2 S ZTF=^("SUB"),ZTSU=ZTSU+ZTF
Q
;
HANG ;;Wait five minutes then quit
H 300 Q
;
OWN ;;Hold a device until told to release it
F A=0:0 H 1 I $D(^%ZTSK(ZTSK,.4))#2 Q
Q
;
QOWN ;entry--queue an own task
S ZTRTN="OWN^XUTMTZ",ZTDTH=$H,ZTIO="",ZTDESC="Toad test 1",ZTSAVE("ZTREQ")="@" D ^%ZTLOAD Q
;
Q ;entry--queue a test task
S ZTRTN="QUICK^XUTMTZ",ZTDTH=$H,ZTIO="",ZTDESC="Toad test",ZTSAVE("ZTREQ")="@" D ^%ZTLOAD Q
;
DELAY ;;Record delay in start
S ZTN=$H,ZTO=$P(^%ZTSK(ZTSK,0),"^",6),Y=$$DIFF^%ZTM(ZTN,ZTO,0)
S ^TMP("XUTMTZ",ZTN,ZTSK)="DELAY^"_IO_"^"_ZTN_"^"_ZTO_"^"_Y
I $$S^%ZTLOAD("DELAY TIME IS "_Y)
Q
PTASK ;;See if persistent status works.
S CNT=$G(^%ZTSCH("TASK",ZTSK,"CNT"),0)
S ^%ZTSCH("TASK",ZTSK,"CNT",CNT)=$$HTE^XLFDT($H)
I '$D(^%ZTSCH("TASK",ZTSK,"P")) S X=$$PSET^%ZTLOAD(ZTSK) H 15 HALT
H 30
S ^("CNT")=$G(^("CNT"))+1 I ^("CNT")>5 S X=$$PCLEAR^%ZTLOAD(ZTSK) Q
HALT
Q
--- Routine Detail --- with STRUCTURED ROUTINE LISTING ---[H[J[2J[HXUTMTZ 3757 printed Dec 13, 2024@02:14:03 Page 2
XUTMTZ ;SEA/RDS - Taskman: Toolkit: Test Utilities (General) ;10/01/97 15:11
+1 ;;8.0;KERNEL;**67**;Jul 10, 1995
LOAD ;Load up Queue jobs
+1 WRITE !,"This call will allow you to start a large number of tasks for",!,"TaskMan to run."
+2 READ !,"Enter the number of jobs to start: ",JOBS:DTIME
if +JOBS'>0
QUIT
+3 LOCK +^TMP("XUTMTZ")
KILL ^TMP("XUTMTZ"),ZTIO,ZTUCI,ZTCPU
WRITE !,"use '^' for no device."
+4 SET %ZIS="Q"
DO ^%ZIS
SET TASKIO=POP
+5 SET %DT="AETSX"
SET %DT("B")="NOW"
DO ^%DT
if Y<1
QUIT
SET XUDTH=Y
LD2 READ !,"Entry point to use: ",RTN:DTIME
+1 IF RTN["?"
Begin DoDot:1
+2 FOR I=3:1
SET X=$TEXT(+I)
if X=""
QUIT
if $EXTRACT($PIECE(X," ",2),1,2)=";;"
WRITE !,X
End DoDot:1
GOTO LD2
+3 IF $TEXT(@RTN)'[";;"
WRITE !,"Not valid"
GOTO LD2
+4 WRITE !,"=============================================================="
+5 WRITE !,"New Batch: ",$HOROLOG,"...",$JOB,!,"Tasks: "
+6 FOR QUASI=1:1:JOBS
SET ZTRTN=RTN_"^XUTMTZ"
SET ZTDTH=XUDTH
SET ZTDESC=$TEXT(@RTN)_", Job #"_QUASI
if TASKIO
SET ZTIO=""
DO ^%ZTLOAD
WRITE ZTSK,", "
+7 WRITE !,"..............................................................."
+8 DO HOME^%ZIS
LOCK -^TMP("XUTMTZ")
+9 QUIT
+10 ;
ERROR ;;Test Taskman's Error Handling
+1 SET ^TMP("XUTMTZ",$HOROLOG,$JOB)=ZTSK_", TEST ERROR HANDLING"
+2 HANG 1
XECUTE "ERROR "
+3 ;
BASIC ;;Basic Test With Hang
+1 LOCK +^TMP("XUTMTZ")
SET ^TMP("XUTMTZ",$HOROLOG,$JOB)=ZTSK_", BASIC TEST"_U_ZTDESC
+2 IF IO]""
WRITE "."
SET IONOFF=1
+3 HANG 1
LOCK -^TMP("XUTMTZ")
QUIT
+4 ;
QUICK ;;Quick Test To Exercise Submanager
+1 SET FRANK="HONEST"
QUIT
+2 ;
STOP ;;Test Stop Code
+1 SET ^TMP("XUTMTZ",$HOROLOG,$JOB)=ZTSK_", STOP CODE TEST: "
+2 HANG 60
+3 IF $$S^%ZTLOAD
SET ZTSTOP=1
SET ^TMP("XUTMTZ",$HOROLOG,$JOB)="Stop Request Acknowledged."
QUIT
+4 SET ^TMP("XUTMTZ",$HOROLOG,$JOB)="No Stop Request Detected."
QUIT
+5 ;
SIZE ;TOOL--SIZE OF ROUTINES
+1 XECUTE ^%ZOSF("RSEL")
SET ZT1=""
FOR ZT=0:0
SET ZT1=$ORDER(^TMP($JOB,ZT1))
if ZT1=""
QUIT
XECUTE "ZL @ZT1 X ^%ZOSF(""SIZE"") W !,ZT1,?10,Y,?15,"" "",$P($P($T(+1),"";"",2),""-"",2,999)"
+2 KILL ^TMP($JOB)
QUIT
+3 ;
MULTPL ;test task--Test running multiple managers on different nodes of VAXcluster
+1 LOCK +^TMP("XUTMTZ")
HANG 1
+2 WRITE !,"..............................................................."
+3 WRITE !,ZTSK,": ",$HOROLOG,"...",$JOB
+4 LOCK -^TMP("XUTMTZ")
QUIT
+5 ;
STOP2 ;;Test ZTSTOP code
+1 FOR ZT=1:1:792
SET X=$$S^%ZTLOAD
if X
QUIT
WRITE 9
+2 IF X
SET ZTSTOP=1
+3 QUIT
+4 ;
WATCH ;DON'T QUEUE--watch tasks as they are scheduled and unscheduled
+1 SET ZTSK=0
+2 FOR ZT=0:0
DO LOOKUP
WRITE !,"Update: ",ZTU,?15,"Queued: ",ZTS,?30,"Late: ",ZTO,?40,"New: ",ZTN,?50,"Subs: ",ZTSU,?60,"Free Subs: ",ZTF
READ X:1
if X="^"
QUIT
+3 QUIT
+4 ;
LOOKUP ;WATCH--get data to show
+1 SET ZTH=$HOROLOG
SET ZTR=$SELECT($DATA(^%ZTSCH("RUN"))#2:^("RUN"),1:"")
SET ZTU="off"
+2 IF ZTR
SET ZTU=ZTH-ZTR*86400+$PIECE(ZTH,",",2)-$PIECE(ZTR,",",2)
IF ZTU>99
SET ZTU="late"
+3 SET ZT1=0
SET ZTO=0
SET ZTS=0
FOR ZT=0:0
SET ZT1=$ORDER(^%ZTSCH(ZT1))
SET ZT2=""
if 'ZT1
QUIT
FOR ZT=0:0
SET ZT2=$ORDER(^%ZTSCH(ZT1,ZT2))
if 'ZT2
QUIT
SET ZTS=ZTS+1
SET ZTH=$HOROLOG
IF ZTH-ZT1*86400+$PIECE(ZTH,",",2)-$PIECE(ZT1,",",2)>0
SET ZTO=ZTO+1
+4 SET ZTN=^%ZTSK(-1)-ZTSK
SET ZTSK=^(-1)
+5 SET ZTSU=0
SET ZT1=""
FOR ZT=0:0
SET ZT1=$ORDER(^%ZTSCH("TASK",ZT1))
if ZT1=""
QUIT
SET ZTSU=ZTSU+1
+6 SET ZTF=0
IF $DATA(^%ZTSCH("SUB"))#2
SET ZTF=^("SUB")
SET ZTSU=ZTSU+ZTF
+7 QUIT
+8 ;
HANG ;;Wait five minutes then quit
+1 HANG 300
QUIT
+2 ;
OWN ;;Hold a device until told to release it
+1 FOR A=0:0
HANG 1
IF $DATA(^%ZTSK(ZTSK,.4))#2
QUIT
+2 QUIT
+3 ;
QOWN ;entry--queue an own task
+1 SET ZTRTN="OWN^XUTMTZ"
SET ZTDTH=$HOROLOG
SET ZTIO=""
SET ZTDESC="Toad test 1"
SET ZTSAVE("ZTREQ")="@"
DO ^%ZTLOAD
QUIT
+2 ;
Q ;entry--queue a test task
+1 SET ZTRTN="QUICK^XUTMTZ"
SET ZTDTH=$HOROLOG
SET ZTIO=""
SET ZTDESC="Toad test"
SET ZTSAVE("ZTREQ")="@"
DO ^%ZTLOAD
QUIT
+2 ;
DELAY ;;Record delay in start
+1 SET ZTN=$HOROLOG
SET ZTO=$PIECE(^%ZTSK(ZTSK,0),"^",6)
SET Y=$$DIFF^%ZTM(ZTN,ZTO,0)
+2 SET ^TMP("XUTMTZ",ZTN,ZTSK)="DELAY^"_IO_"^"_ZTN_"^"_ZTO_"^"_Y
+3 IF $$S^%ZTLOAD("DELAY TIME IS "_Y)
+4 QUIT
PTASK ;;See if persistent status works.
+1 SET CNT=$GET(^%ZTSCH("TASK",ZTSK,"CNT"),0)
+2 SET ^%ZTSCH("TASK",ZTSK,"CNT",CNT)=$$HTE^XLFDT($HOROLOG)
+3 IF '$DATA(^%ZTSCH("TASK",ZTSK,"P"))
SET X=$$PSET^%ZTLOAD(ZTSK)
HANG 15
HALT
+4 HANG 30
+5 SET ^("CNT")=$GET(^("CNT"))+1
IF ^("CNT")>5
SET X=$$PCLEAR^%ZTLOAD(ZTSK)
QUIT
+6 HALT
+7 QUIT