Successfully reported this slideshow.

More Related Content

Related Books

Free with a 14 day trial from Scribd

See all

Related Audiobooks

Free with a 14 day trial from Scribd

See all

Flowy @OSOM

  1. 1. Flowy.rtfd.org simple workflows
  2. 2. Flowy.rtfd.org simple workflows Banesiu Sever banesiu.sever@gmail.com @severb github.com/severb/
  3. 3. Flowy Overview With Flowy you can implement scalable and 1 2 7 3 5 4 8 6 9 fault-tolerant applications to perform asynchronous tasks that may be long running and remote using Amazon SWF as a backend.
  4. 4. Task Queue task producers task queue task task workers result
  5. 5. Task Queue task producers task queue task task task workers result
  6. 6. Task Queue task producers task queue task task task workers history
  7. 7. Task Queue Amazon SWF task queue task decision decision task task workers task producers orchestrators history decision decision
  8. 8. Task Queue Amazon SWF task workers task producers task queue task
  9. 9. Task Queue Amazon SWF task workers task producers history task queue task decision decision
  10. 10. Task Queue Amazon SWF task workers task producers decision orchestrators history task queue task decision decision
  11. 11. Task Queue Amazon SWF task queue task decision decision task task workers task producers orchestrators history decision
  12. 12. Task Queue Amazon SWF task queue task decision decision task task workers task producers orchestrators history decision decision
  13. 13. Task Queue Amazon SWF task queue task decision decision task task workers task producers orchestrators history decision decision
  14. 14. Task Queue Amazon SWF task queue task decision decision task task workers task producers orchestrators history decision decision
  15. 15. Representing Workflows as Graphs 1 2 7 4 3 5 8 6 9
  16. 16. Representing Workflows as Graphs decision history orchestrator task
  17. 17. Representing Workflows as Graphs 1 2 7 3 5 4 8 6 9
  18. 18. Representing Workflows as Graphs 1 2 7 3 5 4 8 6 9
  19. 19. Representing Workflows as Code 1 2 7 3 5 4 8 6 9 With Flowy, you implement the task orchestrators in Python
  20. 20. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply
  21. 21. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, no result found for this task
  22. 22. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, no result found for this task
  23. 23. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, return a “placeholder” no result found for this task
  24. 24. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, no result found for this task
  25. 25. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, no result found for this task
  26. 26. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, no result found for this task return a “placeholder”
  27. 27. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply ignore returned value
  28. 28. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, 25 found
  29. 29. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, return a “result” 25 found
  30. 30. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, no result found for this task
  31. 31. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, no result found for this task
  32. 32. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, no result found for this task return a “placeholder”
  33. 33. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply ignore returned value
  34. 34. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, return a “result” 25 found
  35. 35. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply check the history, 125 found return a “result”
  36. 36. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) def run(self): five_square = self.multiply(5, 5) five_cube = self.multiply(five_square, 5) return five_cube multiply multiply all tasks completed, final result is 125
  37. 37. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) sum = SWFActivityProxy(name=’sum’, ...) def run(self): five_square = self.multiply(5, 5) two_square = self.multiply(2, 2) return self.sum(five_square, two_square) sum multiply multiply
  38. 38. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) sum = SWFActivityProxy(name=’sum’, ...) def run(self, n): n_square = self.multiply(n, n) if n_square.result() > 100: return self.sum(n_square, 100) return self.sum(n_square, 500) multiply sum sum
  39. 39. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): multiply = SWFActivityProxy(name=’mul’, ...) sum = SWFActivityProxy(name=’sum’, ...) def run(self, n): n_square = self.multiply(n, n) if n_square.result() > 100: return self.sum(n_square, 100) return self.sum(n_square, 500) multiply sum sum
  40. 40. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): q_server1 = SWFActivityProxy(name=’s1’, ...) q_server2 = SWFActivityProxy(name=’s2’, ...) def run(self): s1_q = self.q_server1(...) s2_q = self.q_server2(...) return self.first(s1_q, s2_q) q_server1 q_server2
  41. 41. Flowy in Action @swf_workflow(...) class MyWorkflow(Workflow): square = SWFActivityProxy(name=’square’, ...) sum = SWFActivityProxy(name=’sum’, ...) def run(self, n): square ... squares = map(self.square, range(n)) return reduce(self.sum, self.all(squares)) square square sum sum ...
  42. 42. Thanks! github.com/severb/flo wy/ aws.amazon.com/swf/

×