Miscellaneous

Collection of miscelleneous Eskapade related items.

  • See Migration Tips to migrate between Eskapade versions.
  • See macOS to get started with Eskapade on a mac.

Migration Tips

From version 0.8 to 0.9

In Eskapade v0.9 the core functionality has been migrated to the separate package Eskapade-Core. We have tried to make this transition as seamless as possible, but you may well run into any migration issues. In case you do below we list the changes needed to migrate from Eskapade version 0.8 to version 0.9.

  • Whenever a line with import eskapade fails, simply replace eskapade with escore.
  • For example: from eskapade import core change to from escore import core

That’s it.

From version 0.6 to 0.7

Below we list the API changes needed to migrate from Eskapade version 0.6 to version 0.7.

Macros

  • Process manager definition:

    • proc_mgr. change to process_manager.
    • ProcessManager change to process_manager
    • Delete line: proc_mgr = ProcessManager()
  • Logger:

    • import logging change to from eskapade.logger import Logger, LogLevel
    • log. change to logger.
    • log = logging.getLogger('macro.cpf_analysis') change to logger = Logger()
    • logging change to LogLevel
  • Settings:

    Remove os.environ['WORKDIRROOT'], since the environment variable WORKDIRROOT is no longer defined, define explicitly the data and macro paths, or execute the macros and tests from the root directory of the project, resulting in something like:

    • settings['resultsDir'] = os.getcwd() + 'es_results'
    • settings['macrosDir']  = os.getcwd() + 'es_macros'
    • settings['dataDir']    = os.getcwd() + 'data'
  • Chain definition in macros:

    • To import the Chain object add from eskapade import Chain
    • Change process_manager.add_chain('chain_name') to <chain_name> = Chain('chain_name')
    • process_manager.get_chain('ReadCSV').add_link to <chain_name>.add

Tests

  • Process manager definition:

    • Change ProcessManager() to process_manager
    • Change process_manager.get_chain to process_manager.get
  • Settings:

    Remove os.environ['WORKDIRROOT'], since the environment variable WORKDIRROOT is no longer defined, define explicitly the data and macro paths, or execute the macros and tests from the root directory of the project, resulting in something like:

    • settings['macrosDir'] = os.getcwd() + '/es_macros'
    • settings['dataDir']   = os.getcwd() + '/data'
  • StatusCode:

    • Change status.isSkipChain() to status.is_skip_chain()

macOS

To install Eskapade on macOS there are basically four steps:

  • Setting up Python 3.6
  • Setting up Apache Spark 2.x
  • Setting up ROOT 6.10.08
  • Setting up Eskapade

Note

This installation guide is written for macOS High Sierra with Homebrew, and fish.

Setting up Python 3.6

Homebrew provides Python 3.6 for macOS:

$ brew install python3

To create an isolated Python installation use virtualenv:

$ virtualenv venv/eskapade --python=python3 --system-site-packages

Each time a new terminal is started, set up the virtual python environment:

$ . ~/venv/eskapade/bin/activate.fish

Setting up ROOT 6

Clone ROOT from the git repository:

git clone http://root.cern.ch/git/root.git
cd root
git checkout -b v6-10-08 v6-10-08

Then compile it with the additional flags to ensure the desired functionality:

$ mkdir ~/root_v06-10-08_p36m && cd ~/root_v06-10-08_p36m
$ cmake -Dfftw3=ON -Dmathmore=ON -Dminuit2=ON -Droofit=ON -Dtmva=ON -Dsoversion=ON -Dthread=ON -Dpython3=ON -DPYTHON_EXECUTABLE=/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/bin/python3.6m -DPYTHON_INCLUDE_DIR=/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/include/python3.6m/ -DPYTHON_LIBRARY=/usr/local/opt/python3/Frameworks/Python.framework/Versions/3.6/lib/libpython3.6m.dylib $HOME/root
$ cmake --build . -- -j7

PS: make sure all the flags are picked up correctly (for example, -Dfftw3 requires fftw to be installed with Homebrew).

To setup the ROOT environment each time a new shell is started, set the following environment variables:

set -xg ROOTSYS "$HOME/root_v06-10-08_p36m"
set -xg PATH $ROOTSYS/bin $PATH
set -xg LD_LIBRARY_PATH "$ROOTSYS/lib:$LD_LIBRARY_PATH"
set -xg DYLD_LIBRARY_PATH "$ROOTSYS/lib:$DYLD_LIBRARY_PATH"
set -xg LIBPATH "$ROOTSYS/lib:$LIBPATH"
set -xg SHLIB_PATH "$ROOTSYS/lib:$SHLIB_PATH"
set -xg PYTHONPATH "$ROOTSYS/lib:$PYTHONPATH"

Note that for bash shells this can be done by sourcing the script in root_v06-10-08_p36m/bin/thisroot.sh.

Finally, install the Python packages for ROOT bindings:

$ pip install rootpy==1.0.1 root-numpy=4.7.3

Setting up Apache Spark 2.x

Apache Spark is provided through Homebrew:

$ brew install apache-spark

The py4j package is needed to support access to Java objects from Python:

$ pip install py4j==0.10.4

To set up the Spark environment each time a new terminal is started set:

set -xg SPARK_HOME (brew --prefix apache-spark)/libexec
set -xg SPARK_LOCAL_HOSTNAME "localhost"
set -xg PYTHONPATH "$SPARK_HOME/python:$PYTHONPATH"

Setting up Eskapade

To set up the Eskapade environment (Python, Spark, ROOT) each time a new terminal is started, source a shell script (e.g. setup_eskapade.fish) that contains set the environment variables as described above:

# --- setup Python
. ~/venv/eskapade/bin/activate.fish

# --- setup ROOT
set -xg ROOTSYS "${HOME}/root_v06-10-08_p36m"
set -xg PATH $ROOTSYS/bin $PATH
set -xg LD_LIBRARY_PATH "$ROOTSYS/lib:$LD_LIBRARY_PATH"
set -xg DYLD_LIBRARY_PATH "$ROOTSYS/lib:$DYLD_LIBRARY_PATH"
set -xg LIBPATH "$ROOTSYS/lib:$LIBPATH"
set -xg SHLIB_PATH "$ROOTSYS/lib:$SHLIB_PATH"
set -xg PYTHONPATH "$ROOTSYS/lib:$PYTHONPATH"

# --- setup Spark
set -xg SPARK_HOME (brew --prefix apache-spark)/libexec
set -xg SPARK_LOCAL_HOSTNAME "localhost"
set -xg PYTHONPATH "$SPARK_HOME/python:$PYTHONPATH"

# --- setup Eskapade
cd /path/to/eskapade

Finally, install Eskapade (and it’s dependencies) by simply running:

$ pip install Eskapade