Home   Package List   Routine Alphabetical List   Global Alphabetical List   FileMan Files List   FileMan Sub-Files List   Package Component Lists   Package-Namespace Mapping  
Routine: ZTLOAD

ZTLOAD.m

Go to the documentation of this file.
  1. %ZTLOAD ;ISF/RDS,RWF - TaskMan: Programmer Interface: Entry Points ;07/26/2006
  1. ;;8.0;KERNEL;**67,118,127,339,381**;JUL 10, 1995;Build 2
  1. ;
  1. QUEUE ;queue a task (create, schedule) (Entry Point = ^%ZTLOAD)
  1. G ^%ZTLOAD1
  1. ;
  1. S(MSG) ;Entry Point: extrinsic variable returns boolean: should task stop?
  1. I $G(ZTQUEUED)>.5,$D(^%ZTSCH("TASK",ZTQUEUED)) S ^%ZTSCH("TASK",ZTQUEUED,1)=$H
  1. I $D(MSG),$G(ZTQUEUED)>.5 S ^%ZTSK(ZTQUEUED,.11)=MSG
  1. N ZTSTOP S ZTSTOP=0
  1. I $G(ZTQUEUED)>.5,$L($P($G(^%ZTSK(ZTQUEUED,.1)),"^",10)) S ZTSTOP=1
  1. Q ZTSTOP
  1. ;
  1. TM() ;Entry Point: extrinsic variable returns boolean: is TM running?
  1. N ZTH,ZTR S ZTH=$H,ZTR=$G(^%ZTSCH("RUN"))
  1. Q ZTH-ZTR*86400+$P(ZTH,",",2)-$P(ZTR,",",2)<500
  1. ;
  1. REQ ;Entry Point: requeue a task (edit, reschedule)
  1. G ^%ZTLOAD3
  1. ;
  1. KILL ;Entry Point: delete a task
  1. S ZTSK=$G(ZTSK)
  1. K ZTSK(0) S ZTSK(0)=0
  1. I ZTSK>1,$D(^%ZTSK(ZTSK)) D L -^%ZTSK(ZTSK) ;could be done!
  1. . L +^%ZTSK(ZTSK):20 Q:'$T
  1. . ;Don't kill running persistent tasks.
  1. . I $D(^%ZTSCH("ZTSK",ZTSK,"P")) Q
  1. . K ^%ZTSK(ZTSK) S ZTSK(0)=1
  1. Q
  1. ;
  1. ISQED ;Entry Point: return whether task is pending (scheduled or waiting)
  1. G ^%ZTLOAD4
  1. ;
  1. STAT ;Entry Point: return status of a task
  1. G ^%ZTLOAD5
  1. ;
  1. DQ ;Entry Point: dequeue a task (unschedule)
  1. G ^%ZTLOAD6
  1. ;
  1. DESC(DESC,LST) ;Find tasks with description
  1. G DESC^%ZTLOAD5
  1. ;
  1. RTN(RTN,LST) ;Find tasks that call this routine
  1. G RTN^%ZTLOAD5
  1. ;
  1. OPTION(OPNM,LST) ;Find tasks for this OPTION.
  1. G OPTION^%ZTLOAD5
  1. ;
  1. JOB(ZTM) ;Return the job # for a running task
  1. G JOB^%ZTLOAD5
  1. ;
  1. ZTSAVE(%,%1) ;input variables in string delimited by ; to build ZTSAVE array
  1. N %2 K:$G(%1) ZTSAVE
  1. F %1=1:1 S %2=$P(%,";",%1) Q:%2="" S ZTSAVE(%2)=""
  1. Q
  1. ;
  1. PSET(ZTM) ;e.f. Set the persistents node
  1. D TN Q:'$D(^%ZTSCH("TASK",ZTM)) 0
  1. S ^%ZTSCH("TASK",ZTM,"P")=""
  1. Q 1
  1. ;
  1. PCLEAR(ZTM) ;Clear the persistents node
  1. D TN Q:'$D(^%ZTSCH("TASK",ZTM))
  1. K ^%ZTSCH("TASK",ZTM,"P")
  1. Q
  1. ;
  1. ASKSTOP(ZTSK) ;E.F. Ask a task to stop.
  1. G ASKSTOP^%ZTLOAD2
  1. Q
  1. ;
  1. TN S ZTM=$S($G(ZTM)>0:ZTM,$G(ZTQUEUED)>.9:ZTQUEUED,$G(ZTSK)>0:ZTSK,1:0)
  1. Q