To use Execution framework, in the main
of you entry point, the
first line should be
edu.umass.nlp.exec.Execution.init(pathToConfigFile);
The pathToConfigFile
should be a string to a
yaml file that stores global options. Global options are used to populate
objects with public mutable fields using reflection. The purpose of this
is to provide easy (but not secure or robust) option management.
The Execution framework does many thing, here's a summmary
Global Option Configuration
Options are grouped together in a hierarchichal fashion. For instance, the
main Execution option would be given in yaml by
exec:
execPoolDir: execs
loggerPattern: %-5p [%c]: %m%n
So in your code when you call:
Execution.Opts execOpts = Execution.fillOptions("exec", new Execution.Opts());
We reflectively look up options under the exec
part of the configuration
file and fills in fields of the passed in objects. You can fill in different instances
of the same options object by using different group names (e.g. exec1, exec2, ...
).
You can also do hierarchical option filling.
Store Execution Log and Options in a Directory
Another feature of the Execution framework is that the log of every run goes to a directory
specified in the exec.execDir
directory. Typically, you shouldn't specify the
directory and instead use the option exec.execPoolDir
which will automatically
make a new directory for each execution run by adding 0.exec,1.exec,2.exec,...
as needed. The directory will store everything sent to the logger as well as a copy of configuration
needed to re-run the experiment (modulo code changes obviously).
If you want to store other output in the execution directory, you have access to it in
Execution.getExecutionDirectry
.
You can add option processing behavior using
Execution.addOptionHandler
. See
StandardOptionHandlers
for example
option handlers.
Apache Logger Configuration
The Execution framework also configures the log4j logger (the pattern
for the logger prefix is configurable via the exec.loggerPattern
option
in your global config file.
This means in your code you should probably not use System.out.println
and
opt instead to use the logger. You can read about the Apache Logger system here.
Two relevant configurable options are: Execution.Opts.loggerPattern
and Execution.Opts.logLevel
.