FredHutch/ls2_python3

Name: ls2_python3

Owner: Fred Hutchinson Cancer Research Center

Description: Live Sciences Software - Python3

Created: 2018-02-15 22:34:55.0

Updated: 2018-03-01 04:12:12.0

Pushed: 2018-03-01 04:11:44.0

Homepage: null

Size: 151021

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

«««< HEAD

EasyBuild at FredHutch


Overview


New package requests (including Python and R libraries/modules)

Please open an issue against this repo to request new softwares!


Quickstart

please follow these simple steps:

 adduser --disabled-password --gecos "" eb
 sh -c "echo 'eb ALL=(ALL:ALL) NOPASSWD:ALL' > /etc/sudoers.d/zz_eb"
 -s https://raw.githubusercontent.com/FredHutch/easybuild-life-sciences/master/easybuild_bootstrap.sh | bash
le load EasyBuild
-3.3.1-foss-2016b.eb --robot

Presentation


Goals

Before and during implementation, we kept the following goals in mind:


Prerequisites

You need money to make money, and you need software to build software.


Our environment


Bootstrap


Bootstrap - Step One - RTFM


Bootstrap - Step Two - Environment

EasyBuild configuration

Configuration is consistent across methods:

Easybuild applies them in that order (meaning command-line overrides everything)

Since we use Modules, it made sense to use Environment Variables in our case


Bootstrap - Paths and Logs

In the easybuild modulefile, I added the following:

!Tcl
set ebDir "/app/easybuild"
setenv EASYBUILD_SOURCEPATH "$ebDir/sources"
setenv EASYBUILD_BUILDPATH "$ebDir/build"
setenv EASYBUILD_INSTALLPATH_SOFTWARE "$ebDir/software"
setenv EASYBUILD_INSTALLPATH_MODULES "$ebDir/modules"
setenv EASYBUILD_REPOSITORYPATH "$ebDir/ebfiles_repo"
setenv EASYBUILD_LOGFILE_FORMAT "$ebDir/logs,easybuild-%(name)s-%(version)s-%(date)s.%(time)s.log"

The modulefile is a tcl snippet and this sets environment variables for us.


Bootstrap Easybuild Parameters

!Tcl
# keep group writable bit
setenv EASYBUILD_GROUP_WRITABLE_INSTALLDIR 1
# set umask to preserve group write permissions on modulefiles
setenv EASYBUILD_UMASK 002
# create module dependencies to recursively unload
setenv EASYBUILD_RECURSIVE_MODULE_UNLOAD 1
# add our normal modulefile footer
setenv EASYBUILD_MODULES_FOOTER "$ebDir/etc/fredhutch_modulefile_footer"
# add our own easyconfig directory to robot paths
setenv EASYBUILD_ROBOT_PATHS ":$ebDir/fh_easyconfigs"
# Our licenses
setenv LM_LICENSE_FILE "$ebDir/etc/licenses/intel.lic"

These are more complex, and will be documented soon.


Bootstrap - Ownership and Permissions

There are a number of manual steps that were performed that can best be described as messy, and also perhaps make up the bulk of the useful information here.

Since we decided to have building be performed by members of a POSIX group, and we want produced software and modules centrally located for the use of everyone, we have to tell Easybuild how to do that.

Of course, some manual adjusting was needed:


Bootstrap - Easybuild Parameters

Bootstrap - Modulefile Manipulating

Ex:

!Tcl
set curMod [module-info name]
if { [module-info mode load] } {
    system "logger \$USER module load $curMod "
}

EasyBuilt

To use:

$ module use /app/easybuild/modules/all

$ module load EasyBuild/2.3.0

$ eb --version This is EasyBuild 2.3.0 (framework: 2.3.0, easyblocks: 2.3.0) on host rhino-d.

*Note - you should always use the newest version of EasyBuild that has been built as easyconfigs are distributed with EB.

Step-By-Step Build a package

Once you have EasyBuild bootstrapped, you can search for and build a package:

Begin by searching:

$ eb -S PCRE
== temporary log file in case of crash /tmp/eb-lz7d_6/easybuild-dKc03x.log
== Searching (case-insensitive) for 'PCRE' in /app/easybuild/software/EasyBuild/2.3.0/lib/python2.7/site-packages/easybuild_easyconfigs-2.3.0-py2.7.egg/easybuild/easyconfigs 
== Searching (case-insensitive) for 'PCRE' in /app/easybuild/fh_easyconfigs 
CFGS1=/app/easybuild/software/EasyBuild/2.3.0/lib/python2.7/site-packages/easybuild_easyconfigs-2.3.0-py2.7.egg/easybuild/easyconfigs/p/PCRE
 * $CFGS1/PCRE-8.12-goalf-1.1.0-no-OFED.eb
 * $CFGS1/PCRE-8.12-goolf-1.4.10.eb
 * $CFGS1/PCRE-8.12-ictce-4.0.6.eb
 * $CFGS1/PCRE-8.12-ictce-5.3.0.eb
 * $CFGS1/PCRE-8.12-ictce-5.5.0.eb
 * $CFGS1/PCRE-8.35-intel-2014b.eb
 * $CFGS1/PCRE-8.36-foss-2015a.eb
 * $CFGS1/PCRE-8.36-intel-2015a.eb
 * $CFGS1/PCRE-8.37-intel-2015a.eb
== Tmporary log file(s) /tmp/eb-lz7d_6/easybuild-dKc03x.log* have been removed.
== Temporary directory /tmp/eb-lz7d_6 has been removed.

Found easyconfigs!

We found 9 different easyconfigs for PCRE. Let's build this one:

PCRE-8.36-foss-2015a.eb

You probably figured out that 8.36 is the version of PCRE we will build, but what is foss?

That is the Easybuild toolchain for this easyconfig. You can get a list of toolchains with:

eb --list-toolchains

I prefer to just browse the repo - toolchains are just another easyconfig to Easybuild.


Dry Run

Once we have decided what to build, you can do a dry-run like this:

$ eb PCRE-8.36-foss-2015a.eb --robot --dry-run
== temporary log file in case of crash /tmp/eb-08QTaF/easybuild-r5D8gf.log
Dry run: printing build status of easyconfigs and dependencies
CFGS=/app/easybuild/software/EasyBuild/2.3.0/lib/python2.7/site-packages/easybuild_easyconfigs-2.3.0-py2.7.egg/easybuild/easyconfigs
 * [x] $CFGS/g/GCC/GCC-4.9.2.eb (module: GCC/4.9.2)
 * [x] $CFGS/o/OpenBLAS/OpenBLAS-0.2.13-GCC-4.9.2-LAPACK-3.5.0.eb (module: OpenBLAS/0.2.13-GCC-4.9.2-LAPACK-3.5.0)
 * [x] $CFGS/l/libtool/libtool-2.4.2-GCC-4.9.2.eb (module: libtool/2.4.2-GCC-4.9.2)
 * [x] $CFGS/m/M4/M4-1.4.17-GCC-4.9.2.eb (module: M4/1.4.17-GCC-4.9.2)
 * [x] $CFGS/a/Autoconf/Autoconf-2.69-GCC-4.9.2.eb (module: Autoconf/2.69-GCC-4.9.2)
 * [x] $CFGS/a/Automake/Automake-1.15-GCC-4.9.2.eb (module: Automake/1.15-GCC-4.9.2)
 * [x] $CFGS/n/numactl/numactl-2.0.10-GCC-4.9.2.eb (module: numactl/2.0.10-GCC-4.9.2)
 * [x] $CFGS/h/hwloc/hwloc-1.10.0-GCC-4.9.2.eb (module: hwloc/1.10.0-GCC-4.9.2)
 * [x] $CFGS/o/OpenMPI/OpenMPI-1.8.4-GCC-4.9.2.eb (module: OpenMPI/1.8.4-GCC-4.9.2)
 * [x] $CFGS/g/gompi/gompi-2015a.eb (module: gompi/2015a)
 * [x] $CFGS/f/FFTW/FFTW-3.3.4-gompi-2015a.eb (module: FFTW/3.3.4-gompi-2015a)
 * [x] $CFGS/s/ScaLAPACK/ScaLAPACK-2.0.2-gompi-2015a-OpenBLAS-0.2.13-LAPACK-3.5.0.eb (module: ScaLAPACK/2.0.2-gompi-2015a-OpenBLAS-0.2.13-LAPACK-3.5.0)
 * [x] $CFGS/f/foss/foss-2015a.eb (module: foss/2015a)
 * [ ] $CFGS/p/PCRE/PCRE-8.36-foss-2015a.eb (module: PCRE/8.36-foss-2015a)
== Tmporary log file(s) /tmp/eb-08QTaF/easybuild-r5D8gf.log* have been removed.
== Temporary directory /tmp/eb-08QTaF has been removed.

Dependencies

By giving the -r flag to Easybuild:


Build

And finally, you can remove the '-D' and build the software:

$ eb PCRE-8.36-foss-2015a.eb --robot --force
== temporary log file in case of crash /tmp/eb-1TnpU8/easybuild-3J4ttj.log
== resolving dependencies ...
== processing EasyBuild easyconfig /app/easybuild/software/EasyBuild/2.3.0/lib/python2.7/site-packages/easybuild_easyconfigs-2.3.0-py2.7.egg/easybuild/easyconfigs/p/PCRE/PCRE-8.36-foss-2015a.eb
== building and installing PCRE/8.36-foss-2015a...
== fetching files...
== creating build dir, resetting environment...
== unpacking...
== patching...
== preparing...
== configuring...
== building...
== testing...
== installing...
== taking care of extensions...
== postprocessing...
== sanity checking...
== cleaning up...
== creating module...
== permissions...
== packaging...
== COMPLETED: Installation ended successfully
== Results of the build can be found in the log file /app/easybuild/logs/easybuild-PCRE-8.36-20160104.164159.log
== Build succeeded for 1 out of 1
== Tmporary log file(s) /tmp/eb-1TnpU8/easybuild-3J4ttj.log* have been removed.
== Temporary directory /tmp/eb-1TnpU8 has been removed.

Step-By-Step EasyConfigs

Again, RTFM - it is very good!

There are two reason rou might want to modify or build an easyconfig file:

I'll demonstrate creating a new easyconfig as the procedure is the same, only generally easier for version updates.


Create an easyconfig file

Easybuild logic is contained in easyblocks - these are what execute the build. You can get a list of easyblocks with: eb --list-easyblocks.

There are a number of mandatory parameters for each easyblock, which can be displayed with:

eb -a -e <easyblock>

For this explanation, we will use the ConfigureMake easyblock, which should be familiar to anyone who has manually built software: ./configure && make && make install.

The naming convention is typically <name>-<version>-<toolchain name>-<toolchain version>.eb.


ConfigureMake Mandatory Parameters

This is a skeleton ConfigureMake easyconfig with all mandatory parameters:

!python
easyblock = 'ConfigureMake'
name = 
version = 
toolchain = 
description = 
homepage = 
docurls = 
software_license = 
software_license_urls = 

Except for easyblock, these will all default to None if not supplied in the file (so I guess they are not really mandatory, huh?)


Parameters: name, version

name

This name is the name of the software package, will be the name of the modulefile, and will be in the path of the software install directory. It is sometimes referenced later in the easyconfig file.

Ex:

!python
name = 'zlib'
version

This is the version of the software to build. It is referenced later in the easyconfig file.

Ex:

!python
version = '1.2.8'

Parameters: toolchain

toolchain

This is the toolchain (compilers, supplemental libraries, etc.) that easybuild will use to build the software. It must be specified in an existing easyconfig (though does not need to be pre-built - easybuild will take care of building it).

Ex:

!python
toolchain = {'name': 'foss', 'version': '2015b'}

This is a python dict specifying the name and version of the toolchain.


Parameters: description, homepage

description

This is a generally free-form description that will appear as metadata in the modulefile, and therefore be availabe to users through the module command.

Ex:

!python
description = """zlib is designed to be a free, general-purpose, legally
                 unencumbered -- that is, not covered by any patents --
                 lossless data-compression library for use on virtually any
                 computer hardware and operating system."""
homepage

This is a URL also included in modulefile metadata. It should be the homepage of the software.

Ex:

!python
homepage = 'http://www.zlib.net/'

Parameters: source, source_urls

We will need to specify a few more parameters for easybuild to handle things correctly:

!python
sources = 
source_urls = 

These will specify where easybuild should find the sourcecode for the software package. There are some shortcuts:

Ex:

!python
sources = [SOURCELOWER_TAR_GZ]
source_urls = ['http://sourceforge.net/projects/libpng/files/zlib/%(version)s']

These are python lists.


Build it!

That should be sufficient to build a basic package. Let's see what a failure looks like.

Here is my perfect easyconfig for rsync:

!python
easyblock = 'ConfigureMake'
name = 'rsync'
version = '3.1.2'
toolchain = {'name': 'foss', 'version': '2015b'}
description = """rsync is an open source utility that provides fast incremental file transfer"""
homepage = 'https://rsync.samba.org'
sources = [SOURCELOWER_TAR_GZ]
source_urls = ['https://download.samba.org/pub/rsync/src/rsync-3.1.2.tar.gz']

I save this as rsync-3.1.2-foss-2015b.eb and it should build!


Build Example

$  eb rsync-3.1.2-foss-2015b.eb
== temporary log file in case of crash /tmp/eb-j_sVge/easybuild-cY3SFZ.log
== processing EasyBuild easyconfig /app/easybuild/fh_easyconfigs/rsync-3.1.2-foss-2015b.eb
== building and installing rsync/3.1.2-foss-2015b...
== fetching files...
== creating build dir, resetting environment...
== unpacking...
== patching...
== preparing...
== configuring...
== building...
== testing...
== installing...
== taking care of extensions...
== postprocessing...
== sanity checking...
== FAILED: Installation ended unsuccessfully (build directory: /app/easybuild/build/rsync/3.1.2/foss-2015b): build failed (first 300 chars): Sanity check failed: no dir of ('lib', 'lib64') in /app/easybuild/software/rsync/3.1.2-foss-2015b
== Results of the build can be found in the log file /tmp/eb-j_sVge/easybuild-rsync-3.1.2-20160107.110632.Lepgl.log
ERROR: Build of /app/easybuild/fh_easyconfigs/rsync-3.1.2-foss-2015b.eb failed (err: "build failed (first 300 chars): Sanity check failed: no dir of ('lib', 'lib64') in /app/easybuild/software/rsync/3.1.2-foss-2015b")

Troubleshooting

We can look into the logfile mentioned (Results of the build can be found in the log file /tmp/eb-j_sVge/easybuild-rsync-3.1.2-20160107.110632.Lepgl.log') but in this case, the error is shown:

Sanity check failed: no dir of ('lib', 'lib64') in /app/easybuild/software/rsync/3.1.2-foss-2015b

And a quick search of sanity check in the Easybuild docs reveals that by default bin and lib or lib64 must not be empty after install. Rsync builds no lib directory, so we add the following to the easyconfig file:

sanity_check_paths = {'dirs': ['bin','share'], 'files': ['bin/rsync']}

And now it builds (trust me).

An interesting note I expected this build to fail as version 3.1.2 of rsync is distributed in rsync-3.1.2.tar.gz but is not actually compressed, only a tarball. Easybuild built it anyway!

ls2_python3

Please look at ls2 for details on how to build these Dockerfiles and how to use them to deploy the same software to a local archive.

This container adds: Python3

34c2607c52ea2576a50a407f68333ff624148831


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.