Author Topic: Agenda needed?  (Read 4592 times)

rhammond

  • Jr. Member
  • **
  • Posts: 6
Agenda needed?
« on: November 03, 2005, 07:50:27 PM »
How about types that just run a command? Do they need an agenda?  I have a type that does some setup and then just runs the same command. Didn't want to use the cmdline type.  Do I still have to pass an agenda and get it with qb::requestwork?  If not, how do I let the supervisor know the status of the work/job?

Randy

anthony

  • Senior Software Engineer
  • Hero Member
  • *****
  • Posts: 183
Re: Agenda needed?
« Reply #1 on: November 03, 2005, 09:40:54 PM »
Hey Randy,

    Actually, the qb::requestwork is completely optional.  For job types such as the command line job type ("cmdline") they just execute the command and exit.
 
    Example:

               #execute my command
               system($job->{"package"}->{"command"});

               #return failed status if something goes wrong
               if ($totallyWrong) {
                        qb::reportjob("failed");
                        exit(1);
               }

               #if everything is ok, fall through.
               1;

If you have several commands or require the system to keep track of a list of parameters, then we recommend you use the agenda.

There are principally 3 functions involved with reporting information to and from the supervisor from the job:

qb::requestwork - gets the next avaliable agenda item.
    <$work object> = qb::requestwork();

qb::reportwork - reports the status of the agenda item.
    qb::reportwork(<$work object>);

qb::reportjob - reports the status of the subjob itself.
    qb::reportjob(<$job status>);

     The job status can be any one of the following states:

            pending
            blocked
            complete
            failed
            killed

The use of requestwork/reportwork is only necessary if you plan on having the system keep track of a list of things to do.  If not, it's not important to call them.

A.