TakTuk(3pm)

πŸ“¦
version 3.7.8 Β· 5 versions
, in ubuntu resolute, ubuntu stonking

πŸ’– TakTuk β€” the Perl manual page, but make it make sense πŸ’–

okay bestie, sit down, hydrate, and let me tell you about TakTuk, the Perl module that hands you an interface to the communication facilities of taktuk(1). yes. that taktuk(1). we're talking to the engine directly now. it's giving backstage pass energy. πŸŽ€


✨ SYNOPSIS ✨

like, here's the whole vibe in code, no notes:

use TakTuk;

my $rank = TakTuk::get('rank');
my $count = TakTuk::get('count');

print "I'm process $rank among $count\n";

if ($rank > 1) {
    my ($from, $message) = TakTuk::recv();
    if (not defined($message)) {
        print "Trying to recv: ",
              TakTuk::error_msg($TakTuk::error), "\n";
    } else {
        print "$rank received $message from $from\n";
    }
}

sleep 1;
my $next = $rank+1;
$next = 1 if ($next > $count);
if (not TakTuk::send(to=>$next, body=>"[Salut numero $rank]")) {
    print "Trying to send to $next: ",
          TakTuk::error_msg($TakTuk::error), "\n";
}

if ($rank == 1) {
    my ($from, $message) = TakTuk::recv(timeout=>5);
    if (not defined($message)) {
        print "Trying to recv :",
              TakTuk::error_msg($TakTuk::error), "\n";
    } else {
        print "$rank received $message from $from\n";
    }
}

a little ring-around-the-rosie of processes passing messages. obsessed. πŸ¦‹


🌸 DESCRIPTION 🌸

so the TakTuk communication layer Perl interface is how programs that got run by the taktuk(1) command get to talk to each other. πŸ’¬ It's built on a super simple send/receive model β€” multicast-like sends, and receives that can optionally have a timeout. lowkey elegant. BUT β€” and I need you to hear me on this β€” this is only meant to be a control facility. it is not a high performance communication library. do not come for her about throughput. she is not that girl and she never claimed to be. πŸ™ˆ

The Perl communication interface for TakTuk is made of functions that scripts can call. and those scripts get executed either:

  • using the taktuk_perl command of the TakTuk engine β€” this is the preferred way, because it means less installation requirements on the remote machines, slay ✨
  • or using the TakTuk Perl module provided with the TakTuk distribution

and here are the functions, bestie:

  • TakTuk::get($) β€” gets some information from TakTuk. currently the available info is 'target', 'rank', 'count', 'father', 'child_min' and 'child_max'. and honestly? this is a better way to get this info than environment variables, because it takes into account renumbering that might occur after process spawn. no cap. πŸ’…
  • TakTuk::send(%) β€” sends a scalar to a single peer or to a set specification (go read taktuk(1) for the tea on set specifications). the two mandatory fields in the arguments are "to" (with a set specification) and "body". optionally you can also pass a "target" field. returns an undefined value upon error. 🫢
  • TakTuk::recv(%) β€” blocks until a message shows up. returns a list of two elements: the logical number of the source of the message, and the message itself. it accepts an optional "timeout" argument with a numeric value. returns an empty list upon error. 😭

When an error occurs, all of these functions set the variable $TakTuk::error to the numeric code of the error that happened. and a textual description of the error is provided by the function TakTuk::error_msg($), which takes the error code as an argument. so you're never just staring at a number like πŸ‘οΈπŸ‘„πŸ‘οΈ

πŸ’€ Error codes, aka the villain lineup πŸ’€

  • TakTuk::ESWRIT β€” a call to TakTuk::syswrite failed. this is because of a syswrite error different than EAGAIN. the code should be accessible using $!.
  • TakTuk::EFCLSD β€” the communication channel to the TakTuk engine has been closed. this typically occurs when shutting down the logical network (like, using Ctrl-C on the root node for instance). rip. πŸͺ¦
  • TakTuk::ESREAD (only for TakTuk::recv) β€” a call to sysread failed (the code should be accessible using $!).
  • TakTuk::EARGTO (only for TakTuk::send) β€” the "to" field is missing in the arguments.
  • TakTuk::EARGBD (only for TakTuk::send) β€” the "body" field is missing in the arguments.
  • TakTuk::ETMOUT (only for TakTuk::recv) β€” the call to TakTuk::recv timeouted. this only occurs when you gave a "timeout" field as a TakTuk::recv argument.

πŸ‘‘ The constants πŸ‘‘

Finally β€” and this part is a whole mood β€” the TakTuk Perl module defines some constants whose values match the different states reported by the stream "state" (peep taktuk(1) for the details about this stream). these constants are:

TakTuk::TAKTUK_READY
TakTuk::TAKTUK_NUMBERED
TakTuk::TAKTUK_TERMINATED
TakTuk::CONNECTION_FAILED
TakTuk::CONNECTION_INITIALIZED
TakTuk::CONNECTION_LOST
TakTuk::COMMAND_STARTED
TakTuk::COMMAND_FAILED
TakTuk::COMMAND_TERMINATED
TakTuk::UPDATE_FAILED
TakTuk::PIPE_STARTED
TakTuk::PIPE_FAILED
TakTuk::PIPE_TERMINATED
TakTuk::FILE_RECEPTION_STARTED
TakTuk::FILE_RECEPTION_FAILED
TakTuk::FILE_RECEPTION_TERMINATED
TakTuk::FILE_SEND_FAILED
TakTuk::INVALID_TARGET
TakTuk::NO_TARGET
TakTuk::MESSAGE_DELIVERED
TakTuk::INVALID_DESTINATION
TakTuk::UNAVAILABLE_DESTINATION

πŸ¦‹ SEE ALSO πŸ¦‹

tatkuk(1), taktukcomm(3), TakTuk::Pilot(3)

yes, it says tatkuk(1) up there. that's what the page says, so that's what we're saying. iykyk. we don't edit the sacred text. πŸ’…

πŸ’œ AUTHOR πŸ’œ

The original concept of TakTuk was proposed by Cyrille Martin in his PhD thesis. the people involved in this work include Jacques Briat, Olivier Richard, Thierry Gautier and Guillaume Huard. literal legends, all of them. 🫢

The author of version 3 (the perl version) and the current maintainer of the package is Guillaume Huard.


The "TakTuk" communication interface library is provided under the terms of the GNU General Public License version 2 or later. share and share alike, bestie. ✨


and that's the whole page, no crumbs left. this one came to you courtesy of perl v5.40.1, dated 2025-09-30. mwah. πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from