I have an org mode file I use to run some moderately long analyses. Evaluating individual blocks may take 15 minutes to an hour or so. I usually wrap longer bits with calls to date, so I can later review how long those parts took. e.g:

#+BEGIN_SRC bash :results output
  echo Starting transfer ...
  ## rsync 30 GB directory
  echo Finished transfer!

  echo Starting analysis ...
  ## long-running analysis
  echo Analysis finished!

This works fine, but after it starts I can't see when each step started and stopped until the entire process is complete.

Is there a way to get org to print the results as they are generated, rather than all at once when the code block is done? i.e., as soon as my transfer is finished I see the "Finished transfer!" message with the output from date, while the script continues on to the next section.

What I'd like is a way to monitor the progress of these computations. I don't want to put each line in its own source code block, as I want the entire process to continue without my having to submit each command explicitly.

  • One problem is that org-babel-execute is synchronous. So it can't give the results before it has executed the full block. There is ob-async.el. Pityingly that does also not solve the problem since the block is sent to the asynchronous emacs as a whole and interprocess communication is not possible. There exists already a similar request for ob-async. – Tobias Feb 8 '19 at 16:37
  • Some time ago I've written up org-babel-execute:eshell-script which sends the code block contents to Eshell. An Eshell session works asynchronously with start-process. So it would be possible in principle to queue the Eshell commands and let eshell do its job asynchronously. The progress would be visible in the eshell session. Triggering the code block output after the eshell script has finished could probably be stolen from ob-async. There comes my question: Is it thinkable to switch from Bash to Eshell? – Tobias Feb 8 '19 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.