/doc/glossary.rst

https://code.google.com/p/ruffus/ · ReStructuredText · 81 lines · 48 code · 33 blank · 0 comment · 0 complexity · 93b7851be858bfe109d5fccdcacbfe51 MD5 · raw file

  1. .. include:: global.inc
  2. ****************
  3. Glossary
  4. ****************
  5. .. _Glossary:
  6. .. _glossary.task:
  7. .. glossary::
  8. task
  9. A stage in a computational pipeline.
  10. Each **task** in *ruffus* is represented by a python function.
  11. For example, a task might be to find the products of a sets of two numbers::
  12. 4 x 5 = 20
  13. 5 x 6 = 30
  14. 2 x 7 = 14
  15. job
  16. Any number of operations which can be run in parallel and make up
  17. the work in a stage of a computional pipeline.
  18. Each **task** in *ruffus* is a separate call to the **task** function.
  19. For example, if a task is to find products of numbers, each of these will be a separate job.
  20. Job1::
  21. 4 x 5 = 20
  22. Job2::
  23. 5 x 6 = 30
  24. Job3::
  25. 2 x 7 = 14
  26. Jobs need not complete in order.
  27. decorator
  28. Ruffus decorators allow functions to be incorporated into a computational
  29. pipeline, with automatic generation of parameters, dependency checking etc.,
  30. without modifying any code within the function.
  31. Quoting from the `python wiki <http://wiki.python.org/moin/PythonDecorators>`_:
  32. A Python decorator is a specific change to the Python syntax that
  33. allows us to more conveniently alter functions and methods.
  34. Decorators dynamically alter the functionality of a function, method, or
  35. class without having to directly use subclasses or change the source code
  36. of the function being decorated.
  37. generator
  38. python generators are new to python 2.2
  39. (see `Charming Python: Iterators and simple generators <http://www.ibm.com/developerworks/library/l-pycon.html>`_).
  40. They allow iterable data to be generated on the fly.
  41. Ruffus asks for generators when you want to generate **job** parameters dynamically.
  42. Each set of job parameters is returned by the ``yield`` keyword for
  43. greater clarity. For example,::
  44. def generate_job_parameters():
  45. for file_index, file_name in iterate(all_file_names):
  46. # parameter for each job
  47. yield file_index, file_name
  48. Each job takes the parameters ``file_index`` and ``file_name``