NAME

Dancer2::Plugin::JobScheduler - Plugin for Dancer2 web app to send and query jobs in different job schedulers

VERSION

version 0.001

SYNOPSIS

use Dancer2;
BEGIN {
    my %plugin_config = (
        default => 'theschwartz',
        schedulers => {
            theschwartz => {
                client => 'TheSchwartz',
                parameters => {
                    handle_uniqkey => 'acknowledge',
                    databases => {
                        theschwartz_db1 => {
                            prefix => q{},
                            dbh_callback => 'Database::ManagedHandle->instance',
                        },
                    }
                }
            }
        }
    );
    set log => 'debug';
    set plugins => {
        JobScheduler => \%plugin_config,
    };
}
use Dancer2::Plugin::JobScheduler;

set serializer => 'JSON';

get q{/submit_job} => sub {
    my %r = submit_job(
        client => 'theschwartz',
        job => {
            task => 'task1',
            args => { name => 'My Name', age => 123 },
            opts => {},
        },
    );
    return to_json(\%r);
};

get q{/list_jobs} => sub {
    my %r = list_jobs(
        client => 'theschwartz',
        search_params => {
            task => 'task1',
        },
    );
    return to_json(\%r);
};

DESCRIPTION

This package is an interface to access different job schedulers in Dancer2 web app. Supported job schedulers:

TheSchwartz

Dancer2::Plugin::JobScheduler provides an interface to submit jobs and query jobs currently in queue. As a Dancer2 plugin, it creates two new commands in the web app: submit and list_jobs.

Lots of subs not covered by Pod::Coverage because they are inherited from Dancer2::Plugin.

AUTHOR

Mikko Koivunalho <mikkoi@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2023 by Mikko Koivunalho.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.