Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

{geo}[SYSTEM] SNAP-ESA v8.0 and python interface with Python-2.7.18/GCCcore-10.2.0 #13198

Merged
merged 11 commits into from
Oct 18, 2023
Merged
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
easyblock = 'Bundle'

name = 'SNAP-ESA-python'
version = '8.0'
local_javasuffix = '-Java-%(javaver)s-OpenJDK'
lexming marked this conversation as resolved.
Show resolved Hide resolved
versionsuffix = local_javasuffix + '-Python-%(pyver)s'

homepage = 'https://step.esa.int/main/toolboxes/snap/'
description = "Python interface to the Sentinel Application Platform (SNAP) API"

toolchain = {'name': 'GCCcore', 'version': '10.2.0'}

dependencies = [
('Java', '1.8.0_292', '-OpenJDK', SYSTEM),
lexming marked this conversation as resolved.
Show resolved Hide resolved
('SNAP-ESA', version, local_javasuffix, SYSTEM),
('Python', '2.7.18'),
]

local_pysite = 'lib/python%(pyshortver)s/site-packages'
local_pyinstalldir = '%%(installdir)s/%s' % local_pysite

postinstallcmds = [
# Install snappy from SNAP-ESA
# snappy-conf is buggy and it hangs after doing the installation of snappy,
# start snappy-conf in a new SID and kill all processes of its PGID
# whenever it prints the final line starting with "or copy"
"mkdir -p %s" % local_pyinstalldir,
('LOG="$(mktemp -d)/snappy-conf.log"; mkfifo $LOG; trap "rm -f $LOG" EXIT;'
'setsid snappy-conf $EBROOTPYTHON/bin/python %s 2>&1 > $LOG & CONFPID=$!;'
'while read line; do echo "$line"; [ -z "${line##or copy*}" ] && kill -- -$CONFPID; done < $LOG;')
% local_pyinstalldir,
]

sanity_check_paths = {
'files': [],
'dirs': [local_pysite],
}

sanity_check_commands = ["python -c 'import snappy'"]

modextrapaths = {'PYTHONPATH': [local_pysite]}

local_javaopts = " -Dsnap.pythonExecutable=python"
local_javaopts += " -Dsnap.pythonModuleDir=%s" % local_pyinstalldir

modluafooter = 'setenv("JAVA_TOOL_OPTIONS", os.getenv("JAVA_TOOL_OPTIONS").."%s")' % local_javaopts
lexming marked this conversation as resolved.
Show resolved Hide resolved

moduleclass = 'geo'
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
easyblock = 'Binary'

name = 'SNAP-ESA'
version = '8.0'
versionsuffix = '-Java-%(javaver)s-OpenJDK'
lexming marked this conversation as resolved.
Show resolved Hide resolved

homepage = 'https://step.esa.int/main/toolboxes/snap/'
description = """
The Sentinel Application Platform (SNAP) is a common architecture for all
Sentinel Toolboxes being jointly developed by Brockmann Consult, SkyWatch and
C-S.
The SNAP architecture is ideal for Earth Observation processing and analysis
due to the following technological innovations: Extensibility, Portability,
Modular Rich Client Platform, Generic EO Data Abstraction, Tiled Memory
Management, and a Graph Processing Framework."""

toolchain = SYSTEM

local_installer = 'esa-snap_all_unix_%s.sh' % version.replace('.', '_')
local_varfile = '%(name)s-%(version)s-response.varfile'

source_urls = [
'https://download.esa.int/step/snap/%(version)s/installers',
'https://step.esa.int/downloads/%(version)s/installers',
]
sources = [local_installer]
patches = [(local_varfile, '.')]
checksums = [
'b49d6795f55bbe9ecb46f9c289ac245626243d3fcd32211b47a54b26b508798e', # esa-snap_all_unix_8_0.sh
'5ea98e3376bb3df52b9c4c99ab4986015296b815021e16486b58e4aad58e21a4', # SNAP-ESA-8.0-response.varfile
]

# The installation is executed with the bundled JRE 1.8.0_242 (Zulu)
# at runtime we switch it to AdoptOpenJDK, which is known to be more reliable for SNAP-ESA
dependencies = [
('Java', '1.8.0_292', '-OpenJDK'),
lexming marked this conversation as resolved.
Show resolved Hide resolved
]

install_cmd = "INSTALL4J_TEMP='%(builddir)s' "
install_cmd += "bash %s -dir '%%(installdir)s'" % local_installer
install_cmd += " -q -varfile '%s'" % local_varfile

postinstallcmds = [
# set paths
'sed -i "s|jdkhome.*|jdkhome=$JAVA_HOME|" %(installdir)s/etc/snap.conf',
'sed -i "s|#snap.home.*|snap.home=%(installdir)s|" %(installdir)s/etc/snap.properties',
# remove default maximum memory allocation pool
'sed -i "s|-J-Xmx[0-9G]* ||" %(installdir)s/etc/snap.conf',
# disable update checks
"echo 'snap.versionCheck.interval=NEVER' >> %(installdir)s/etc/snap.properties",
"sed -i 's|dpiaware=false|& -J-Dplugin.manager.check.interval=NEVER|' %(installdir)s/etc/snap.conf",
# (optional) update all modules to latest version
# the update command is buggy and it hangs after doing the update, kill it whenever it prints "updates=0"
# see issue https://senbox.atlassian.net/browse/SNAP-927
# ('LOG="$(mktemp -d)/snap-update.log"; mkfifo $LOG; trap "rm -f $LOG" EXIT;'
# 'SNAPCMD="%(installdir)s/bin/snap --nosplash --nogui --userdir "%(builddir)s/snap" --modules --update-all";'
# '$SNAPCMD 2>&1 > $LOG & SNAPPID=$!;'
# 'while read line; do echo "$line"; [ "$line" = "updates=0" ] && kill $SNAPPID; done < $LOG;'),
]

sanity_check_paths = {
'files': ['bin/snap', 'bin/gpt'],
'dirs': ['probavbox', 'rstb', 's1tbx', 's2tbx', 's3tbx', 'smos', 'snap'],
}

sanity_check_commands = [
"snap --nosplash --nogui --modules --list",
"gpt -h",
]

moduleclass = 'geo'
15 changes: 15 additions & 0 deletions easybuild/easyconfigs/s/SNAP-ESA/SNAP-ESA-8.0-response.varfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# install4j response file for ESA SNAP 8.0
deleteSnapDir=DESKTOP
executeLauncherWithPythonAction$Boolean=false
forcePython$Boolean=true
pythonExecutable=python
sys.adminRights$Boolean=false
sys.component.3109$Boolean=true
sys.component.RSTB$Boolean=true
sys.component.S1TBX$Boolean=true
sys.component.S2TBX$Boolean=true
sys.component.S3TBX$Boolean=true
sys.component.SMOS$Boolean=true
sys.component.SNAP$Boolean=true
sys.languageId=en
sys.programGroupDisabled$Boolean=true