Question

I have a long operation that I can no longer run from the UI as it exceeds the maximum execution time as well as memory limit. I am fairly aware of how I can set tasks in a table, and have a cron execute a sfTask that finishes pending tasks.

Can someone let me know the following:

  1. Which is the best PHP/Symfony plugins are to manage jobs/tasks? I'm not using Zend and see that sfTaskLoggerPlugin, sfGearmanPlugin and sfJobQueuePlugin have not been recently updated.
  2. How can I create a context and make app-config, settings, etc available to the task?
  3. How can I add a parameter to the context that methods can read to identify if they have been called by the cron/task or HTTP request?

All inputs are appreciated.

PS: Have referred Long script in admin, task in Symfony? and few others :)

Was it helpful?

Solution

I think most of what you need is covered by the standard documentation.

http://www.symfony-project.org/cookbook/1_2/en/tasks

I use Symfony tasks frequently through scripts that hand-off through a cron job. I use environment switching via the command line, just like the docs discuss. I use parameter passing too.

Symfony tasks are very powerful, and give you everything that you need from the CLI in order to reach into your application and execute what you need.

If after reading the docs, you have a more specific question, post it, and we'll do our best to answer you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top