Tirex::Job(3pm) | User Contributed Perl Documentation | Tirex::Job(3pm) |
Tirex::Job - A Tirex rendering job
my $job = Tirex::Job->new( metatile => $metatile, prio => 5, expire => time() + 60*60 );
Tirex jobs consist of a metatile, rendering priority and an expire time plus some optional additional info. They are created when rendering requests reach the master and put into the queue.
Create new job.
A job always needs the following parameters:
metatile -- the metatile prio -- priority (integer >= 1, 1 is highest priority
It can have any or all of the following parameters:
expire -- the time when this job will expire (seconds since epoch) request_time -- the time when this request came in (seconds since epoch, will be set to current time if not set)
Returns true if both jobs concern the same metatile, false otherwise.
The same tile means: same map, same x and y coordinates and same zoom level.
Returns 1 if this job is expired, 0 otherwise.
If the job doesn't have an expire time, it returns undef;
Creates a message string from the job. It contains the fields id, map, x, y, and z from the job plus all the fields given as argument to this method.
Creates a message from the job. It contains the fields id, map, x, y, z, prio from the job and, if available, the field priority.
All the fields given as argument to this method will also be added. You must give a type argument, otherwise this will croak.
Get unique id of this job.
Get priority of this job.
Set priority of this job.
Get metatile of this job.
Get position of this job in the priority queue. Returns undef if the job is in no queue.
Set position of this job in the priority queue. Set to undef if the job is in no queue.
Get bucket for this job.
Set bucket for this job.
Get success flag for this job.
Set success flag for this job.
Create a hash key (string) from the contents of this job. Only the attributes describing the tile are included. So that this hash key is unique for any tile.
Merge two jobs for the same metatile into one. This method will look into both jobs and create a new job from the data. The old jobs are not changed.
* priority of the new job will be the minimum of the priorities of the old jobs * expire will be the maximum of the expire times of the old jobs, if there is no expire time for at least one job, the result will have no expire time either * notify will be the concatenation of both notifies * request_time will be the minimum of both request times
This methods assumes that the metatiles are the same, it does no check.
Add a Tirex::Source to be notified when this job is done.
Returns true if any sources are waiting to be notified of this job's completion.
Notify all sources that this job is done. Returns an array reference with the result of the notify calls on the sources.
Clears the notify list.
The sources of this job as a string (for logging).
Returns age of this job in seconds (ie. the difference between current and request time).
2023-04-11 | perl v5.36.0 |