Taskman Internals

From VistApedia
Revision as of 23:12, 20 September 2015 by Shabiel (talk | contribs)
Jump to: navigation, search

Taskman components

Routines

  •  %ZTLOAD (API to create a task)
  • Manager
  • Sub-manager
  • The menu options to use to manipulate Taskman

Globals

  •  %ZTSCH (the tasks "index" plus control structures for taskman... not a Fileman file)
  •  %ZTSK (Tasks Fileman file)

^%ZTSK Structure

^%ZTSK contains the actual task.

^%ZTSK(-1) contains the most recently assigned task.

.1 node: Current Status

  • 1 -> Scheduled by %ZTLOAD
  • 2 -> Not on any list
  • L -> Rejected
  • 3 -> In Job List
  • A -> In IO List
  • 4 -> Not on any index, but prepping
  • 5 -> On task list (i.e. running)
  • 6 -> Succeeded (NB: may not see this if task gets deleted immediately)

.2 node: IO

.3 node: Variables to use in the task

^%ZTSCH Structure

^%ZTSCH has indexes on the task file. It decides when a task will be run.

^%ZTSCH(seconds, task number) is the index of what to do when. The number of seconds is since the $H epoch.

Once a task is ready to run, it kills off the entry in (sec,task#) and puts it in another index ("JOB",sec,task#) or in ("IO",sec,task#) for tasks waiting for a device.

Submanagers watch ^%ZTSCH("IO") and ("JOB"). Once they find something, they kill it off there and put it in ("TASK").

("SUB") contains the list of available submanagers.

Submanagers run the job directly (no job command). The manager keeps looking for free submanagers and adds submanagers

Taskman Monitor Counters

Task List

    • ("SUB") (# number of subs available)
    • ("TASK") -> Number of running tasks.

To obtain the sub, do the following:

N ZTPAIR D SUBCHK^%ZTMS5(0)
Q ^%ZTSCH("SUB",ZTPAIR)

Job List

("JOB") -> Almost always empty. If increasing, it's a warning sign. Increase triggers submanager launches.

IO List

For specific devices (e.g. Printers). Submanager will process IO list sequentially and then go back to job list.

Host files do not go to IO list; they stay in the Job List

If you can't get a device, taskman reschedules the job for the future.

Schedule List

^%ZSTCH($H in seconds,task number in ^%ZTSK) -- Tasks scheduled to start in the future.

$H has to be converted to seconds b/c $H itself collates alphabetically. Cf. `$$SEC^XLFDT`

It's normal to have some late, because they have to be late in order to run.

Status List

%ZTSCH("STATUS") tells what Taskman is doing. Time stamp shouldn't be more than 10-15 seconds old. You can have multiple managers running. It's updated by manager. Has Job # as subscript.

^%ZTSCH("RUN") tells you when it was last updated.

Booting

To start clean, ^ZTMB. To re-start RESTART^ZTMB.

Wait State

Artificial state intended to help programmers and system managers. No longer take from the Schedule List and put on the Job List.