Skip to content

Conversation

@Crivella
Copy link
Contributor

@Crivella Crivella commented Oct 30, 2025

Feature proposed during the 2025-10-22 EB confcall

Adds a new --breakpoints option that takes a comma-separated list of breakpoint names.
The names should be the same as those for available hooks (with or without the trailing _hook suffix).

EB will drop you into an interactive shell with the same environment (before the corresponding hook would be ran)

TODO

  • Tests
  • BP name validation

Maybe

  • Customizable prompt / coloring

How does this look

(easybuild-dev) crivella@crivella-desktop:~$ eb --installpath=$(mktemp -d) -d --rebuild --breakpoints start,post_configure zlib-1.3.1-GCCcore-14.3.0.eb 
== Temporary log file in case of crash /home/crivella/.local/easybuild/logs/easybuild-fuaw57ut.log
easybuild-breakpoint> printenv | grep '^EB'
EB_SCRIPT_PATH=/home/crivella/.virtualenvs/easybuild-dev/bin/eb
easybuild-breakpoint> exit 
exit

WARNING: Index for /home/crivella/Documents/GIT/easybuild-easyconfigs/easybuild/easyconfigs is no longer valid (too old), so ignoring it...


WARNING: Index for /home/crivella/Documents/GIT/easybuild-easyconfigs/easybuild/easyconfigs is no longer valid (too old), so ignoring it...

== processing EasyBuild easyconfig /home/crivella/Documents/GIT/easybuild-easyconfigs/easybuild/easyconfigs/z/zlib/zlib-1.3.1-GCCcore-14.3.0.eb
== building and installing zlib/1.3.1-GCCcore-14.3.0...
  >> installation prefix: /tmp/tmp.bcDeYVNMdv/software/zlib/1.3.1-GCCcore-14.3.0
== fetching files and verifying checksums...
  >> sources:
  >> /home/crivella/.local/easybuild/sources/z/zlib/zlib-1.3.1.tar.gz [SHA256: 9a93b2b7dfdac77ceba5a558a580e74667dd6fede4585b91eefb60f03b72df23]
== ... (took < 1 sec)
== creating build dir, resetting environment...
  >> build dir: /home/crivella/.local/easybuild/build/zlib/1.3.1/GCCcore-14.3.0
== ... (took < 1 sec)
== unpacking...
  >> running shell command:
	tar xzf /home/crivella/.local/easybuild/sources/z/zlib/zlib-1.3.1.tar.gz
	[started at: 2025-10-30 16:36:18]
	[working dir: /home/crivella/.local/easybuild/build/zlib/1.3.1/GCCcore-14.3.0]
	[output and state saved to /tmp/eb-jjxd16gl/run-shell-cmd-output/tar-y7er46cw]
  >> command completed: exit 0, ran in < 1s
== ... (took < 1 sec)
== patching...
== ... (took < 1 sec)
== preparing...
  >> loading toolchain module: GCCcore/14.3.0
  >> loading modules for build dependencies:
  >>  * binutils/2.44
  >> (no (runtime) dependencies specified)
  >> defining build environment for GCCcore/14.3.0 toolchain
== ... (took < 1 sec)
== configuring...
  >> running shell command:
	./configure --prefix=/tmp/tmp.bcDeYVNMdv/software/zlib/1.3.1-GCCcore-14.3.0
	[started at: 2025-10-30 16:36:18]
	[working dir: /home/crivella/.local/easybuild/build/zlib/1.3.1/GCCcore-14.3.0/zlib-1.3.1]
	[output and state saved to /tmp/eb-jjxd16gl/run-shell-cmd-output/configure-uwljw6s5]
  >> command completed: exit 0, ran in 00h00m01s
easybuild-breakpoint> printenv | grep '^EB'
EBVARLDFLAGS=-L/home/crivella/.local/easybuild/software/binutils/2.44/lib64 -L/home/crivella/.local/easybuild/software/binutils/2.44/lib -L/home/crivella/.local/easybuild/software/GCCcore/14.3.0/lib64 -L/home/crivella/.local/easybuild/software/GCCcore/14.3.0/lib
EBVARCXX=g++
EBVERSIONBINUTILS=2.44
EBROOTBINUTILS=/home/crivella/.local/easybuild/software/binutils/2.44
EBVARF90=gfortran
EBVARFC=gfortran
EBDEVELGCCCORE=/home/crivella/.local/easybuild/software/GCCcore/14.3.0/easybuild/GCCcore-14.3.0-easybuild-devel
EBVAROPTFLAGS=-O2 -ftree-vectorize -march=native
EBVARCC=gcc
EBVARFCFLAGS=-O2 -ftree-vectorize -march=native -fno-math-errno -fPIC
EBVARPRECFLAGS=-fno-math-errno
EBVARLIBS=-lm -lpthread
EBVARFFLAGS=-O2 -ftree-vectorize -march=native -fno-math-errno -fPIC
EBVARCXXFLAGS=-O2 -ftree-vectorize -march=native -fno-math-errno -fPIC
EBROOTGCCCORE=/home/crivella/.local/easybuild/software/GCCcore/14.3.0
EBVARCPPFLAGS=-I/home/crivella/.local/easybuild/software/binutils/2.44/include
EBVARFLIBS=-lgfortran
EBVARF77=gfortran
EBDEVELBINUTILS=/home/crivella/.local/easybuild/software/binutils/2.44/easybuild/binutils-2.44-easybuild-devel
EB_SCRIPT_PATH=/home/crivella/.virtualenvs/easybuild-dev/bin/eb
EBVERSIONGCCCORE=14.3.0
EBVARCFLAGS=-O2 -ftree-vectorize -march=native -fno-math-errno -fPIC
EBVARF90FLAGS=-O2 -ftree-vectorize -march=native -fno-math-errno -fPIC
easybuild-breakpoint> echo $LDFLAGS 
-L/home/crivella/.local/easybuild/software/binutils/2.44/lib64 -L/home/crivella/.local/easybuild/software/binutils/2.44/lib -L/home/crivella/.local/easybuild/software/GCCcore/14.3.0/lib64 -L/home/crivella/.local/easybuild/software/GCCcore/14.3.0/lib
easybuild-breakpoint> exit
exit
== ... (took 25 secs)
== building...
  >> running shell command:
	make  -j 8
	[started at: 2025-10-30 16:36:44]
	[working dir: /home/crivella/.local/easybuild/build/zlib/1.3.1/GCCcore-14.3.0/zlib-1.3.1]
	[output and state saved to /tmp/eb-jjxd16gl/run-shell-cmd-output/make-jj82nypl]
  >> command completed: exit 0, ran in 00h00m01s
== ... (took 1 secs)
== testing...
== ... (took < 1 sec)
== installing...
  >> running shell command:
	make install
	[started at: 2025-10-30 16:36:45]
	[working dir: /home/crivella/.local/easybuild/build/zlib/1.3.1/GCCcore-14.3.0/zlib-1.3.1]
	[output and state saved to /tmp/eb-jjxd16gl/run-shell-cmd-output/make-7rahlsi6]
  >> command completed: exit 0, ran in < 1s
== ... (took < 1 sec)
== taking care of extensions...
== ... (took < 1 sec)
== restore after iterating...
== ... (took < 1 sec)
== postprocessing...
== ... (took < 1 sec)
== sanity checking...
  >> file 'include/zconf.h' found: OK
  >> file 'include/zlib.h' found: OK
  >> file 'lib/libz.a' found: OK
  >> file 'lib/libz.so' found: OK
  >> loading modules: zlib/1.3.1-GCCcore-14.3.0...
== ... (took < 1 sec)
== cleaning up...
== ... (took < 1 sec)
== creating module...
  >> generating module file @ /tmp/tmp.bcDeYVNMdv/modules/all/zlib/1.3.1-GCCcore-14.3.0.lua
== ... (took < 1 sec)
== permissions...
== ... (took < 1 sec)
== packaging...
== ... (took < 1 sec)
== COMPLETED: Installation ended successfully (took 28 secs)
== Results of the build can be found in the log file(s) /tmp/tmp.bcDeYVNMdv/software/zlib/1.3.1-GCCcore-14.3.0/easybuild/easybuild-zlib-1.3.1-20251030.163646.log
== Build succeeded for 1 out of 1
== Summary:
   * [SUCCESS] zlib/1.3.1-GCCcore-14.3.0
== Temporary log file(s) /home/crivella/.local/easybuild/logs/easybuild-fuaw57ut.log* have been removed.
== Temporary directory /tmp/eb-jjxd16gl has been removed.

@hattom
Copy link
Contributor

hattom commented Nov 6, 2025

Is there any benefit to having the option to jump into a python prompt? (Would that already be possible somehow with pdb?)

@Crivella
Copy link
Contributor Author

Crivella commented Nov 7, 2025

You mean something like adding a --breakpoint-type to say if you want to drop in in a bash shell or a python one?
Might be interesting, but i feel like dropping into a python shell only when hooks are triggered might not give the granularity that one might desire.
Probably using a debugger for that as you suggested might be better.

My main usecase for this is to test stuff in a build environment at the start/end of a step when you don't have a cmd.sh that you can use to drop into a shell

@hattom
Copy link
Contributor

hattom commented Nov 7, 2025

Essentially yes. My thinking being that if you drop into a bash shell, you still can't understand why EB is doing what it's doing, and some way to interrogate the internal structures/variables might be useful.
I'm aware you can probably do this with pdb, but I wouldn't know how to do it without a lot of trial/error.

Your usecase makes perfect sense, I was just wondering if getting at the internal state might be useful as well?

@Crivella Crivella force-pushed the feature-breakpoints branch from 73748af to 820a464 Compare December 11, 2025 16:07
@Crivella Crivella force-pushed the feature-breakpoints branch from 5739b7d to d80b9de Compare December 11, 2025 16:09
@Crivella
Copy link
Contributor Author

Crivella commented Dec 11, 2025

@hattom Added a way to gain a PDB shell at the hook which would in most cases allow to inspect and modify the state of an EasyBlock, by using --breakpoint=bash:STEP1,python:STEP2,... which will default to bash if no hook type is specified

820a464

Let's see what others think about this as well

(easybuild-dev) crivella@crivella-desktop:~$ eb --breakpoints=bash:start,python:pre_configure --rebuild zlib-1.2.11.eb --installpath=`eb_tmpdir`
== Temporary log file in case of crash /home/crivella/.local/easybuild/logs/easybuild-ds27mql7.log
easybuild-breakpoint> pwd
/home/crivella
easybuild-breakpoint> 
exit

WARNING: Index for /home/crivella/Documents/GIT/easybuild-easyconfigs/easybuild/easyconfigs is no longer valid (too old), so ignoring it...

== processing EasyBuild easyconfig /home/crivella/Documents/GIT/easybuild-easyconfigs/easybuild/easyconfigs/z/zlib/zlib-1.2.11.eb
== building and installing zlib/1.2.11...
  >> installation prefix: /tmp/eb_tmpdir-T3cAAiyq/software/zlib/1.2.11
== fetching files and verifying checksums...
  >> sources:
  >> /home/crivella/.local/easybuild/sources/z/zlib/zlib-1.2.11.tar.gz [SHA256: c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1]
== ... (took < 1 sec)
== creating build dir, resetting environment...
  >> build dir: /home/crivella/.local/easybuild/build/zlib/1.2.11/system-system
== ... (took < 1 sec)
== unpacking...
  >> running shell command:
	tar xzf /home/crivella/.local/easybuild/sources/z/zlib/zlib-1.2.11.tar.gz
	[started at: 2025-12-11 17:13:11]
	[working dir: /home/crivella/.local/easybuild/build/zlib/1.2.11/system-system]
	[output and state saved to /tmp/eb-wwk_6913/run-shell-cmd-output/tar-ah6up1mv]
  >> command completed: exit 0, ran in < 1s
== ... (took < 1 sec)
== patching...
== ... (took < 1 sec)
== preparing...
== ... (took < 1 sec)
== configuring...
Python breakpoint reached, entering pdb shell...
You can inspect/modify the state of the program from here and use `continue` to proceed.
Arguments passed to this hook (will contain EasyBlock object to inspect/modify if available):
  args = (<easybuild.easyblocks.generic.configuremake.ConfigureMake object at 0x704a947e9510>,)
  kwargs = {}
--Return--
> /home/crivella/Documents/GIT/easybuild-framework/easybuild/tools/hooks.py(242)_python_breakpoint()->None
-> pdb.set_trace()
(Pdb) eb = args[0]
(Pdb) print(eb.cfg['configopts'])

(Pdb) eb.cfg.update('configopts', '# Just a comment')
(Pdb) continue
  >> running shell command:
	./configure --prefix=/tmp/eb_tmpdir-T3cAAiyq/software/zlib/1.2.11  # Just a comment
	[started at: 2025-12-11 17:14:55]
	[working dir: /home/crivella/.local/easybuild/build/zlib/1.2.11/system-system/zlib-1.2.11]
	[output and state saved to /tmp/eb-wwk_6913/run-shell-cmd-output/configure-p7v94k6x]
  >> command completed: exit 0, ran in 00h00m01s
== ... (took 1 min 45 secs)
== building...
  >> running shell command:
	make  -j 4 CFLAGS="-O2 -fPIC"
	[started at: 2025-12-11 17:14:57]
	[working dir: /home/crivella/.local/easybuild/build/zlib/1.2.11/system-system/zlib-1.2.11]
	[output and state saved to /tmp/eb-wwk_6913/run-shell-cmd-output/make-2ck0zw68]
  >> command completed: exit 0, ran in 00h00m01s
== ... (took 1 secs)
== testing...
== ... (took < 1 sec)
== installing...
  >> running shell command:
	make install
	[started at: 2025-12-11 17:14:58]
	[working dir: /home/crivella/.local/easybuild/build/zlib/1.2.11/system-system/zlib-1.2.11]
	[output and state saved to /tmp/eb-wwk_6913/run-shell-cmd-output/make-9n70leb1]
  >> command completed: exit 0, ran in < 1s
== ... (took < 1 sec)
== taking care of extensions...
== ... (took < 1 sec)
== restore after iterating...
== ... (took < 1 sec)
== postprocessing...
== ... (took < 1 sec)
== sanity checking...
  >> file 'include/zconf.h' found: OK
  >> file 'include/zlib.h' found: OK
  >> file 'lib/libz.a' found: OK
  >> file 'lib/libz.so' found: OK
  >> loading modules: zlib/1.2.11...
== ... (took < 1 sec)
== cleaning up...
== ... (took < 1 sec)
== creating module...
  >> generating module file @ /tmp/eb_tmpdir-T3cAAiyq/modules/all/zlib/1.2.11.lua
== ... (took < 1 sec)
== permissions...
== ... (took < 1 sec)
== packaging...
== ... (took < 1 sec)
== COMPLETED: Installation ended successfully (took 1 min 48 secs)
== Results of the build can be found in the log file(s) /tmp/eb_tmpdir-T3cAAiyq/software/zlib/1.2.11/easybuild/easybuild-zlib-1.2.11-20251211.171459.log
== Build succeeded for 1 out of 1 (total: 1 min 48 secs)
== Summary:
   * [SUCCESS] zlib/1.2.11
== Temporary log file(s) /home/crivella/.local/easybuild/logs/easybuild-ds27mql7.log* have been removed.
== Temporary directory /tmp/eb-wwk_6913 has been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants