NAME
Disbatch::Plugin::Demo - demo plugin for Disbatch
VERSION
version 4.103
DESCRIPTION
A sample Disbatch plugin.
Tasks for this plugin should have in params the name commands with a value of a, b, c, or any combination, and optionally the name counter. Any other characters in the commands value are ignored, as well as any other names in params.
Command a will write to stdout and succeed with status 1.
Command b will write to stderr and succeed with status 1.
Command c will write to stderr and fail with status 2.
SUBROUTINES
- new(workerthread => $workerthread, task => $doc);
-
Parameters:
<$workerthread> is aDisbatchobject fromtask_runnerusing the `plugin` MongoDB user and role,$docis the task document from MongoDB.Returns a
Disbatch::Plugin::Demoobject.In this demo, the parameters passed become
$self, and all of the task's params are put into$self, unless they are namedworkerthreadortask. In addition,<$self-{queue_id}>> is set to the task's queue id, and<$self-{id}>> is set to the task's id. This allows minimal modification to Disbatch 3 plugins. - new($queue, $parameters)
-
DEPRECATED FORMAT for usage with Disbatch 3.
Parameters:
{ id => $oid }where$idis aMongoDB::OIDobject of the task's queue value,HASHparameters value of the task.Returns a
Disbatch::Plugin::Demoobject.In this demo, the task's parameters become
$self, and<$self-{queue_id}>> is set to<$queue-{id}>>. - run
-
Parameters: none
Runs the task.
Returns the result of
finish(). - finish
-
Parameters: none
Finalizes the report for this task and inserts into the
reportscollection.Returns a
HASHresult to update the task with.The result SHOULD have the keys
status(1 for success, 2 for failure),stdout, andstderr. Other keys will be ignored.
SEE ALSO
AUTHORS
Ashley Willis <awillis@synacor.com>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2016 by Ashley Willis.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004