RESJOB while compiling classes
Hi everyone
I'm coding a script in order to validade an installation package following the steps:
- Import classes
// Do some stuffs
- Compile Classes
}Catch (ex){
// oops ...
}
In some specific cases I will need to terminate the current process and start a new one with some new parameters.
With any code inside my try catch block, whenever I terminate the process I receive a RESJOB and it works perfectly.
When my job is running a compilation ($SYSTEM.OBJ.Compile(.classes)) and receive a RESJOB, it does not catch the exception. It just terminate, so the environment is not destroyed.
Any ideas on how to handle this situation?
Thank you all
Edit 1:
I also tried $$$THROWONERROR(sc,$SYSTEM.OBJ.Compile(.classes)), since it returns a status
Comments
A Compile has also an errlog parameter ist is clear that it does an inner error trapping.
ByRef classes As %String = "",
qspec As %String = "",
ByRef errorlog As %String,
recurse As %Boolean = 0) As %Status [ CodeMode = expression ]
.
therfore at termination it doesn't end in your catch{ }
I think it may even react specially on RESJOB by just doing a HALT.
in a development environment, you may try to investigate this using a %ZSTOP routine
or you make use of a $HALT routine
Excellent idea to narrow it down and limit the environment
Hi Eduard.
It did not work neither with a single-process. ![]()
UPD. Who throws a RESJOB? Do you want to kill compile process from external process (that was my idea)?
Exactly! At first we just want to have some basic page interface to start/stop the script.
Anyway you caught the idea. It is totally related to continuous integration. I'll take a loot at your articles.
Thank you
Hi Robert.
The errorlog var is not filled in this case... I have also checked it out.
I'll take a look at $HALT routine or %ZSTOP
Thank you
Compilation is usually multi-process, I'd try single-process compilation and see how it works:
$SYSTEM.OBJ.Compile(.classes, "/multicompile=0")
Multicompile qualifier:
Name: /multicompile
Description: Enable use of work queue manager (optionally specify the number of workers if value >1)
Type: stringUPD. Who throws a RESJOB? Do you want to kill compile process from external process (that was my idea)? Or do you want to terminate abnormally? If it's the second you need to check errolog from Compile method and terminate the process explicitly:
do $system.Process.Terminate(, 1)Also I wrote a series of articles on managing Continuous Delivery process. Check it out.
As a remedy, you can process compilation in a separated job, something like this:
- Create environment { }
- JOB ImportAndCompileStuff
- Wait for the job completion
- Destroy environment { }