NAME
Disbatch::Web::Tasks - Disbatch::Web routes for deprecated task search and creation.
VERSION
version 4.103
DEPRECATION NOTICE
This is deprecated as of Disbatch 4.2 and may be removed in Disbatch 4.4.
NOTE
These routes were formerly in Disbatch::Web, but moved here. They are not loaded by default.
SUBROUTINES
- init($disbatch, $args)
-
Parameters: a
Disbatch::Web
object ($args
is ignored).Sets package global
$disbatch
.Returns nothing.
- deserialize_oid($object)
-
Parameters: decoded JSON filter for the search (or a sub-value from it)
If the object has the field
$oid
, it is turned into aMongoDB::OID
object.Returns the modified object.
- search()
-
Parameters: none (but parses request parameters, see
POST /tasks/search
below)Performs task search.
Returns result as JSON, setting HTTP status to
400
on error.
JSON ROUTES
- POST /tasks/search
-
Parameters:
{ "filter": filter, "options": options, "count": count, "terse": terse }
All parameters are optional.
filter
is a filter expression (query) object.options
is an object of desired options to MongoDB::Collection#find.If not set,
options.limit
will be100
. This will fail if you try to set it above100
.count
is a boolean. Instead of an array of task documents, the count of task documents matching the query will be returned.terse
is a boolean. Iftrue
, the the GridFS id or"[terse mode]"
will be returned forstdout
andstderr
of each document. Iffalse
, the full content ofstdout
andstderr
will be returned. Default istrue
.Returns: Array of task Objects or
{ "count": $count }
on success;{ "error": "filter and options must be name/value objects" }
,{ "error": "limit cannot exceed 100" }
, or{ "error": "Bad OID passed: $error" }
on input error; or{ "error": "$error" }
on count or search error.Sets HTTP status to
400
on error.Note: replaces /search-tasks-json
- POST /tasks/:queue
-
URL:
:queue
is the_id
if it matches/\A[0-9a-f]{24}\z/
, orname
if it does not.Parameters: an array of task params objects
Returns:
{ ref $res: Object }
on success;{ "error": "params must be a JSON array of task params" }
or{ "error": "queue not found" }
on input error; or{ ref $res: Object, "error": "Unknown error" }
on MongoDB error.Sets HTTP status to
400
on error.Note: replaces /queue-create-tasks-json
- POST /tasks/:queue/:collection
-
URL:
:queue
is the_id
if it matches/\A[0-9a-f]{24}\z/
, orname
if it does not.:collection
is a MongoDB collection name.Parameters:
{ "filter": filter, "params": params }
filter
is a filter expression (query) object for the:collection
collection.params
is an object of task params. To insert a document value from a query into the params, prefix the desired key name withdocument.
as a value.Returns:
{ ref $res: Object }
on success;{ "error": "filter and params required and must be name/value objects" }
or{ "error": "queue not found" }
on input error;{ "error": "Could not iterate on collection $collection: $error" }
on query error, or{ ref $res: Object, "error": "Unknown error" }
on MongoDB error.Sets HTTP status to
400
on error.Note: replaces /queue-create-tasks-from-query-json
SEE ALSO
AUTHORS
Ashley Willis <awillis@synacor.com>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2016, 2019 by Ashley Willis.
This is free software, licensed under:
The Apache License, Version 2.0, January 2004