PkgForge::Handler::Incoming - Package Forge handler for the incoming directory
This documentation refers to PkgForge::Handler::Incoming version 1.1.10
use PkgForge::Handler::Incoming; my $handler = PkgForge::Handler::Incoming->new(); # or my $handler = PkgForge::Handler::Incoming->new_with_options(); # or my $handler = PkgForge::Handler::Incoming->new_with_config(); $handler->execute();
This Package Forge handler handles the incoming jobs queue. The incoming queue is represented with a PkgForge::Queue and is processed in order of submission time. Any entry which does not look like a job will be erased immediately. Anything else will be loaded as a PkgForge::Job object and validated. If the job is valid the handler will move the job to the accepted queue and register the job for the relevant build daemons.
See PkgForge::Handler for all the attributes inherited by application of that role. This class also adds the following attributes:
The time (in seconds) to wait for a job to be considered fully submitted, the default is 5 minutes. Submitted jobs are considered for acceptance on every pass of the incoming queue made by this handler. If the job appears to be incomplete for any reason this is the length of time the handler will wait for further data to appear. After this time has passed any incomplete job may be erased.
See PkgForge::Handler for all methods inherited from that class. This class implements the required execute method.
execute
Runs through a set of pre-flight checks which must be correct before running the execute method. This is separated out so that it can be called after the handler object is created but before the execution is begun. This is particularly useful for when running as a daemon.
This method scans the incoming build job directory and loads anything found into a PkgForge::Queue object. If it is not possible to scan the directory then this method will die since such a failure renders this handler useless. It will remove anything which does not appear to be a valid build job entry. The queue object will be returned.
This method takes a PkgForge::Queue::Entry object and attempts to convert it into a full PkgForge::Job object. If successfully loaded the job will be registered in the Package Forge registry with a status of incoming. If the loading fails then a period of grace is given in case the files associated with the job are still in transit. If the failure continues to occur after the end of the grace period then the submitted job will be deleted. On success the PkgForge::Job object will be returned, on failure (either temporary or permanent) the undef value be returned.
incoming
This method takes a PkgForge::Job object and carries out validation. Mostly this validation it to ensure that the submitted job has not been corrupted during the submission process. If successful the job will be marked in the Package Forge registry as valid. If the job is found to be invalid then, in a similar way to the load_job method, a grace period is permitted. If the validation failure continues to occur after the end of the grace period then the submitted job will be deleted and marked in the registry as invalid. On success a true value will be returned, otherwise it will return a false value.
valid
load_job
invalid
Please note that this method does not do any authorization checks.
This method takes a PkgForge::Job object and attempts to transfer the job to the accepted directory. If successful then the job will be marked as accepted in the Package Forge registry and a new PkgForge::Object will be returned which represents the accepted job. If the transfer fails then the submitted job will be deleted and it will be marked in the registry as failed, the method will then return undef.
accepted
failed
A convenience wrapper for the method of the same name provided by PkgForge::Registry. Will log errors, returns false on failure and true on success.
This method will take either a PkgForge::Queue::Entry or a PkgForge::Job object. It erases the entire directory holding all files associated with the job, it also kills the object as it no longer has any physical meaning. In each case, the scrub method is called, see the specific documentation for further details.
scrub
By default Package Forge handlers can be configured via the /etc/pkgforge/handlers.yml YAML file. This class will also examine the file /etc/pkgforge/incoming.yml, if it exists, and settings in that file will have precedence. You can override the path to the configuration file via the configfile attribute.
/etc/pkgforge/handlers.yml
/etc/pkgforge/incoming.yml
configfile
By default, the logging system can be configured via /etc/pkgforge/incoming.log. If the file does not exist then the handler will log to stderr.
/etc/pkgforge/incoming.log
This module is powered by Moose and also uses MooseX::Types, Readonly.
PkgForge, PkgForge::Handler, PkgForge::Job, PkgForge::Queue, PkgForge::Queue::Entry
This is the list of platforms on which we have tested this software. We expect this software to work on any Unix-like platform which is supported by Perl.
ScientificLinux5, Fedora13
Please report any bugs or problems (or praise!) to bugs@lcfg.org, feedback and patches are also always very welcome.
Stephen Quinney <squinney@inf.ed.ac.uk>
Copyright (C) 201O University of Edinburgh. All rights reserved.
This library is free software; you can redistribute it and/or modify it under the terms of the GPL, version 2 or later.
To install PkgForge::Queue, copy and paste the appropriate command in to your terminal.
cpanm
cpanm PkgForge::Queue
CPAN shell
perl -MCPAN -e shell install PkgForge::Queue
For more information on module installation, please visit the detailed CPAN module installation guide.