Tirex::Manager(3pm)

NAME
Tirex::Manager - Rendering manager

SYNOPSIS
 use Tirex::Manager;
 my $queue = Tirex::Queue->new();
 my $rm = Tirex::Manager->new( queue => $queue );

DESCRIPTION
The rendering manager takes jobs from the queue and runs them. It takes into account how many parallel renderings are allowed, the priority of the jobs etc.

METHODS

  Tirex::Manager->new( queue => $queue )
Create a new rendering manager. Parameters are:

 queue   the queue with the rendering requests (see Tirex::Queue)

  $rm->add_bucket(name => $name, minprio => $minprio, maxproc => $maxproc, maxload => $maxload)
Creates and adds a bucket with the given config. It always keeps buckets sorted according to minprio.

Returns the created bucket or undef on error.

  $rm->set_active_flag_on_bucket($active, $bucketname)
Returns true if successful, ie. the bucket did exists, false if unsuccessful.

  $rm->get_socket()
Return socket where the rendering manager expects responses from the rendering backends. This should be added to select calls in main loop.

  $rm->schedule()
Runs as many jobs as there are in the queue (as long as the resources don't run out).

This will also check for timeouts on the jobs that are currently rendering.

  $rm->run()
Check whether there is a job that can be rendered and that there are enough resources and then render the job.

Returns

 undef if there is no job to run
 0     if there aren't enough resources
 1     if a job was started
 2     if a job was expired

  $rm->send($job)
Send a job to the rendering daemon.

  $rm->done($msg)
This is called when a message comes back from the backend that a job was rendered.

Returns the job or undef if the job was not found.

  $rm->log_stats()
Write statistics to log file.

  $rm->status()
Return status of the rendering manager.

  $rm->get_load_from_uptime()
Get system load by calling the 'uptime' command. This is called by get_load() if /proc/loadavg is not available.

  $rm->get_load()
Get current load on the machine. If /proc/loadavg is not readable for some reason, it always returns 0.

SEE ALSO
Tirex::Manager::Test