Question
· Jul 12, 2017

Cannot call job for instance method?

Greetings, can someone give me some help? I'm trying to use job for a instance method, as it's described here but...

Anyway, I have a method like this:

Method PrepareInstance(path)
{
  set ..Tool = ##class(Tool).%New(path)
  do $System.Event.Signal($zparent)
}

That is being called like this:

Method TestPurge() As %Status
{
  job ..PrepareInstance(..GetTestDirectory("../fixtures/_/dummy-project"))::10
  set msg = $System.Event.Wait("",10)
}

But it fails because:

<METHOD DOES NOT EXIST>zTestPurge+1^UnitTest.Tool.1 *PrepareInstance

Am I missing something or is that a bug? The method surely exists and the job is also being created inside another instance method.

Thanks in advance.

Discussion (5)0
Log in or sign up to continue

..Method can be a instance method as well as a class method within the context of an instance, that's the syntax.

An instance method needs the instance (object) it belongs to, if you would like to 'job' that to another process, then in some way the object would need go go along with that (aka Beam Me Up Scotty ;-)) and that's not supported by Cache'.

If you have an instance method in your class that doesn't need the instance, you probably want to change that to a class method.