5

I'm trying to understand Gearman but until now I can't figure out what's the difference between task and job.

I'm trying to create a client which will parse periodically (every 10 minutes) a XML page. Which is the best approach?

halfer
  • 19,824
  • 17
  • 99
  • 186
SilVeR AleCS
  • 93
  • 1
  • 5
  • 1
    A job returns a handle and it will be done some time in the future asynchronously, whereas a task is blocking, and when the call returns it will have done the unit of work for you. If you are parsing XML on a schedule, I'd just call the parser directly from cron; a job server is more useful when you have a set of jobs that are being created on a non-predictable basis (say user request) and they need to be done in an ordered, resource-limited way. – halfer May 04 '13 at 11:01
  • @halfer - I don't think task has to be necessarily blocking. Some tasks in a job can be run independently for examples in separate threads and they can be made to join each other using join() method for the completion of the job. – nanosoft Feb 15 '15 at 09:47

1 Answers1

2

The manual offers a terrific explanation:

Jobs vs. Tasks

A task is any request or communication between the client and the job server. A task is usually communication about a job. Tasks might be please run this job or what is the status of this job. A job is something the worker does, continuously waiting on the job server to tell him when to start and with what arguments. Clients submit jobs and ask for status about jobs (both of those things are considered tasks). Workers actually perform the jobs.

deceze
  • 510,633
  • 85
  • 743
  • 889