configuration.rst 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. Configuration
  2. =============
  3. We must configure our Worker. Common definitions must be defined in
  4. config.yml file, setting values for all installed Workers. Also we must
  5. config gearman cache, using doctrine cache.
  6. .. note:: If ``iterations`` value is 0, worker will not kill itself never, so
  7. thread will be alive as long as needed. The reason to allow workers
  8. to kill themselves is just to prevent each process to accumulate a
  9. large quantity of memory.
  10. .. code-block:: yml
  11. doctrine_cache:
  12. providers:
  13. gearman_cache:
  14. type: file_system
  15. namespace: doctrine_cache.ns.gearman
  16. gearman:
  17. # Bundles will parsed searching workers
  18. bundles:
  19. # Name of bundle
  20. AcmeBundle:
  21. # Bundle name
  22. name: MmoreramerinoTestBundle
  23. # Bundle search can be enabled or disabled
  24. active: true
  25. # If any include is defined, Only these namespaces will be parsed
  26. # Otherwise, full Bundle will be parsed
  27. include:
  28. - Services
  29. - EventListener
  30. # Namespaces this Bundle will ignore when parsing
  31. ignore:
  32. - DependencyInjection
  33. - Resources
  34. # default values
  35. # All these values will be used if are not overwritten in Workers or jobs
  36. defaults:
  37. # Default method related with all jobs
  38. # do // deprecated as of pecl/gearman 1.0.0. Use doNormal
  39. # doNormal
  40. # doBackground
  41. # doHigh
  42. # doHighBackground
  43. # doLow
  44. # doLowBackground
  45. method: doNormal
  46. # Default number of executions before job dies.
  47. # If annotations defined, will be overwritten
  48. # If empty, 0 is defined by default
  49. iterations: 150
  50. # Default amount of time in seconds required for the execution to run.
  51. # This is useful if using a tool such as supervisor which may expect a command to run for a
  52. # minimum period of time to be considered successful and avoid fatal termination.
  53. # If empty, no minimum time is required
  54. minimum_execution_time: null
  55. # Default maximum amount of time in seconds for a worker to remain idle before terminating.
  56. # If empty, the worker will never timeout
  57. timeout: null
  58. # execute callbacks after operations using Kernel events
  59. callbacks: true
  60. # Prefix in all jobs
  61. # If empty name will not be modified
  62. # Useful for rename jobs in different environments
  63. job_prefix: null
  64. # Autogenerate unique key in jobs/tasks if not set
  65. # This key is unique given a Job name and a payload serialized
  66. generate_unique_key: true
  67. # Prepend namespace when callableName is built
  68. # By default this variable is set as true
  69. workers_name_prepend_namespace: true
  70. # Server list where workers and clients will connect to
  71. # Each server must contain host and port
  72. # If annotations defined, will be full overwritten
  73. #
  74. # If servers empty, simple localhost server is defined by default
  75. # If port empty, 4730 is defined by default
  76. servers:
  77. localhost:
  78. host: 127.0.0.1
  79. port: 4730
  80. In development mode you do not want to cache things over more than one
  81. request. An easy solution for this is to use the array provider in the dev
  82. environment ( Extracted from `DoctrineCacheBundle`_ documentation )
  83. .. code-block:: yml
  84. #config.yml
  85. doctrine_cache:
  86. providers:
  87. gearman_cache:
  88. type: file_system
  89. namespace: doctrine_cache.ns.gearman
  90. In development mode you do not want to cache things over more than one
  91. request. An easy solution for this is to use the array cache in the dev
  92. environment ( Extracted from `DoctrineCacheBundle`_ documentation )
  93. .. code-block:: yml
  94. #config_dev.yml
  95. doctrine_cache:
  96. providers:
  97. gearman_cache:
  98. type: array
  99. namespace: doctrine_cache.ns.gearman
  100. .. _DoctrineCacheBundle: https://github.com/doctrine/DoctrineCacheBundle#cache-providers