PyConAU 2012 Talk on PiCloud

by Amit


Update: The slides are up on SpeakerDeck now and can be accessed here. Next time I do demos in a talk, I should definitely give Ryan Kelly’s playitagainsam a shot. Unfortunately, the room where I was talking had no recording, so sorry this talk won’t be available for viewing. See Nick Coghlan’s notes on the talk here

Few hours  from now, I will be presenting my talk on PiCloud. The slides along with the demo code and demos are available here [1]. You can clone this repository and try out the demo code, after you have setup PiCloud. You can also try loading a couple of the demos in a IPython Notebook using the notebook files provided.

Overall the treatment is pretty basic, here are three videos which I will use as part of the talk.

The first video shows PiCloud setup:

The second video shows couple of simple use cases:

The final video shows the automatic deployment feature. PiCloud detects and automatically transfers your Python modules:

Decorating the cloud call

Yesterday while thinking about the talk, I thought if I could have a way to decorate functions which I want to execute in the cloud. That is, instead of calling cloud.call( ) in all my functions, why not have a decorator. Here is what I came up with:

# Demo code: decorator wrapping a call to PiCloud
# See: https://github.com/amitsaha/picloud-preso

def cloudcall(func):
    def sendtocloud(*args, **kwargs):
        import cloud
        jid = cloud.call(func,*args,**kwargs)
        cloud.join(jid)
        print 'Result:: ', cloud.result(jid)

    return sendtocloud

# simply decorate a method you want to be executed
# in PiCloud
@cloudcall
def anexpensivefunction(x,y):
    return x**3 + y**3

if __name__=='__main__':
    anexpensivefunction(3,3)

I think it is an useful thing. Have a thought? Let me know.

Links:

  1. Talk and resources: https://github.com/amitsaha/picloud-preso
  2. Slides
About these ads