Written by

Web Developer
Question Mack Altman · Sep 26, 2017

Task Manager failed executing RunLegacyTask

Recently, we scheduled two tasks (1008 and 1009) within Task Manager. Task ID 1008 is set to run after Purge Tasks (%SYS-ID:3), and Task 1009 is set to run at 7:00:00 each day.

In attempt to provide as much detail as possible, each of the tasks are as follows:

  • Task 1008WHILE (($p($h,",",2) < $ZTH("10:00 PM")) && ($P($g(^Task.1008(+$h,$j)),"^",1) = +$h)) { J ^ROUTINE, ^ROUTINE2 D SUB^ROUTINE3 H 5 }
  • Task 1009WHILE (($p($h,",",2) < $ZTH("10:00 PM")) && ($P($g(^Task.1009(+$h,$j)),"^",1) = +$h)) { d ^ROUTINE4, ^ROUTINE5 J SUB^ROUTINE6 }

The two tasks both reach an UNDEFINED error, which seems rather odd. The following are the email messages I receive from Caché with the subject line, "Scheduler process - failed".

Scheduler process Task 1008 - 1008 Scheduled for 2017-09-23 12:03, failed Executing Code %SYS.Task.RunLegacyTask at 2017-09-25 06:56 <UNDEFINED>zexecuteCode+4^%SYS.Task.RunLegacyTask.1 *Status

Scheduler process Task 1009 - 1009 Scheduled for 2017-09-24 07:00, failed Executing Code %SYS.Task.RunLegacyTask at 2017-09-25 06:55 <UNDEFINED>zexecuteCode+4^%SYS.Task.RunLegacyTask.1 *Status

How do I go about fixing the UNDEFINED error that is being encountered so that this does not occur every day? We end up having to manually start the tasks each day.

Comments

Pete Greskoff · Sep 26, 2017

I strongly suspect that the code we don't see (from running the routines executed within the task) kills the 'Status' variable. Take a look at this documentation.

0
Mack Altman  Oct 11, 2017 to Pete Greskoff

This ended up being the issue.

0
Jon Wooldridge · Sep 26, 2017

This is generally caused by an argumentless kill command in the routines called by the legacy task. Killing all the variables will also get rid of some variables relied on by the task manager. Do any of the routines called (ROUTINE1-ROUTINE6) call argumentless kills to clean up variables? 

0
Sean Connelly · Sep 26, 2017

Looking at my dev version of Cache (2014) the Status command has a $get wrapped around it...

Quit $g(Status,$$$OK)

Which should stop that error, but wondering if your version does not have this?

You could try just setting Status=1 after you call the routines, to prevent this from erroring.

0