JohannesBuchner/BXA

BXASolver run cannot be interrupted in jupyter lab

ivvv opened this issue · 3 comments

ivvv commented
  • BXA version: 4.1.1
  • UltraNest version: 3.5.7
  • Python version: 3.11.3
  • Xspec or Sherpa and version: xspec 12.13.0c
  • Operating System: Mac OS Ventura 13.2.1 (also on Ubuntu 22)

Description

Running solver.run() cannot be interrupted in jupyter lab.

What I Did

Running this in a jupyter lab cell:

solver = bxa.BXASolver(transformations=transformations, outputfiles_basename=outputfiles_basename)
results = solver.run(resume=True)

Trying to interrupt the process/kernel does not work, the iterations go on and on. The only remedy is to restart the kernel which leads to losing the session.

I am not sure if this is BXA or ultranest issue, there should be a possibility to make the iterations interruptible somehow.

Thanks,
Ivan

It is probably an xspec issue actually, xspec may catch KeyboardInterrupt signals and python/jupyter/... does not know about it. You'd have to look at how xspec registers/overwrites signals.

I think if you keep hammering the process with Ctrl-Cs (cell selected, keep it pressed), eventually you hit it where it is within the python/ultranest code execution, not within the xspec C execution, and this can stop the iterating.

ivvv commented

I guess this issue can be closed. Before raising the issue I looked for 'interrupt' in all issues and couldn't find anything. So, maybe some information in the docs on this particular behaviour would be useful for others.

I have not checked if using BXA with sherpa is ok in this respect, i.e. the process can be stopped in a "normal" way.