EsoReflexUserManual-3 9 PDF
EsoReflexUserManual-3 9 PDF
S O U T H E R N O B S E R V A T ORY
Organisation Européenne pour des Recherches Astronomiques dans l'Hémisphère Austral
Europäische Organisation für astronomische Forschung in der südlichen Hemisphäre
ESO - EUROPEAN SOUTHERN OBSERVATORY
Figure 1: ESO specific actors
Figure 2: How to instantiate the RecipeExecuter
Figure 3: Recipe selection
Figure 4
The preferred director for Reflex workflows is the DDF director, but the PN director can also be used,
although it is not officially tested. The first step of the workflow execution is the DataOrganizer, which
organizes a set of files and groups them together in Datasets according to some classification and grouping
rules, written with the OCA language (a full set of rules is provided together with each workflow): the output
is a list of Datasets, which contain science frames and all the associated raw and static calibrations required
to process them.
The second step is the DataSetChooser, which displays all the Datasets provided by the DataOrganizer, and
allows the user to view their contents and select the ones that are to be processed. The output of this actor
is the serialized list of selected Datasets. The output of the DataSetChooser must be connected to a
FitsRouter, which splits the Dataset and sends the files to different output ports based on their observation
type: these ports can then be used to feed the various pipeline recipes of the workflows.
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 11 of 38
3.5 File purpose
The file purpose is a new concept introduced in Reflex 2 that represents what a file is needed for; the
purpose of a file describes the whole reduction cascade that will make use of the file. For example, a raw
BIAS might have the purpose MASTER_BIAS/SCIENCE if it’s going to be used to produce the master bias that
will be used to reduce the science frames, or MASTER_BIAS/MASTER_FLAT/SCIENCE, if the master bias will
be used to generate a master flat, which in turn will be used to reduce the science frames.
This new concept allows Reflex to recreate the whole calibration cascade, for instance we might have
different master biases in different points of the workflow, produced with different recipe parameters.
The purpose is used in many places of the workflow to decide the routing and the scheduling of files, for
example:
- The SofSplitter groups the files by purpose and emits a number of tokens equal to the number of
different purposes present in the input SoF;
- The SofCombiner, and any input multiport that accepts SoFs as an input, combine the input SoFs
based on their purpose, collecting only those files whose purpose is present in all input ports.
In order to help the users in the process of customizing the workflow, e.g. by plugging in their own reduction
steps or precomputed files, a special purpose has been defined, named UNIVERSAL, that matches any other
purpose when it comes to combining or splitting SoFs.
3.6 General features
• Workflow execution: you can start, pause, stop and resume the workflow by using the buttons in the
toolbar. The highlighted button indicates which state the workflow is in. Please note that the stop
button immediately interrupts any running pipeline recipe, while the pause button lets the current
recipe or actor finish before the workflow is actually paused. After pressing the pause button, it is
also possible that more than one actor is executed, since this behaviour depends on the scheduling
policy. For instance, if there are two actors in parallel, and you pause the workflow while one is
being executed, then both of them will be executed before the workflow is actually paused.
• The DDF and the PN directors support actor highlighting; this feature is disabled by default: if you
want to enable it click on Tools->Animate at Runtime, select an interval (e.g. 10ms) and click ok.
From now on the active workflow actor will be highlighted in red. Note: if you pause and resume a
workflow the actor is not highlighted upon resume.
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 12 of 38
4. ACTOR DOCUMENTATION
The documentation of the Reflex actors is available from the workflow, by right clicking on an actor and
selecting Documentation->Display. RecipeExecuter instances also display the help of the recipe parameters.
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 13 of 38
5. RECIPE ITERATION
It is sometimes useful to be able to visualize the products of a recipe execution, tweak some recipe
parameter and execute the recipe again, until the products are as expected.
This can be easily achieved in Reflex by means of the RecipeLooper and the PythonActor.
A typical subworkflow that allows iteration is depicted in Figure 5, and it is composed of the following
elements:
- Sof coming from previous actor
- Sop containing recipe parameters’ initial values
- A RecipeLooper
- A RecipeExecuter containing the pipeline recipe to be optimized
- A PythonActor containing a custom python script that allows the user to view the results of the
recipe execution and decide whether he wants to change some parameters or not. The script should
either generate a “true” token on the control port and a SoF to the next downstream actor or a
“false” token on the control port and a SoF and a SoP to the RecipeLooper loop input port.
This general structure must be customized for each pipeline recipe. The user must:
- Identify sensible recipe parameters he wants to tweak to optimize the products
- Define some initial conditions for these parameters and provide them to the sop_in port of the
RecipeLooper. The simplest way to do this is to define a string in the format described in APPENDIX
A: and connect it to a SopCreator.
- Configure the RecipeExecuter, changing the value of the recipe parameters you want to optimize to
PORT (e.g. if you want to optimize a recipe parameter called par1 look for a parameter in the
RecipeExecuter called recipe_param_nn whose value is par1=some_value and change it to
par1=PORT).
- Write a python script that allows the user to evaluate the product quality, change the value of the
parameters and decide whether he wants to continue or not. The script does not have to be
interactive, it can implement an optimization algorithm defined by the user.
Sample implementations of this system are provided with the workflows included in the pipeline
distribution.
Note: it is possible to iterate over an arbitrary number of actors, you are not forced to iterate over one
RecipeExecuter.
Figure 5: sample looping workflow
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 14 of 38
6. PYTHON BASED RECIPES
EsoReflex is now able to support Python based recipe plugins that are executed through the normal EsoRex
interface. To take advantage of this feature, you need to have EsoReflex 2.9.0 or newer installed, together
with an appropriate version of EsoRex (3.13 or newer).
EsoRex must however have been built with Python based recipe support enabled, i.e. the necessary 3rd party
dependencies must be installed (libffi or libavcall.a) and the --enable-python-recipes build option needs to be
used if not enabled by default. Please refer to the EsoRex software documentation for further compilation
and installation details.
RPM and MacPorts based packages of EsoRex as delivered by ESO should already have EsoRex 3.13 correctly
built with Python recipe support enabled. You can simply follow the normal package installation procedure
for EsoRex, if installing RPMs or MacPorts packages.
2
For old platforms this would be the Pyfits API instead.
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 20 of 38
method can be used to write a corresponding HDU list to the output FITS file associated with the output
frame. For example:
def process(self, frames, ...):
...
outframe = Frame('output.fits', 'PROD', type=Frame.TYPE_IMAGE)
outframe.write(hdulist)
return [outframe]
Note that the write method is a wrapper around the Astropy API writeto method. Thus, both methods accept
the same set of additional arguments. In particular, the overwrite option may be useful, since the FITS files
will not be overwritten by default. For example:
outframe.write(hdulist, overwrite=True)
6.2.7 Raising Errors
If an non recoverable error occurs in the recipe that must cause a fatal exception, you should use the
raise_error method. This will raise a Python exception and abort further processing of data. An error message
and error code will be forwarded back to EsoRex.
The raise_error method accepts three arguments, the error message to send (a string), the corresponding
error code (an integer), and a boolean indicating if a traceback of the Python stack where the exception was
raised should be printed to standard error. If an error code is not specified then a value of 1 is used by
default. Also the traceback is not printed by default.
The following are examples of using the raise_error method:
def process(self, frames, ...):
...
self.raise_error('Something went wrong')
self.raise_error('Error with traceback', 123, print_traceback=True)
...
The value for the error code can be any non-zero integer. However, CPL error codes are typically returned by
recipes. Please refer to the CPL documentation for a listing of available error codes.
6.5 Debugging
The most straight forward procedure for entering a debugging session when trying to debug a Python based
recipe, is to first attempt to invoke the recipe as normal within EsoReflex. This will leave a cmdline.sh file
under the bookkeeping directory, which contains everything needed to run the recipe from the command
line in exactly the same way that EsoReflex ran it. Before running cmdline.sh, you should add the following
statement to the Python recipe code:
import ipdb; ipdb.set_trace()
This break point should be added in the place where you want to start debugging, i.e. the source code
location where the program should stop and enter the debugger. If ipdb is not available on your system, you
can fall back to using pdb as follows3:
import pdb; pdb.set_trace()
In the case of example_recipe.py mentioned in section 6.3., the break point statement can for example be
added to line 114 in that file.
With the break point set, you can then launch the cmdline.sh script. This will run EsoRex, launch the Python
interpreter and stop at the break point within the debugger’s shell. The code can then be stepped through,
additional break points set and the variables explored. For details about how to use the ipdb or pdb shell
commands, you can type the “help” command in the shell or refer to the relevant documentation for those
tools4.
3
Note that the pdb debugger has a more primitive shell than ipdb. Thus, ipdb is usually preferred.
4
For pdb refer to https://docs.python.org/2/library/pdb.html and ipdb to https://pypi.python.org/pypi/ipdb. The commands
and usage of ipdb is mostly the same as for pdb.
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 22 of 38
In some cases, it may be useful to see more details about the interaction between EsoRex and the Python
interpreter. This can be enabled by changing the esorex.caller.msg-level parameter in the EsoRex
configuration file. For example, esorex.rc should have the following line changed to:
esorex.caller.msg-level=debug
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 23 of 38
7. EXECUTING IDL SCRIPTS
IDL scripts can easily be launched by esoreflex trough a Python Actor. If the IDL executable or the needed
scripts are not in the system path, then their location have to be hardcoded in the Python script associated
to the Python Actor. The IDL script has to accept inputs and outputs filenames from the command line.
We provide below an example of a Python script (python_script.py) that is designed to launch an IDL script,
and the IDL script itself (myidlscript.pro)
#!/usr/bin/env python
import reflex
import sys
from astropy.io import fits
from optparse import OptionParser
import json
import os
if __name__ == '__main__':
parser = reflex.ReflexIOParser()
#Define inputs/outputs
parser.add_option("-i", "--in_sof", dest="in_sof")
parser.add_output("-o", "--out_sof", dest="out_sof")
inputs = parser.get_inputs()
outputs = parser.get_outputs()
in_sof = inputs.in_sof
files = in_sof.files
# If the IDL executable is not in the system path, I need to hardcode it in the script.
os.system("bash -c '/scisoft/bin/idl -e myidlscript -args "+infile+" "+out_str+"'")
files.append(reflex.FitsFile(output_filenames[i],output_catgs[i],csum,output_purpose))
newsof = reflex.SetOfFiles(output_datasetname,files)
outputs.out_sof = newsof
# broadcast output:
parser.write_outputs()
sys.exit()
We provide below an example of IDL script that is called by the python script. In the example, the IDL script
accepts a list of input files and generates 2 outputs. The names of the inputs and outputs are determined by
the python script and passed to IDL via command line.
pro myidlscript
n_outputs = 2
args=command_line_args()
end
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 25 of 38
8. ESOREFLEX STARTUP SCRIPT
ESO-Reflex is executed by means of a startup script, named esoreflex, that help the user in setting up the
proper environment for the execution of ESO pipelines and python scripts. This chapter describes all its
features and configuration options.
8.1 Command line options
The esoreflex launch command can be customised with many optional command line arguments. Many of
these are related to the underlying Kepler framework and will not be described here. Details can be found in
Keplers online help. Here we describe the most important command line arguments introduced specifically
by esoreflex.
8.1.1 -h | -help
This prints a help/usage message and stops. The message will contain a listing of command line options that
can be given to the esoreflex launch command.
8.1.2 -v | -version
Prints version information and exits. The version of esoreflex being invoked is printed, including a list of
pipelines that esoreflex knows about and each pipeline's version number.
8.1.3 -l | -list-workflows
This will list all installed workflow XML and KAR files that can be found and are available to run with
esoreflex. These will be all the workflows found in a subdirectory under one of the paths set in the
esoreflex.workflow-path variable. This variable can be configured in the system wide esoreflex.rc or private
(per user) configuration file.
The format of the output will be a table with a short format name for each workflow and the full path to the
workflow file. If multiple files have the same name, the short name will be prefixed with a part of the path to
make each short name in the list unique. In such a case, the short names may not always point to the same
file if there is a configuration change of esoreflex, the system or a filename change. It is best not to rely on
the short name to uniquely identify the workflow, but rather the full path to the file should be used. The
short names are only for convenience when working with esoreflex interactively on the command line.
Either the full file path or the short name as listed with the -l | -list-workflows option can be used in the
esoreflex command to open or run the specified workflow directly. For example:
esoreflex fors_spec
8.1.4 -n | -non-interactive
This option enables non-interactive features of esoreflex to be used for batch and non-interactive execution
of workflows. When used, additional options are passed to esoreflex and the Kepler framework to prevent
the graphical user interface from showing and to automatically execute the workflow. You will need to pass
the path to the workflow XML/KAR file or use the short name for the workflow as known to the esoreflex
launch command (listed with the -l | -list-workflows option). For example:
esoreflex -n fors_spec
8.1.5 -config <file>
Use this option to force the esoreflex launch command to use a custom configuration file, rather than the
system one or ~/.esoreflex/esoreflex.rc if that exists. The option takes one argument, the name or path to the
configuration file. If this option is used then any variables in either the system wide or
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 26 of 38
~/.esoreflex/esoreflex.rc files will be completely ignored. Only variables defined in the file given by <file> are
used, and for any that are missing, an internal default value is used instead.
8.1.6 -create-config <file>
Generates a new configuration file and exits. This option is convenient to create a new working configuration
file that can subsequently be modified by the user, rather than creating a configuration file from scratch. The
option takes one argument, <file>. If the argument is set to the special value TRUE then a new configuration
file is created in the user's home directory under ~/.esoreflex/esoreflex.rc. Otherwise a file name or path
must be given for <file>, in which case a new file will be written to that location. Any existing file is backed up
to a file with a .bak extension, or .bakN where N is an integer, if a backup copy also already exists.
8.1.7 -debug
This prints additional information that can be useful for debugging problems with the esoreflex configuration.
The following information is printed before invoking the actual esoreflex binary:
• The path to the configuration file used by the launch command.
• All environment variables as seen by the esoreflex binary at start time.
• The full paths to the java, esorex and python binaries if found.
• The full Java command used to actually invoke the esoreflex program.
8.2 The esoreflex.rc file
Reflex primarily relies on three binary programs to work: java, esorex and python. To function properly, Reflex
must know where these programs are located and how they should be invoked. This can be configured within
a configuration file, called esoreflex.rc by default.
Normally when using the Reflex tarball package directly, no configuration file is provided. Reflex will simply
use some internal default values that are reasonable guesses. However, system installations of Reflex will
have a default system wide esoreflex.rc file created. Alternatively, a per user configuration file can be placed
in the following location in the home directory ~/.esoreflex/esoreflex.rc or a file path can be passed to the
esoreflex command with the -config option, e.g. esoreflex -config myconfig.rc
The configuration file provided in -config will take the highest precedence. If no configuration is given
explicitly on the command line then the file ~/.esoreflex/esoreflex.rc is used if it exists. If it does not exist
then the system wide configuration is used, if that exists. This will usually be /etc/esoreflex.rc, but might be
placed in a different location depending on the platform. If no configuration file is provided anywhere then
the internal default values are used. To summarise, the search order for the configuration file/variables is,
starting from the highest precedence to lowest:
1. File given by the command line -config option.
2. ~/.esoreflex/esoreflex.rc
3. System wide esoreflex.rc, usually under /etc/esoreflex.rc.
4. Internal default values.
Be aware that any variables that are not specified in your custom configuration file will use the default
internal values and not the values from the system wide configuration file. For example, if there exists a
system /etc/esoreflex.rc file and you pass myconfig.rc to esoreflex that does not contain the esoreflex.python-
path variable, the internal default value will be used, rather than the one from the system /etc/esoreflex.rc
file. Putting this another way, no merging is performed between custom configuration files and the system
wide one.
Note: using a custom esoreflex.rc together with a system wide installation is meant for power users only.
Furthermore, users should consider that system wide upgrades of Reflex might break the custom
configuration defined in esoreflex.rc
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 27 of 38
8.3 Creating a configuration file
The configuration file for esoreflex is just a text file that can be created or modified with any text editor. For
convenience however, there is a command line option to the esoreflex launch command called -create-config
that can be used to generate a customised configuration file filled with all valid variables. This can then be
further modified as needed. The option takes one parameter, either TRUE, or the name of the file to which
the configuration will be saved. Existing files will be backed up to a file with the '.bak' extension, or '.bakN'
where N is an integer if the file name is already taken. For example, the following command will create a new
configuration file in ~/.esoreflex/esoreflex.rc:
esoreflex -create-config TRUE
Alternatively, to create a file named myconfig.rc in the local directory, you can run the following command:
esoreflex -create-config myconfig.rc
8.4 Configuration file format
The configuration files are plain text files that contain “name=value” pairs on separate lines. There should be
no spaces between the name of the variable and the equal sign '='. Any whitespace in the value is used as is.
Thus, any spaces immediately after the equal sign may have semantic meaning and should be avoided if not
necessary. If a variable name is given more than once in the same file the value from the last declaration is
used and all previous declarations are ignored. Comments start with the pound sign '#' character. All text
starting from this character (including the '#') is ignored up to the end of the line.
To help make configuration files compatible across versions of esoreflex, the special ${esoreflex_base} macro
can be used in the value part of a variable declaration. This allows you to avoid hardcoding the base
installation path of the esoreflex package, which can change from version to version or by installation
method. The following shows an example usage for encoding the python path:
esoreflex.python-path=${esoreflex_base}/esoreflex/python
The tilde character '~' can also be used as usual in any variable expecting a path. This will be expanded to the
user's home directory.
All variables that can be used in a esoreflex configuration file are listed and described in the following sub-
sections. None of the variables described below have to be present in the configuration file. For any variable
that is not present, an internal default value will be used. However, it is possible that on certain platforms the
default may not be appropriate and lead to errors. You can use the -create-config option to make sure you
start from a working version of the configuration file, with all variables properly set.
8.4.1 esoreflex.inherit-environment
This controls if the user's environment variables should be used by the esoreflex command as is, i.e. inherited
or not. The value must be either TRUE or FALSE. If set to TRUE then no changes are made to the user's
environment variables when invoking the esoreflex binary and all of them will be visible to the binary. In
addition, any environment variables configured by the user will take precedence over values set by the
esoreflex launch command as derived from the configuration file. In contrast, for a value of FALSE, every
environment variable will be unset and only a select number will be configured when invoking esoreflex. A
listing of the environment variables used by esoreflex can be seen by adding the -debug option to the
command line call.
8.4.2 esoreflex.java-command
This must contain the Java binary or command that must be used to start a Java process. In the simplest case,
it can just contain the string java. Alternatively this can be a full path to a specific binary to use. Extra
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 28 of 38
command line options can also be given if necessary. For example:
esoreflex.java-command=/usr/bin/java -Xdiag
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 29 of 38
8.4.3 esoreflex.workflow-path
This must be a colon separated list of paths in which to search for workflow XML or KAR files. The tilde
character can be used in the paths, which will be expanded to the user's home directory. As an example:
esoreflex.workflow-path=~/KeplerData/workflows/MyWorkflows
8.4.4 esoreflex.esorex-command
This variable must contain the required command to invoke the esorex binary. By default it is set to the string
esorex. This variable can contain the full path to the binary and also include additional command line options.
An example where this can be handy is to execute esorex with changed priorities (using nice) or to pin it to
particular processors as shown below:
esoreflex.esorex-command=likwid-pin -c N:0-3 esorex
8.4.5 esoreflex.esorex-config
This must be a path to the configuration file to use by the esorex program. With a normal system installation
this will point to a custom configuration file prepared by esoreflex itself. To use a different file change or set
the path where the file is located. For example:
esoreflex.esorex-config=~/.esorex/esorex.rc
8.4.6 esoreflex.esorex-recipe-config
Similarly to the esoreflex.esorex-config variable, this must point to the location of the default recipe
configuration file to use when invoking esorex. Normally this should point to an empty dummy file, but can
be adjusted in special cases. For example:
esoreflex.esorex-recipe-config=~/.esorex/myrecipe.rc
8.4.7 esoreflex.python-command
Similar to the configuration of the esorex command, this variable will configure the command that must be
invoked to start python. By default this is simply set to the string python. You can use the full path to the
binary and include extra command line options as usual. For example:
esoreflex.python-command=/usr/bin/python27
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 30 of 38
8.4.8 esoreflex.python-path
This must contain a colon separated list of additional paths to search for python modules. If the
esoreflex.inherit-environment variable is TRUE then the contents of esoreflex.python-path will be appended
to the PYTHONPATH user's environment variable if it exists, otherwise PYTHONPATH will be set to the
contents of esoreflex.python-path as is. In system installations of esoreflex, its configuration files will usually
set the esoreflex.python-path variable to contain search paths to internal python modules. You will have to
be careful not to remove these, to avoid breaking esoreflex. For example:
esoreflex.python-path=${esoreflex_base}/esoreflex/python:~/mymodules
8.4.9 esoreflex.path
This must be a colon separated list of additional binary search paths that will be added to the PATH
environment variable. This is particularly useful if you want to be able to invoke a privately installed program
or script from a system installation of esoreflex. If the esoreflex.inherit-environment variable is TRUE then the
contents of esoreflex.path is appended to the user's PATH environment variable. Thus the user's binaries will
take precedence. Otherwise for esoreflex.inherit-environment=FALSE the contents of esoreflex.path is
prepended to the system PATH variable as returned by the getconf command. In which case the binaries
found under the paths in esoreflex.path will take precedence over the user's ones.
8.4.10 esoreflex.library-path
This must be a colon separated list of additional search paths for shared libraries. When esoreflex.inherit-
environment is set to TRUE then the contents of esoreflex.library-path will be appended to the
LD_LIBRARY_PATH environment variable (DYLD_LIBRARY_PATH for BSD derived platforms, such as Apple OS
X). This means that the user's shared libraries will take precedence if the (DY)LD_LIBRARY_PATH was
configured by the user. Otherwise when
esoreflex.inherit-environment=FALSE the (DY)LD_LIBRARY_PATH environment variable is set to the contents
of esoreflex.library-path as is, completely ignoring any value set in the user's environment. For system
installations of esoreflex, the configuration files may have this variable set to point to internal shared libraries
for certain platforms. Care will have to be taken not to remove these paths so as to avoid breaking esoreflex.
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 31 of 38
8.5 Environment variables
The behaviour of the esoreflex launch command can be modified with the following environment variable.
8.5.1 ESOREFLEX_CLEAN_ENVIRONMENT
If this variable is set, it's value must be either TRUE or FALSE. If set to TRUE then all environment variables
will be unset before invoking the esoreflex binary. Only certain environment variables are set within the clean
environment setting before the invocation. This environment variable will also override any setting of
esoreflex.inherit-environment provided in a configuration file e.g. the system wide esoreflex.rc.
The following command can be used to see exactly which environment variables are used and configured by
the launch command:
esoreflex -debug
The variables will be listed in the “Environment used” section.
8.6 Custom esoreflex.rc file use cases
Here we present some examples to show how to setup a configuration file for esoreflex to deal with certain
common use cases. These will all assume the bash or similar shell is used. You will have to adjust the
examples for other shell types appropriately.
8.7 Using a private installation of esorex
In certain cases you may want to use a private installation of esorex, for debugging for example. If using the
esoreflex tarball package rather than a system installation, the user's environment variables will be inherited.
In this case all you need to do is make sure that the custom esorex binary is found in the PATH environment
variable. For example, if you have a custom esorex binary installed under ~/myesorex/bin/esorex, you should
preprend the path to the PATH variable as indicated below:
export PATH=”~/myesorex/bin:$PATH”
To have this setting persist across login sessions you can add this to your ~/.profile or ~/.bashrc file as
appropriate. You may also need to similarly deal with the LD_LIBRARY_PATH (DYLD_LIBRARY_PATH on BSD
derived platforms like Apple OS X) if you have shared libraries in non-standard locations.
If a system installation of esoreflex was performed then the user's environment variables will not be inherited
by default. Thus, the above export method will not work. Instead, a new custom configuration file should be
created for esoreflex. Here we show how to create a configuration file that will apply to all your login sessions
(not to all users). The first thing to do is create a working template configuration with the following
command:
esoreflex -create-config TRUE
This will create a new file in ~/.esoreflex/esoreflex.rc. Any existing configuration will be backed up to a file
with a .bak or .bakN (where N is an integer) extension. You will have to edit this new file in a text editor and
change the variable esoreflex.esorex-command to the following value:
esoreflex.esorex-command=~/myesorex/bin/esorex
If shared libraries have been installed in a non-standard location, for example the CPL libraries went into
~/mycpl/lib, you will also have to let esoreflex know about these also. Modify the esoreflex.library-path
variable by appending the path ~/mycpl/lib to it:
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 32 of 38
esoreflex.library-path=~/mycpl/lib
If there was already a value set for esoreflex.library-path then you likely want to keep that and simply append
the new path to the end, as indicated in the following example:
esoreflex.library-path=/opt/local/lib:~/mycpl/lib
Once done modifying the configuration, the next invocation of esoreflex should now use your custom esorex
binary. If any sessions of esoreflex were already started before creating the custom configuration, you will
have to close them and restart esoreflex.
As an alternative to creating a configuration file that will be used for all your esoreflex sessions, you may
want to create a custom configuration file to use just for a particular esoreflex invocation. In this case you
should run the following command to create a configuration file template in your current working directory:
esoreflex -create-config mycfg.rc
You can of course use a different path or even a full path for the file, rather than mycfg.rc. The
esoreflex.esorex-command and esoreflex.library-path variables must be modified in the mycfg.rc file as
indicated before. But you will now have to remember to add the -config option to the esoreflex launch
command whenever you want to use this configuration file. For example:
esoreflex -config mycfg.rc
8.8 Using a private installation of python
When you want to use a private or different installation of python, rather than the system one, you can do so
in a similar manner as shown previously for esorex. If using the esoreflex tarball directly, the python that is
used by esoreflex is configured in the user's environment variables. Specifically this is set in the variables
PATH and LD_LIBRARY_PATH (DYLD_LIBRARY_PATH on BSD derived platforms like Apple OS X). Details are
already shown in the esorex section above and not repeated here. The following will instead show how to
modify the python that will be used by a system installation of esoreflex, which is the more common end user
case.
Let us assume your custom python installation resides in ~/mypython/bin and you have some python
modules in ~/mypython/modules that you would like to use. The first step requires creating a custom
configuration file template for esoreflex. This can be done with the following command:
esoreflex -create-config TRUE
A new file will be created in ~/.esoreflex/esoreflex.rc. Any previous copy will be backed up to a file with a .bak
or .bakN (where N is an integer) extension. The ~/.esoreflex/esoreflex.rc file must be edited in a text editor
and the following variables set:
esoreflex.python-command=~/mypython/bin/python
esoreflex.python-path=${esoreflex_base}/esoreflex/python:~/mypython/modules
Take note that any value that was already set in the esoreflex.python-path variable should be kept, unless you
wanted to replace the internal esoreflex python modules and you know what you are doing. You should just
append your own paths to the esoreflex.python-path varaible with a colon separating all paths.
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 33 of 38
One the modifications are complete you should stop any esoreflex sessions that are already running and
restart esoreflex. All future invocations of esoreflex should now use the custom python installation with your
own modules.
If you wanted to only use the custom python only for certain invocations of esoreflex, you will want to create
a custom configuration file other than in ~/.esoreflex/esoreflex.rc. For example, mycfg.rc in the current
working directory as follows:
esoreflex -create-config mycfg.rc
This file should be modified as indicated before and esoreflex must be invoked with the -config option as
follows:
esoreflex -config mycfg.rc
You can change the name of mycfg.rc to any value you want, so long as it is not ~/.esoreflex/esoreflex.rc,
which would be automatically read by every esoreflex invocation. You can also use full paths to the
configuration files for the -config and -create-config options.
8.9 Using the user's environment
When dealing with a system installation of esoreflex, you may want to customise various aspects of how
esorex or python is executed using your user environment variables that you have set up. By default a system
installation of esoreflex will not inherit the user's environment variables i.e. they will all be unset, except for a
select few, such as the PATH, HOME, LANG, LOGNAME, HOSTNAME and DISPLAY (Note: this list may not be
exhaustive. Use esoreflex -debug to see an exact listing). To force esoreflex you use the environment as has
been set by you, you will need to create a modified configuration file.
Start by running the following command to create a new configuration template in ~/.esoreflex/esoreflex.rc:
esoreflex -create-config TRUE
Any existing ~/.esoreflex/esoreflex.rc file will be backed up to ~/.esoreflex/esoreflex.rc.bak with a possible
integer suffix.
You will then want to edit the new file in a text editor. Change the esoreflex.inherit-environment variable and
set it to TRUE, as shown below:
esoreflex.inherit-environment=TRUE
When done you should stop all existing esoreflex sessions and restart them. All environment variables that
you normally see in your terminal session should now also be used by future invocations of esoreflex. To
confirm this you can start esoreflex with the following command and inspect the “Environment used”
section:
esoreflex -debug
8.10 Customising the esorex command used by esoreflex
To customise the esorex command that will be used by esoreflex, you will need to create a new configuration
file. As indicated in previous sections, the template file should be created with the following command:
esoreflex -create-config TRUE
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 34 of 38
This will create a new file called ~/.esoreflex/esoreflex.rc and any existing file in that location will be backed
up to ~/.esoreflex/esoreflex.rc.bak with a possible integer suffix. The ~/.esoreflex/esoreflex.rc file will be used
for all your invocations of esoreflex, unless using the -config option. It is possible to create a configuration file
that will only be used for certain invocations of esoreflex. For example, if you want a custom configuration file
called ~/my_esoreflex_cfg.rc in your home directory, you should run the following command:
esoreflex -create-config ~/my_esoreflex_cfg.rc
In either case, the new file must be modified in a text editor. Assume you want to change the scheduling
priority of esorex with the nice command to 10, you need to set the esoreflex.esorex-command variable as
follows:
esoreflex.esorex-command=nice -n 10 esorex
You can change the command to whatever you like. As another example, to use the likwid tool to force
esorex to use only certain processors, you may want to set the esoreflex.esorex-command variable as follows:
esoreflex.esorex-command=likwid-pin -c N:0-3 esorex
You may also need to update the esoreflex.path variable in the new configuration file, to indicate the location
of the likwid-pin binary as follows:
esoreflex.path=/usr/local/bin
Adjust the path appropriately for your platform.
Once all the modifications are complete, you should stop any running esoreflex sessions and restart them. In
the case that the configuration file was saved to ~/my_esoreflex_cfg.rc, you should start esoreflex as follows:
esoreflex -config ~/my_esoreflex_cfg.rc
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 35 of 38
9. TROUBLESHOOTING
Log4j, the logging library used by Reflex, defines the following logging levels, starting from the most verbose:
TRACE, DEBUG, INFO, WARN, ERROR, FATAL.
If you want to put all Reflex actors in debug mode change the first line as follows:
log4j.logger.org.eso=DEBUG, CONSOLE
If you want, for example, to raise the logging level of the RecipeExecuter to DEBUG, then you have to add the
following line:
log4j.logger.org.eso.RecipeExecuter=DEBUG, CONSOLE
Note that the most restrictive condition is applied.
9.1.1 Logging to file
By default Reflex logs only to the console, so that if you want the logs to be saved also to a file, then you
have to modify the first line of the configuration file (see 9.1) from
log4j.rootLogger=WARN, CONSOLE
to
log4j.rootLogger=WARN, CONSOLE, R
The log filename is defined in the section LOGGING TO FILE of the same configuration file.
9.2 Reflex hangs
In the past some users have experienced a Reflex hang when they were browsing the ESO workflows: the
origin of this issue is unclear, but it can be solved by increasing the memory assigned to Reflex.
To do so, open the menu entry “Tools->JVM Memory Settings” and increase the value of Max Memory.
The installation script provides a simple tool (esoreflex_set_memory) to change it from the command
line.
9.3 SQL error messages
If you run into error messages about a missing table or column, it’s very likely that you are using a
bookkeeping directory created by an old version of Reflex. The solution is to remove it (or move it, if you still
need to run said old version): the default location is ~/reflex_data/reflex_book_keeping.
9.4 Strange behavior of actor String Costant
The actor String Constant comes from Kepler, and it has a peculiar behavior when it’s value is set to a
parameter (i.e. something starting with a $ sign): if you close the window using the Commit button, then the
value is stored as input. If, on the other hand, you press Enter, then Kepler tries to resolve the value of the
parameter and replaces it in the actor. The effect is that, if afterwards you change the value of the
parameter, the actor will not pick it up.
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 36 of 38
APPENDIX B: example.py
#!/usr/bin/env python
import sys
if __name__ == '__main__':
if hasattr(inputs, "input2"):
outputs.output2 = inputs.input2
else:
outputs.output2 = 'test2'
# print outputs
parser.write_outputs()
sys.exit()
Doc: VLT-MAN-ESO-19000-5037
Issue: 3.9
ESO Reflex User Manual Date: 20/04/2018
Page: 38 of 38