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 a Disbatch object from task_runner using the `plugin` MongoDB user and role, $doc is the task document from MongoDB.

Returns a Disbatch::Plugin::Demo object.

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.

new($queue, $parameters)

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.

Returns a Disbatch::Plugin::Demo object.

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 reports collection.

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.

SEE ALSO

Disbatch

Disbatch::Web

Disbatch::Roles

disbatchd

disbatch.pl

task_runner

disbatch-create-users

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