Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

gearman::task(3pm) [debian man page]

Gearman::Task(3pm)					User Contributed Perl Documentation					Gearman::Task(3pm)

NAME
Gearman::Task - a task in Gearman, from the point of view of a client SYNOPSIS
my $task = Gearman::Task->new("add", "1+2", { ..... }; $taskset->add_task($task); $client->do_task($task); $client->dispatch_background($task); DESCRIPTION
Gearman::Task is a Gearman::Client's representation of a task to be done. USAGE
Gearman::Task->new($func, $arg, \%options) Creates a new Gearman::Task object, and returns the object. $func is the function name to be run. (that you have a worker registered to process) $arg is an opaque scalar or scalarref representing the argument(s) to pass to the distributed function. If you want to pass multiple arguments, you must encode them somehow into this one. That's up to you and your worker. %options can contain: o uniq A key which indicates to the server that other tasks with the same function name and key will be merged into one. That is, the task will be run just once, but all the listeners waiting on that job will get the response multiplexed back to them. Uniq may also contain the magic value "-" (a single hyphen) which means the uniq key is the contents of the args. o on_complete A subroutine reference to be invoked when the task is completed. The subroutine will be passed a reference to the return value from the worker process. o on_fail A subroutine reference to be invoked when the task fails (or fails for the last time, if retries were specified). No arguments are passed to this callback. This callback won't be called after a failure if more retries are still possible. o on_retry A subroutine reference to be invoked when the task fails, but is about to be retried. Is passed one argument, what retry attempt number this is. (starts with 1) o on_status A subroutine reference to be invoked if the task emits status updates. Arguments passed to the subref are ($numerator, $denominator), where those are left up to the client and job to determine. o retry_count Number of times job will be retried if there are failures. Defaults to 0. o high_priority Boolean, whether this job should take priority over other jobs already enqueued. o timeout Automatically fail, calling your on_fail callback, after this many seconds have elapsed without an on_fail or on_complete being called. Defaults to 0, which means never. Bypasses any retry_count remaining. o try_timeout Automatically fail, calling your on_retry callback (or on_fail if out of retries), after this many seconds have elapsed. Defaults to 0, which means never. $task->is_finished Returns bool: whether or not task is totally done (on_failure or on_complete callback has been called) perl v5.10.1 2009-10-05 Gearman::Task(3pm)

Check Out this Related Man Page

Gearman::Server::Client(3pm)				User Contributed Perl Documentation			      Gearman::Server::Client(3pm)

NAME
Gearman::Server::Client - client for gearmand NAME
Used by Gearman::Server to instantiate connections from clients. Clients speak either a binary protocol, for normal operation (calling functions, grabbing function call requests, returning function values, etc), or a text-based line protocol, for relatively rare administrative / monitoring commands. The binary protocol commands aren't currently documented. (FIXME) But they're well-implemented in Gearman::Client, Gearman::Worker, and Gearman::Client::Async, if that's any consolation. The line-based administrative commands are documented below. Binary Protocol Structure All binary protocol exchanges between clients (which can be callers, workers, or both) and the Gearman server have common packet header: 4 byte magic -- either "REQ" for requests to the server, or "RES" for responses from the server 4 byte type -- network order integer, representing the packet type 4 byte length -- network order length, for data segment. data -- optional, if length is non-zero Binary Protocol Commands echo_req (type=16) A debug command. The server will reply with the same data, in a echo_res (type=17) packet. (and many more...) FIXME: auto-generate protocol docs from internal Gearman::Util table, once annotated with some English? Line based commands These commands are used for administrative or statistic tasks to be done on the gearman server. They can be entered using a line based client (telnet, etc.) by connecting to the listening port(7003) and are also intended to be machine parsable. "workers" Emits list of registered workers, their fds, IPs, client ids, and list of registered abilities (function names they can do). Of format: fd ip.x.y.z client_id : func_a func_b func_c fd ip.x.y.z client_id : func_a func_b func_c fd ip.x.y.z client_id : func_a func_b func_c . It ends with a line with just a period. "status" The output format of this function is tab separated columns as follows, followed by a line consisting of a fullstop and a newline (". ") to indicate the end of output. Function name A string denoting the name of the function of the job Number in queue A positive integer indicating the total number of jobs for this function in the queue. This includes currently running ones as well (next column) Number of jobs running A positive integer showing how many jobs of this function are currently running Number of capable workers A positive integer denoting the maximum possible count of workers that could be doing this job. Though they may not all be working on it due to other tasks holding them busy. "jobs" Output format is zero or more lines of: [Job function name] [Uniq (coalescing) key] [Worker address] [Number of listeners] Follows by a single line of: . is a literal tab character is perl's definition of newline (literal on linux, something else on win32) "clients" Output format is zero or more sections of: One line of: [Client Address] Followed by zero or more lines of: [Job Function] [Uniq (coalescing) key] [Worker Address] Follows by a single line of: . is a literal tab character is perl's definition of newline (literal on linux, something else on win32) "maxqueue" function [max_queue_size] For a given function of job, the maximum queue size is adjusted to be max_queue_size jobs long. A negative value indicates unlimited queue size. If the max_queue_size value is not supplied then it is unset (and the default maximum queue size will apply to this function). This function will return OK upon success, and will return ERR incomplete_args upon an invalid number of arguments. "shutdown" ["graceful"] Close the server. Or "shutdown graceful" to close the listening socket, then close the server when traffic has died away. "version" Returns server version. perl v5.10.1 2011-02-14 Gearman::Server::Client(3pm)
Man Page