Compilation Status after Import

Is there a way to enumerate the compilation status of a package?    

currently after deployment we are doing something like this to validate a successful load and compile of classes:

successful_compilation_count=`grep -a "Compilation finished successfully" output.log | wc -l`
successful_load_count=`grep -a "Load finished successfully" output.log | wc -l`

is there a method to do this where it is a little bit more elegant/dynamic without having to maintain counts for comparison ?

  • 0
  • 67
  • 2
  • 2


I'm calling load code like this:

csession ensemble "##class(isc.git.GitLab).load()"


/// Do a full load
/// do ##class(isc.git.GitLab).load()
ClassMethod load()
    try {
        set dir = "/src"
        do ..log("Importing dir " _ dir)
        do $system.OBJ.ImportDir(dir, "*.xml", "c", .errors, 1)
        throw:$get(errors,0)'=0 ##class(%Exception.General).%New("Load & compile error")
    } catch ex {
        write !,$System.Status.GetErrorText(ex.AsStatus()),!
        do $system.Process.Terminate(, 1)

This way process terminates abnormally on error:

do $system.Process.Terminate(, 1)

And it's usually reported as error in CI/CD systems.

Additionally you can grep for "Load & compile error".

I'm currently writing a series of articles on continuous delivery, check it out (latest part).

Ooo I like this. In this context, someone compiling a set of package classes won't have to count or otherwise depend on any counters that a build responds to - as long as all the classes compile without error, it would be good to go - and searching for the error text would be easy for any logger to spot, especially if the exception text contained the filename it was loading, etc., abnormalities in the build would be spotted ASAP.

The terminate could be conditional as well as you might want to see all of the errors in that build cycle so they can all be addressed simultaneously by the different groups (if there are more than one involved).