The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Helios::JobType - class to represent Helios jobtypes

SYNOPSIS

 # use the lookup() class method to retrieve jobtypes 
 # from the Helios collective database
 my $jobtype = Helios::JobType->lookup(name => 'Helios::TestService');
        --OR--
 my $jobtype = Helios::JobType->lookup(jobtypeid => 1);

 print "Name: ", $jobtype->getName, " Jobtypeid: ", $jobtype->getJobtypeid,"\n";
 
 # use new() and create() to create new jobtypes
 my $newtype = Helios::JobType->new( name => 'NewJobType' );
 $newtype->create();
 print "Created jobtype ",$newtype->getJobtypeid,"\n";

DESCRIPTION

Objects of the Helios::JobType class represent jobtypes in the Helios job processing system. Every job has a jobtype, which is roughly analogous to the queue a job is in. Usually, a jobtype's name is the same as the Helios service that will be running the job, in effect creating a single queue for each Helios service. In certain advanced configurations, Helios services can be configured to service jobs of several jobtypes.

ACCESSOR METHODS

 set/getName      name of the jobtype in the Helios database
 set/getJobtypeid jobtypeid in the Helios database
 
 set/getConfig    config hash to use
 set/getDriver    Data::ObjectDriver to Helios database

OBJECT INITIALIZATION

new([name => $jobtypename][, config => $config_hashref][, driver => $driver_obj][, obj => $elemental_obj])

Creates a new Helios::JobType object. If parameters are passed, calls init() with those parameters to initialize the object's values.

init()

If any parameters are passed to new(), init() will be called to further initialize the object.

_inflate()

If an elemental object is passed to new() or init() using the 'obj' parameter, _inflate() will be called to expand the elemental object into the full Helios object.

Helios::JobType objects can be inflated from TheSchwartz::FuncMap objects.

CLASS METHODS

lookup([name => $name]|[jobtypeid => $jobtypeid])

Given either a jobtype name or jobtypeid, the lookup method will attempt to find a jobtype matching that criteria in the collective database and returns a Helios::JobType object representing that jobtype to the calling routine. If a matching jobtype is not found, undef is returned.

THROWS: Helios::Error::JobTypeError if a problem occurs querying the Helios database.

OBJECT METHODS

create([name => $name])

Given a jobtype name, create() creates a jobtype with that name in the Helios collective database and returns the new jobtype's jobtypeid.

If the jobtype's name is not specified, the value returned by getName() will be used.

THROWS: Helios::Error::JobTypeError if the JobType creation fails.

remove()

The remove() method deletes a jobtype from the Helios collective database. It returns 1 if successful and throws a Helios::Error::JobTypeError if the removal operation fails.

USE WITH CAUTION. All Helios jobs, both enqueued and completed, have an associated jobtype, and removing a jobtype that still has associated jobs in the system will have unintended consequences!

THROWS: Helios::Error::JobTypeError if the removal operation fails.

SEE ALSO

Helios, Helios::Service, Helios::Job

AUTHOR

Andrew Johnson, <lajandy at cpan dot org>

COPYRIGHT AND LICENSE

Copyright (C) 2013-4 by Logical Helion, LLC.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.

WARRANTY

This software comes with no warranty of any kind.