Written by

Application Services Intern at InterSystems Corporation
Question Justin Millette · Jun 23

Best way to "do this after another class compiles"?

I have a class with a projection that creates some persistent classes (chunks) and a non-persistent "Daemon" class that I want to have running in the background, doing some processing. The daemon needs to look at the "chunk" classes, and I want it to be simple to start the daemon -- I am currently calling the daemon's start method at the end of the CreateProjection method. When I do this, I get a <CLASS DOES NOT EXIST> error from the daemon when it tries to query against one of the chunk tables. But, if I add a "HANG 5" at the beginning of the daemon start method, this runs fine. I am assuming this is because the chunk class compilations are being jobbed away, so we fire the daemon start method before the compilations finish. 

"HANG 5" or similar feels like a bandage solution, and with larger projections that need to compile more chunk classes, 5 seconds might not be enough. Is there a way to programmatically "wait for this compilation to be finished and then do a thing?" 

I am also not sure if compilation gets jobbed away, if anyone has any insight into that, that would be wonderful as well.

Please let me know if there is other useful information I can provide. Thank you!

Product version: IRIS 2025.1
$ZV: IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2025.1 (Build 225_1U) Fri May 16 2025 12:22:16 EDT

Comments

Justin Millette  Jun 23 to Matthew Giesmann

Tried /multicompile=0 and did not see a change. 

0
Matthew Giesmann · Jun 23

My other thought would be to (carefully!) take out and release the oddDEF lock for the class

//adjust timeout
lock +^oddDEF(class):5
//check $test and handle timeouts appropriately
write $test
1//make sure this happens
lock -^oddDEF(class)#"I"
0
Timo Lindenschmid · Jun 24

I would safegueard the code execution in the daemon by checking %Dictionary.CompiledClass to see if the chunk classes are compiled yet.

0
Justin Millette  Jun 24 to Timo Lindenschmid

This is what I landed on. Since the "setup" part of the daemon only needs to run once at daemon startup, this solution doesn't pose any timing problems/long waits. Thanks!

0
Justin Millette  Jun 24 to Vitaliy Serdtsev

EndCompile looks like it would be super helpful! I landed on a different solution, but EndCompile looks like it would do exactly what I want.

Also, thanks for noting QueueClass -- I was directly calling $SYSTEM.OBJ.Compile() which is not ideal :)

0