Disbatch::Plugin::Demo - demo plugin for Disbatch
version 4.103
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.
params
commands
a
b
c
counter
Command a will write to stdout and succeed with status 1.
stdout
Command b will write to stderr and succeed with status 1.
stderr
Command c will write to stderr and fail with status 2.
Parameters: <$workerthread> is a Disbatch object from task_runner using the `plugin` MongoDB user and role, $doc is the task document from MongoDB.
<$workerthread
Disbatch
task_runner
$doc
Returns a Disbatch::Plugin::Demo object.
Disbatch::Plugin::Demo
In this demo, the parameters passed become $self, and all of the task's params are put into $self, unless they are named workerthread or task. 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.
$self
workerthread
task
<$self-
DEPRECATED FORMAT for usage with Disbatch 3.
Parameters: { id => $oid } where $id is a MongoDB::OID object of the task's queue value, HASH parameters value of the task.
{ id => $oid }
$id
MongoDB::OID
HASH
In this demo, the task's parameters become $self, and <$self-{queue_id}>> is set to <$queue-{id}>>.
<$queue-
Parameters: none
Runs the task.
Returns the result of finish().
finish()
Finalizes the report for this task and inserts into the reports collection.
reports
Returns a HASH result to update the task with.
The result SHOULD have the keys status (1 for success, 2 for failure), stdout, and stderr. Other keys will be ignored.
status
Disbatch::Web
Disbatch::Roles
disbatchd
disbatch.pl
disbatch-create-users
Ashley Willis <awillis@synacor.com>
This software is Copyright (c) 2016 by Ashley Willis.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004
To install Disbatch, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Disbatch
CPAN shell
perl -MCPAN -e shell install Disbatch
For more information on module installation, please visit the detailed CPAN module installation guide.