File: job_wrapper.py

package info (click to toggle)
ipython 0.13.1-2%2Bdeb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 15,752 kB
  • sloc: python: 69,537; makefile: 355; lisp: 272; sh: 80; objc: 37
file content (25 lines) | stat: -rwxr-xr-x 542 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#!/usr/bin/env python
"""Python wrapper around a submitted workflow job.

In reality this would be a more sophisticated script, here we only illustrate
the basic idea by considering that a submitted 'job' is a Python string to be
executed.
"""

import sys

argv = sys.argv

from IPython.parallel.engine import EngineFactory
from IPython.parallel.ipengineapp import launch_new_instance

ns = {}

# job
exec sys.argv[1] in ns

# this should really use Config:
EngineFactory.user_ns = ns

# start engine with job namespace
launch_new_instance()