diff options
author | Kali Kaneko (leap communications) <kali@leap.se> | 2016-03-31 21:54:49 -0400 |
---|---|---|
committer | Kali Kaneko (leap communications) <kali@leap.se> | 2016-03-31 22:30:44 -0400 |
commit | ce4cb42cb521260e2f7091dd80b136320f32663f (patch) | |
tree | 8977899c8761ce6492fe631522d28e4398b61d17 /tasks.py | |
parent | 39794129de708ec8e6a2e18ee6f0ac094844407c (diff) |
pass FIB parameter as environment variable
Diffstat (limited to 'tasks.py')
-rw-r--r-- | tasks.py | 17 |
1 files changed, 13 insertions, 4 deletions
@@ -1,20 +1,29 @@ +import os from twisted.protocols import amp from ampoule import child +FIB_DEFAULT = 30 + def fib(n): + '''very silly fibonacci function. + do not try to optimize this, the idea is to make your cpu suffer for a + while''' + n = int(n) if n <= 2: return 1 else: return fib(n-1) + fib(n-2) +# ampoule stuff class Fib(amp.Command): - response = [("fib", amp.Integer())] + arguments = [('n', amp.Integer())] + response = [('fib', amp.Integer())] class FibCalculator(child.AMPChild): @Fib.responder - def fib(self): - print 'called responder, fib...' - return {"fib": fib(30)} + def fib(self, n): + #print "FIB FUNCTION CALLED WITH", n + return {"fib": fib(n)} |