ephemeral docker workloads with jupyter at pytn

E76c7ebc9d2e8a4b840f13cd01946437?s=47 Kyle Kelley
February 07, 2015

ephemeral docker workloads with jupyter at pytn

Talk at PyTennessee on tmpnb, nature, IPython, Jupyter, cloudpipe, and ephemeral workloads with Docker.

E76c7ebc9d2e8a4b840f13cd01946437?s=128

Kyle Kelley

February 07, 2015
Tweet

Transcript

  1. 2.

    Hi!

  2. 5.
  3. 6.
  4. 7.
  5. 8.
  6. 9.
  7. 10.
  8. 11.
  9. 12.
  10. 13.
  11. 14.
  12. 15.
  13. 16.
  14. 18.
  15. 20.

    from flask import Flask app = Flask(__name__) ! @app.route('/') def

    hello_pytn(): return 'Hello PyTennessee!' ! if __name__ == '__main__': app.run(‘0.0.0.0’)
  16. 22.

    $ docker build -t pytn . Sending build context to

    Docker daemon 92.67 kB Sending build context to Docker daemon Step 0 : FROM python:3-onbuild # Executing 3 build triggers Trigger 0, COPY requirements.txt /usr/src/app/ Step 0 : COPY requirements.txt /usr/src/app/ Trigger 1, RUN pip install -r requirements.txt Step 0 : RUN pip install -r requirements.txt ---> Running in dea1149d79ba … Successfully installed Flask Werkzeug Jinja2 itsdangerous markupsafe Cleaning up...
  17. 23.

    $ docker build -t pytn . … Trigger 2, COPY

    . /usr/src/app Step 0 : COPY . /usr/src/app ---> 6067170ab7fe Removing intermediate container 7ba25a7d8c3b Removing intermediate container dea1149d79ba Removing intermediate container 98f8579edc94 Step 1 : CMD python ./app.py ---> Running in 53031fa4ba6d ---> a7324c447943 Removing intermediate container 53031fa4ba6d Successfully built a7324c447943
  18. 26.
  19. 29.
  20. 30.
  21. 31.
  22. 32.
  23. 35.
  24. 37.

    CONFIGURABLE HTTP PROXY • Based on node-http-proxy • Proxy routes

    to localhost, external IPs, etc. • /user/123/  →  127.0.0.1:56790   • Provides an administrative API for adding routes • POST  /api/routes/[:path]
  25. 39.
  26. 40.
  27. 41.
  28. 45.
  29. 46.
  30. 49.
  31. 50.
  32. 51.
  33. 52.
  34. 53.
  35. 56.
  36. 57.

    >>>  import  cloud   >>>  def  add(x,  y):   ...

         return  x+y   >>>  add(1,  2)   3   >>>  jid  =  cloud.call(add,   ...                                    1,  2)
  37. 59.

    >>>  import  cloud   >>>  def  scrape(x,y):   ...  

       #  Expensive  operation   >>>  xs  =  []  #  list  of  x’s   >>>  ys  =  []  #  list  of  y’s   >>>  jids  =  cloud.map(scrape,   ...                                    xs,  ys)
  38. 61.

    PICLOUD • Chuck a python pickle to the cloud (f,

    args, kwargs) = pickle.load(sys.stdin) res = f(*args, **kwargs) ! cloudpickle.dump(res, open("/tmp/.result", "wb"))
  39. 63.
  40. 64.

    :(

  41. 65.
  42. 66.

    ?

  43. 68.
  44. 69.

    import  multyvac   ! #  Connect  to  the  cluster  

    multyvac.config.set_key(      api_key=rackspace_user,      api_secret_key=rackspace_api_key,      api_url=‘https://api.cloudpi.pe/v1’)   ! ! ! !
  45. 71.

    CLOUDPIPE • Open Source • Want Need Python 3 binding,

    new cloud pickler • Node library in the works
  46. 75.

    FRONTIER • Put kernels close to data stores, spin out

    compute • IPython parallel on demand • Compute jobs on demand • Trigger jobs by events
  47. 76.