Skip to content

Instantly share code, notes, and snippets.

@wallyqs
Last active August 29, 2015 13:59
Show Gist options
  • Select an option

  • Save wallyqs/10989253 to your computer and use it in GitHub Desktop.

Select an option

Save wallyqs/10989253 to your computer and use it in GitHub Desktop.
#+TITLE: Running Org babel processes in parallel
* Print with different languages
#+name: hello_from_bash
#+begin_src sh :shebang #!/bin/bash
while true; do echo "hello world from bash"; sleep 1; done
#+end_src
#+name: hello_from_ruby
#+begin_src ruby :shebang #!/usr/local/bin/ruby
$stdout.sync = true
loop { puts "hello world from ruby" ; sleep 1 }
#+end_src
#+name: hello_from_python
#+begin_src python :shebang #!/usr/bin/python
import time
import sys
for i in range(0,100):
print "hello world from python"
sys.stdout.flush()
time.sleep(1)
#+end_src
* COMMENT How to run this example
#+begin_src sh
gem install org-converge
org-converge hello.org
#+end_src
#+RESULTS:
#+begin_src
I, [2014-04-17T23:48:44.663545 #1710] INFO -- : Tangling 0 files...
I, [2014-04-17T23:48:44.663698 #1710] INFO -- : Tangling succeeded!
I, [2014-04-17T23:48:44.664024 #1710] INFO -- : Tangling 4 scripts within directory: /Users/mariko/repos/literate-infrastructure/run...
I, [2014-04-17T23:48:44.664829 #1710] INFO -- : Running code blocks now! (4 runnable blocks found in total)
I, [2014-04-17T23:48:44.762899 #1710] INFO -- : hello_from_bash (1711) -- started with pid 1711
I, [2014-04-17T23:48:44.808717 #1710] INFO -- : hello_from_ruby (1712) -- started with pid 1712
I, [2014-04-17T23:48:44.837878 #1710] INFO -- : hello_from_python (1713) -- started with pid 1713
I, [2014-04-17T23:48:44.878336 #1710] INFO -- : (1714) -- started with pid 1714
I, [2014-04-17T23:48:44.879284 #1710] INFO -- : hello_from_bash (1711) -- hello world from bash
I, [2014-04-17T23:48:44.882778 #1710] INFO -- : hello_from_ruby (1712) -- hello world from ruby
I, [2014-04-17T23:48:44.883637 #1710] INFO -- : hello_from_python (1713) -- hello world from python
I, [2014-04-17T23:48:45.778681 #1710] INFO -- : hello_from_bash (1711) -- hello world from bash
I, [2014-04-17T23:48:45.792321 #1710] INFO -- : hello_from_ruby (1712) -- hello world from ruby
I, [2014-04-17T23:48:45.882020 #1710] INFO -- : hello_from_python (1713) -- hello world from python
I, [2014-04-17T23:48:46.787106 #1710] INFO -- : hello_from_bash (1711) -- hello world from bash
I, [2014-04-17T23:48:46.793347 #1710] INFO -- : hello_from_ruby (1712) -- hello world from ruby
I, [2014-04-17T23:48:46.883511 #1710] INFO -- : hello_from_python (1713) -- hello world from python
I, [2014-04-17T23:48:47.794846 #1710] INFO -- : hello_from_ruby (1712) -- hello world from ruby
I, [2014-04-17T23:48:47.796387 #1710] INFO -- : hello_from_bash (1711) -- hello world from bash
I, [2014-04-17T23:48:47.884196 #1710] INFO -- : hello_from_python (1713) -- hello world from python
^CI, [2014-04-17T23:48:48.155614 #1710] INFO -- : hello_from_python (1713) -- Traceback (most recent call last):
SIGINT received
I, [2014-04-17T23:48:48.178971 #1710] INFO -- : system () -- sending SIGTERM to all processes
I, [2014-04-17T23:48:48.179850 #1710] INFO -- : hello_from_ruby (1712) -- terminated by SIGINT
I, [2014-04-17T23:48:48.180341 #1710] INFO -- : hello_from_python (1713) -- exited with code 1
I, [2014-04-17T23:48:48.180780 #1710] INFO -- : hello_from_bash (1711) -- terminated by SIGINT
I, [2014-04-17T23:48:48.903180 #1710] INFO -- : (1714) -- exited with code 1
I, [2014-04-17T23:48:48.903292 #1710] INFO -- : Run has completed successfully.
#+end_src
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment