Gearman::Taskset(3pm)

πŸ“¦
version 2.004.015 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu jammy, ubuntu noble, ubuntu resolute

πŸ’– Gearman::Taskset πŸ’–

okay bestie, welcome to Gearman::Taskset(3pm) β€” it's part of the User Contributed Perl Documentation and it's genuinely one of those little modules that just works, no cap. It's the taskset in Gearman, seen from the point of view of a Gearman::Client. πŸŽ€


✨ NAME ✨

Gearman::Taskset β€” a taskset in Gearman, from the point of view of a Gearman::Client. πŸ¦‹


🌸 SYNOPSIS 🌸

here's the vibe, literally copy-paste it and go:

use Gearman::Client;
my $client = Gearman::Client->new;

# waiting on a set of tasks in parallel
my $ts = $client->new_task_set;
$ts->add_task( "add" => "1+2", {...});
$ts->wait();
the {...} is doing a lot of heavy lifting there but she's iconic for it πŸ’…

πŸ‘‘ DESCRIPTION πŸ‘‘

Gearman::Taskset is a Gearman::Client's representation of tasks queue. that's it, that's the whole job, and she eats every time. πŸ”₯


🧚 METHODS 🧚

new($client)

make a new one, pass her the client, we move. ✨

wait(%opts)

waits for a response from the job server for any of the tasks listed in the taskset. lowkey the main character of this whole module tbh.

it will call the on_* handlers for each of the tasks that have been completed, updated, etc. β€” like, every single one that has something to say gets its moment. 🌈

and she does not return until everything has finished running or failing. no early exits, no half-finished energy. periodt. πŸ’€

add_task(Gearman::Task)

add_task($func, <$scalar | $scalarref>, <$uniq | $opts_hr>

adds a task to the taskset. 🫢

three different calling conventions are available, so pick your fighter and slay.

for $opts_hr see Gearman::Task. iykyk. πŸ’œ


ngl bestie, the way that wait just stays there until every last task is done running or failing? that's commitment. that's loyalty. that's the vibe check passing. πŸ’–

and that's the whole page, you're so welcome 🌸

this little beauty ships as perl v5.26.2, dated 2018-08-30, in the Gearman::Taskset(3pm) manpage β€” so go forth, queue your tasks in parallel, and be the main character of your own event loop. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from