pax_global_header00006660000000000000000000000064150642232400014510gustar00rootroot0000000000000052 comment=e7126aeaa310d89c05dbe0629be422ee3eeb1c76 taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/000077500000000000000000000000001506422324000223555ustar00rootroot00000000000000taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/API-versions.txt000066400000000000000000000072501506422324000254010ustar00rootroot00000000000000This document summaries the API/ABI versions of the different component of TakTuk. It help package maintainer to declare proper dependencies. This document starts to document TakTuk components since version 3.6.3. +------------------------------------------------------------------------+ | taktuk | +------------------+---------------+----------------------+--------------+ | CmdLine | StateFlow | FdProto | NetProto | +-+--------+-------+-+-----+-------+-----+-----------+----+-----+----+---+ /|\ /|\ /|\ /|\ /|\ /|\ | /|\ o--------|---------- | | | | | | +---------------+ +------------------------+ +-----------+ | | | | TakTuk::Pilot | | TakTuk.pm | | libtaktuk | +----+ | +---------------+ +-------------+----------+ +-----------+ Network | | ControlPerl | | IOConstPerl | CommPerl | | CommC | | +-------------+-+ +---+---------+----+-----+ | API | ABI | | /|\ /|\ /|\ +--+--+--+--+ | | | | /|\ /|\ | \ | | | | +--------------+ +-------------+ +-------------+ +-----------+ | User prog | | User prog | | //User prog | |//User prog| | Script, ... | | Perl | | Perl | | C/C++/... | +--------------+ +-------------+ +-------------+ +-----------+ Modules list ============ taktuk Included in: 3.6.3 - 3.7.8 Description: main TakTuk program API-provides: CmdLine: Desc: Command line options Versions: 0: 3.6.3 1: 3.7 - 3.7.8 StateFlow: Desc: Constants and format of state flows Versions: 0: 3.6.3 1: 3.7 - 3.7.8 FdProto: Desc: Protocol in file descriptor communication between taktuk and communication libraries Versions: 0: 3.6.3 1: 3.7 - 3.7.8 NetProto: Desc: Protocol on the network between taktuk instances Versions: 0: 3.6.3 1: 3.7 - 3.7.8 API-depends: TakTuk.pm Included in: 3.6.3 - 3.7.8 Description: Perl functions and constants File automatically extracted from TakTuk script. Useful for a process run by TakTuk with another command than taktuk_perl (which automatically provides TakTuk.pm) and that wishes to communicate via TakTuk. Also useful outside TakTuk, for instance with TakTuk::Pilot for the constants of the 'state' flow. API-provides: CommPerl: Desc: Perl bindings for communication through TakTuk Versions: 0: 3.6.3 1: 3.7 - 3.7.8 IOConstPerl: Desc: Constants for send/recv error management and constants in the 'state' flow Versions: 0: 3.6.3 1: 3.7 - 3.7.8 API-depends: FdProto: 0 for 3.6.3 1 for 3.7 - 3.7.8 StateFlow: 0 for 3.6.3 1 for 3.7 - 3.7.8 TakTuk::Pilot Included in: 3.6.3 - 3.7.8 Description: Perl module to control TakTuk API-provides: ControlPerl: Desc: Perl interface to control a taktuk master process Versions: 0: 3.6.3 - 3.7.8 API-depends: CmdLine: call taktuk with options 0|1 for 3.6.3 - 3.7.8 libtaktuk Included in: 3.6.3 - 3.7.8 Description: C bindings for communications through TakTuk API-provides: CommC-API: Desc: C API Versions: 0: 3.6.3 1: 3.7 - 3.7.2 3: 3.7.4 - 3.7.8 Note: Due to bug in Debian package, do not use API version 2... CommC-ABI: library ABI Versions: 2: 3.6.3 - 3.7.1 3: 3.7.2 - 3.7.8 API-depends: FdProto: 0 for 3.6.3 1 for 3.7 - 3.7.8 taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/AUTHORS000066400000000000000000000013071506422324000234260ustar00rootroot00000000000000Taktuk version 3 is a complete rewrite of the Taktuk engine made by Guillaume Huard Previous versions of Taktuk have been written in C++ by Cyrille Martin The Taktuk concept and architecture is the result of the PhD thesis of Cyrille Martin The theoretical model of taktuk and its experimental validation have been published in the french journal TSI which bibtex entry is : @ARTICLE {MaRiHu2005, author={C. Martin and O. Richard and G. Huard}, journal={Techniques et sciences informatiques}, title={Déploiement adaptatif d'applications parallèles}, volume=24, number=5, year=2005 } Other contributors to Taktuk include (by chronological order) : Olivier Richard, Johan Bourcier, Benoit Claudel taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/Bugs000066400000000000000000000001361506422324000232000ustar00rootroot00000000000000have a look at the section "BUGS" of the manual and at http://taktuk.gforge.inria.fr/Bugs.txt taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/C-Module/000077500000000000000000000000001506422324000237625ustar00rootroot00000000000000taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/C-Module/Makefile.am000066400000000000000000000060131506422324000260160ustar00rootroot00000000000000############################################################################### # # # TakTuk, a middleware for adaptive large scale parallel remote executions # # deployment. Perl implementation, copyright(C) 2006 Guillaume Huard. # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # # # Contact: Guillaume.Huard@imag.fr # # Laboratoire LIG - ENSIMAG - Antenne de Montbonnot # # 51 avenue Jean Kuntzmann # # 38330 Montbonnot Saint Martin # # FRANCE # # # ############################################################################### AM_CFLAGS = -Wall -Werror -ansi include_HEADERS = taktuk.h lib_LTLIBRARIES = libtaktuk.la libtaktuk_la_SOURCES = taktuk.c taktuk.h # Taken from libtool manual : # 1. Start with version information of `0:0:0' for each libtool library. # 2. Update the version information only immediately before a public release # of your software. More frequent updates are unnecessary, and only # guarantee that the current interface number gets larger faster. # 3. If the library source code has changed at all since the last update, # then increment revision (`c:r:a' becomes `c:r+1:a'). # 4. If any interfaces have been added, removed, or changed since the last # update, increment current, and set revision to 0. # 5. If any interfaces have been added since the last public release, then # increment age. # 6. If any interfaces have been removed since the last public release, then # set age to 0. libtaktuk_la_LDFLAGS = -version-info @TAKTUK_VERSION_COMMC_ABI@:0:0 taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/C-Module/taktuk.c000066400000000000000000000530731506422324000254410ustar00rootroot00000000000000/****************************************************************************** * * * TakTuk, a middleware for adaptive large scale parallel remote executions * * deployment. Perl implementation, copyright(C) 2006 Guillaume Huard. * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the Free Software * * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA * * * * Contact: Guillaume.Huard@imag.fr * * ENSIMAG - Laboratoire d'Informatique de Grenoble * * 51 avenue Jean Kuntzmann * * 38330 Montbonnot Saint Martin * * * ******************************************************************************/ #include "taktuk.h" #include #include #include #include #include #include #include #include #include /* #define DEBUG */ #ifdef DEBUG #define debug(f, ...) printf("DEBUG (Line %d) : " f, __LINE__, ##__VA_ARGS__);\ fflush(stdout) #else #define debug(f, ...) #endif static char *taktuk_error_messages[] = { "write failed", "TakTuk engine closed the communication channel", "read error", "should not occur : arg to missing", "should not occur : arg body missing", "timeouted", "invalid destination set specification", "memory allocation failed", "invalid buffer size", "cannot get connector channel", "invalid field for get", "mutex error: no memory", "mutex error: again", "internal: mutex error", "internal: get_data", "internal: from value", "internal: recv message", "internal: info value", "internal: get message" }; static pthread_mutex_t taktuk_mutex[4]; static int has_threads = 0; static int taktuk_fd[2] = {-1,-1}; /* These sizes are sufficient for 19 decimal digits hosts logical numbers */ #define HEADER_BUFFER 64 #define SMALL_BUFFER 20 #define MSG_LENGTH 1 #define READ_ACCESS 0 #define WRITE_ACCESS 1 #define GET_INFO_ACCESS 2 #define RECV_ACCESS 3 static int insistent_write(int fd, const void *buffer, size_t size) { ssize_t result = 0; if (size ==0) return 0; do { result = write(fd, buffer, size); if (result <0) { if (errno == EINTR) { continue; } return TAKTUK_ESWRIT; } size -= result; buffer = ((char *) buffer) + result; } while (size >0); return 0; } static int insistent_read(int fd, void *buffer, size_t size) { ssize_t result = 0; if (size ==0) return 0; do { result = read(fd, buffer, size); if (result <0) { if (errno == EINTR) { continue; } return TAKTUK_ESREAD; } if (result == 0) /* Premature EOF */ { return TAKTUK_EFCLSD; } size -= result; buffer = ((char *) buffer) + result; } while (size >0); return 0; } static int get_taktuk_fd(void) { int taktuk_error = 0; if (taktuk_fd[0] == -1) { char *fd_string; fd_string = getenv("TAKTUK_CONTROL_READ"); if (fd_string != NULL) taktuk_fd[0] = atoi(fd_string); if (taktuk_fd[0] < 0) taktuk_error = TAKTUK_ENOCON; } if (taktuk_fd[0] != -1) { char *fd_string; fd_string = getenv("TAKTUK_CONTROL_WRITE"); if (fd_string != NULL) taktuk_fd[1] = atoi(fd_string); if (taktuk_fd[1] < 0) taktuk_error = TAKTUK_ENOCON; } return taktuk_error; } static int taktuk_lock(int num) { if (has_threads) if (pthread_mutex_lock(taktuk_mutex+num)) return TAKTUK_EINTMX; else { /* debug("LOCK %d\n", num); */ return 0; } else return 0; } static int taktuk_unlock(int num) { if (has_threads) if (pthread_mutex_unlock(taktuk_mutex+num)) return TAKTUK_EINTMX; else { /* debug("UNLOCK %d\n", num); */ return 0; } else return 0; } typedef struct message_node { char code; size_t size; struct message_node *next, *prev; } *message_list; static struct message_node sentinel = { 0, 0, &sentinel, &sentinel}; static message_list message; static size_t position; static message_list message_list_begin(void) { return sentinel.next; } static message_list message_list_end(void) { return &sentinel; } static void push_message_in_list(message_list m) { m->next = &sentinel; m->prev = sentinel.prev; m->prev->next = m; sentinel.prev = m; } static message_list remove_message_from_list(message_list m) { m->prev->next = m->next; m->next->prev = m->prev; return m->next; } static void *put_uint32(void *pos, uint32_t value) { uint32_t to_be_sent; char *src, *dst; int size = sizeof(uint32_t); to_be_sent = htonl(value); src = (char *) &to_be_sent; dst = (char *) pos; while (size--) *(dst++) = *(src++); return dst; } static void *put_bytes(void *pos, const void *mem, size_t length) { memcpy(pos, mem, length); return ((char *) pos) + length; } static void *get_uint32(const void *pos, uint32_t *value) { uint32_t received; char *src, *dst; int size = sizeof(uint32_t); src = (char *) pos; dst = (char *) &received; while (size--) *(dst++) = *(src++); *value = ntohl(received); return src; } static void *get_bytes(const void *pos, void *mem, size_t length) { memcpy(mem, pos, length); return ((char *) pos) + length; } static int wait_message(char *codes, char *code, size_t *size) { char header_buffer[sizeof(uint32_t)+MSG_LENGTH]; uint32_t size_sent; char *current; int result; message_list m; #ifdef DEBUG debug("Entering wait_message, waiting for %s\n", codes); debug("Messages in list:"); for (m = message_list_begin(); m != message_list_end(); m = m->next) { printf(" %c", m->code); } printf("\n"); #endif for (m = message_list_begin(); m != message_list_end(); m = m->next) { debug("Examining list message %c\n", m->code); if (index(codes, m->code) != NULL) { remove_message_from_list(m); message = m; *code = m->code; *size = m->size; position = 0; return 0; } } message = NULL; debug("No list message matched\n"); while (1) { result = insistent_read(taktuk_fd[0], header_buffer, sizeof(uint32_t)+MSG_LENGTH); if (result) return result; current = get_uint32(header_buffer, &size_sent); get_bytes(current, code, MSG_LENGTH); *size = size_sent - MSG_LENGTH; debug("Got message %c of size %ld\n", *code, *size); if (index(codes, *code) != NULL) return 0; m = malloc(sizeof(struct message_node) + *size); if (m == NULL) return TAKTUK_EALLOC; result = insistent_read(taktuk_fd[0], m+1, *size); if (result) return result; m->code = *code; m->size = *size; push_message_in_list(m); debug("Pushed in list\n"); } } static int get_data(void *buffer, size_t size) { char *data = (char *) (message+1); if (message != NULL) { if (position + size <= message->size) { memcpy(buffer, data+position, size); position += size; return 0; } else { return TAKTUK_EINTGD; } } else { return insistent_read(taktuk_fd[0], buffer, size); } } static void free_message(void) { if (message != NULL) free(message); } static int send_header(const char *dest, const char *target, size_t body_length) { char buffer[HEADER_BUFFER]; char *allocated_buffer = NULL; void *header = buffer; void *current; uint32_t header_size; uint32_t dest_size; int result; char send_to = TAKTUK_SEND_TO; char message = TAKTUK_MESSAGE; static char *taktuk_from = NULL; static int taktuk_from_size; int target_size; if (taktuk_from == NULL) { taktuk_from = getenv("TAKTUK_RANK"); if (taktuk_from != NULL) taktuk_from_size = strlen(taktuk_from); else taktuk_from_size = 0; } dest_size = strlen(dest); target_size = strlen(target); /* Do not take into account the first four bytes encoding the total size * Unfortunately I have to compute size first to allocate my memory if * needed ... */ header_size = sizeof(uint32_t) + MSG_LENGTH + sizeof(uint32_t) + dest_size + MSG_LENGTH + sizeof(uint32_t) + target_size + sizeof(uint32_t) + taktuk_from_size; if (header_size > HEADER_BUFFER) { allocated_buffer = (char *) malloc(header_size); if (allocated_buffer == NULL) { return TAKTUK_EALLOC; } header = allocated_buffer; } current = header; /* The first four bytes of the header encode its own size not including * the four bytes themselves */ current = put_uint32(current, header_size-sizeof(uint32_t) + body_length); current = put_bytes(current, &send_to, MSG_LENGTH); current = put_uint32(current, dest_size); current = put_bytes(current, dest, dest_size); current = put_bytes(current, &message, MSG_LENGTH); current = put_uint32(current, target_size); current = put_bytes(current, target, target_size); current = put_uint32(current, taktuk_from_size); current = put_bytes(current, taktuk_from, taktuk_from_size); debug("Sending message: header_size %d, body_length %ld\n", header_size, body_length); if ((result = get_taktuk_fd())) return result; result = insistent_write(taktuk_fd[1], header, header_size); if (allocated_buffer != NULL) free(allocated_buffer); return result; } static void purge_data(size_t msg_length, void *buffer, size_t length) { int result = 0; debug("Entering purge_data\n"); while (msg_length && (result == 0)) { if (msg_length < length) length = msg_length; result = get_data(buffer, length); msg_length -= length; } /* No test for return_values as I already returns an error in this case */ taktuk_unlock(READ_ACCESS); taktuk_unlock(RECV_ACCESS); } static void target_to_string(char *target_name, unsigned long target) { switch (target) { case TAKTUK_TARGET_ANY: strcpy(target_name,"any"); break; case TAKTUK_TARGET_ALL: strcpy(target_name,"all"); break; case TAKTUK_TARGET_OUTPUT: strcpy(target_name,"output"); break; default: sprintf(target_name,"%lu",target); } } /* Implementation of public functions */ const char *taktuk_error_msg(int msg_code) { msg_code--; if ((msg_code < 0) || (msg_code >= TAKTUK_EMAXCD)) return "Unknown error"; else return taktuk_error_messages[msg_code]; } int taktuk_init_threads(void) { int result=0, i; has_threads = 1; result = get_taktuk_fd(); for (i=0; i<4 && !result; i++) { result = pthread_mutex_init(taktuk_mutex+i, NULL); if (result) switch (result) { case ENOMEM: return TAKTUK_EMTXNM; case EAGAIN: return TAKTUK_EMTXAG; default: return TAKTUK_EINTMX; } } debug("Threads initialized\n"); return result; } int taktuk_leave_threads(void) { int result=0, i; for (i=0; i<4 && !result; i++) { result = pthread_mutex_destroy(taktuk_mutex+i); if (result) return TAKTUK_EINTMX; } has_threads = 0; debug("Threads terminated"); return result; } int taktuk_get(const char *field, unsigned long *value) { char buffer[SMALL_BUFFER]; char *current; char get_info = TAKTUK_GET_INFO; int result; size_t size; size_t length, buffer_size; char code; char messages_expected[] = { TAKTUK_INFO, TAKTUK_INVALID, '\0' }; if ((result = get_taktuk_fd())) return result; current = buffer; current = put_uint32(current, 0); current = put_bytes(current, &get_info, MSG_LENGTH); buffer_size = MSG_LENGTH; /* WE ASSUME THAT SMALL_BUFFER IS LARGE ENOUGH */ length = strlen(field); memcpy(current, field, length); buffer_size += length; put_uint32(buffer, buffer_size); buffer_size += sizeof(uint32_t); if (taktuk_lock(GET_INFO_ACCESS)) return TAKTUK_EINTMX; if (taktuk_lock(WRITE_ACCESS)) return TAKTUK_EINTMX; result = insistent_write(taktuk_fd[1], buffer, buffer_size); if (taktuk_unlock(WRITE_ACCESS)) return result?result:TAKTUK_EINTMX; if (result == 0) { if (taktuk_lock(READ_ACCESS)) return TAKTUK_EINTMX; if((result = wait_message(messages_expected, &code, &size)) == 0) { switch (code) { case TAKTUK_INFO: if ((result = get_data(buffer, size)) == 0) { buffer[size] = '\0'; *value = strtol(buffer, ¤t, 10); if (*current != '\0') { result = TAKTUK_EINTIV; } } break; case TAKTUK_INVALID: result = TAKTUK_EINVAL; break; default: result = TAKTUK_EINTGM; } debug("Got info %ld for %s\n", *value, field); free_message(); } if (taktuk_unlock(READ_ACCESS)) return result?result:TAKTUK_EINTMX; } if (taktuk_unlock(GET_INFO_ACCESS)) return result?result:TAKTUK_EINTMX; return result; } int taktuk_multi_send(const char *dest, const char *target, const void *buffer, size_t length) { int result; if (taktuk_lock(WRITE_ACCESS)) return TAKTUK_EINTMX; result = send_header(dest, target, length); if (result == 0) { result = insistent_write(taktuk_fd[1], buffer, length); } if (taktuk_unlock(WRITE_ACCESS)) return TAKTUK_EINTMX; return result; } int taktuk_multi_sendv(const char *dest, const char *target, const struct iovec *iov, int iovcnt) { int i; int result; size_t length =0; for (i = 0; i < iovcnt; ++i) length += iov[i].iov_len; if (taktuk_lock(WRITE_ACCESS)) return TAKTUK_EINTMX; result = send_header(dest, target, length); if (result == 0) { for (i =0; itv_sec + (timeout->tv_usec / 1000000)), (unsigned long) (timeout->tv_usec % 1000000)); buffer_size += strlen(current); } put_uint32(buffer, buffer_size); buffer_size += sizeof(uint32_t); /* Note on locks : - RECV/READ ACCESSES are locked in this function - they are unlocked either : -> on error in this function (if return_value == -1) -> upon call to taktuk read/readv -> upon call to purge_data - these are the only three cases in recv/recvv */ if (taktuk_lock(RECV_ACCESS)) return TAKTUK_EINTMX; if (taktuk_lock(WRITE_ACCESS)) return TAKTUK_EINTMX; result = get_taktuk_fd(); if (result == 0) result = insistent_write(taktuk_fd[1], buffer, buffer_size); if (taktuk_unlock(WRITE_ACCESS) && !result) return TAKTUK_EINTMX; if (result == 0) { if (taktuk_lock(READ_ACCESS)) return TAKTUK_EINTMX; if ((result = wait_message(messages_expected, &code, size)) == 0) { switch (code) { case TAKTUK_MESSAGE: if ((result = get_data(buffer, sizeof(uint32_t))) == 0) { *size -= sizeof(uint32_t); get_uint32(buffer, &from_size); if ((result = get_data(buffer, from_size)) == 0) { *size -= from_size; buffer[from_size] = '\0'; long_result = strtol(buffer, ¤t, 10); if (from != NULL) *from = long_result; if (*current != '\0') result = TAKTUK_EINTFV; else debug("Got message %c from %ld (size remaining " "%ld)\n", code, long_result, *size); } } break; case TAKTUK_TIMEOUT: free_message(); result = TAKTUK_ETMOUT; break; default: free_message(); result = TAKTUK_EINTRM; } } if (result) taktuk_unlock(READ_ACCESS); } if (result) taktuk_unlock(RECV_ACCESS); debug("End of taktuk_wait_message, returning %d\n", result); return result; } int taktuk_read(void* buffer, size_t length) { int result; debug("Entering taktuk_read\n"); result = get_data(buffer, length); free_message(); if (taktuk_unlock(READ_ACCESS)) return result?result:TAKTUK_EINTMX; if (taktuk_unlock(RECV_ACCESS)) return result?result:TAKTUK_EINTMX; return result; } int taktuk_readv(const struct iovec *iov, int iovcnt) { int result = 0; int i; debug("Entering taktuk_readv\n"); for (i=0; (i #include #include #define TAKTUK_ESWRIT 1 #define TAKTUK_EFCLSD 2 #define TAKTUK_ESREAD 3 #define TAKTUK_EARGTO 4 #define TAKTUK_EARGBD 5 #define TAKTUK_ETMOUT 6 #define TAKTUK_EINVST 7 #define TAKTUK_EINVAL 8 #define TAKTUK_ENOERR 9 #define TAKTUK_EALLOC 10 #define TAKTUK_EIBUFF 11 #define TAKTUK_ENOCON 12 #define TAKTUK_EMTXNM 13 #define TAKTUK_EMTXAG 14 #define TAKTUK_EINTMX 15 #define TAKTUK_EINTGD 16 #define TAKTUK_EINTFV 17 #define TAKTUK_EINTRM 18 #define TAKTUK_EINTIV 19 #define TAKTUK_EINTGM 20 #define TAKTUK_EMAXCD 21 #define TAKTUK_TARGET_ANY 0xFFFFFFFF #define TAKTUK_TARGET_ALL 0xFFFFFFFE #define TAKTUK_TARGET_OUTPUT 0xFFFFFFFD #define TAKTUK_READ_SIZE 8192 #define TAKTUK_WRITE_SIZE 8192 #define TAKTUK_TIMEOUT 'O' #define TAKTUK_WAIT_MESSAGE 'W' #define TAKTUK_MESSAGE 'm' #define TAKTUK_SEND_TO 't' #define TAKTUK_GET_INFO 'g' #define TAKTUK_INVALID 'H' #define TAKTUK_INFO 'I' #define TAKTUK_VERSION_COMMC_API @TAKTUK_VERSION_COMMC_API@ /** Taktuk error message taktuk_error_msg() function looks up the error message string corresponding to an error number as described in taktukcomm man page (see taktukcomm(3)). If the error number is not recognized, this function returns the string "Unknown error". \param msg_code the error number \return the error message string \see taktukcomm(3) */ const char *taktuk_error_msg(int msg_code); /* All the following routines return 0 on success and a TakTuk error code on * failure. Their detailed description can be found in the man of * taktukcomm(3) */ /** Initialize the TakTuk C-interface if threads are used taktuk_init_threads() attemps to initialize the C-interface of TakTuk to make its use thread-safe. 0 is returned upon successful completion, a taktuk error code otherwise. \return 0 upon success, an error code otherwise \see taktuk_error_msg \see taktukcomm(3) */ int taktuk_init_threads(void); /** Finalize the TakTuk C-interface if threads are used taktuk_leave_threads() attemps to release resources used by the C-interface of TakTuk after a call to taktuk_init_threads(). 0 is returned upon successful completion, a taktuk error code otherwise. \return 0 upon success, an error code otherwise \see taktuk_error_msg \see taktuk_init_threads \see taktukcomm(3) */ int taktuk_leave_threads(void); /** Gets TakTuk information taktuk_get() attemps to get from the TakTuk engine some global information. The name of the global information required is given as 'field' parameter (supported fields are "rank" and "count") and the result is returned in 'result' parameter. 0 is returned upon successful completion, a taktuk error code otherwise. \param field the name of the required information \param result the address at which the result should be stored \return 0 upon success, an error code otherwise \see taktuk_error_msg \see taktukcomm(3) */ int taktuk_get(const char *field, unsigned long *result); /** Send message taktuk_multi_send(), taktuk_multi_sendv(), taktuk_send(), and taktuk_sendv() are used to transmit a message to other distant process(es) spawed by TakTuk. 'dest' contains either a set of destination peers (multi_send functions which perform multicast sends, see taktuk(1)) or a single destination peer (send functions). Destination are designated by their TakTuk logical rank. taktuk_multi_send() taktuk_send() attempts to write 'length' bytes of data to the destination(s) from the buffer pointed to by 'buffer'. taktuk_multi_sendv(), taktuk_sendv() performs the same action, but gathers the output data from the iovcnt buffers specified by the members of the iov array: iov[0], iov[1], ..., iov[iovcnt-1]. 0 is returned upon successful completion, a taktuk error code otherwise. \param dest the TakTuk rank(s) of the peer process(es) \param target the position of the process in the remote TakTuk instance \param buffer the message to be sent \param length the length in bytes of the message \param iov the array of iovector entries of the message \param iovcnt the size of the array iov \return 0 upon success, an error code otherwise \see taktuk(1) \see taktuk_error_msg \see taktukcomm(3) */ int taktuk_multi_send(const char *dest, const char *target, const void *buffer, size_t length); int taktuk_multi_sendv(const char *dest, const char *target, const struct iovec *iov, int iovcnt); int taktuk_send(unsigned long dest, unsigned long target, const void *buffer, size_t length); int taktuk_sendv(unsigned long dest, unsigned long target, const struct iovec *iov, int iovcnt); /** Receive message taktuk_recv(), taktuk_recvv(), taktuk_wait_message(), taktuk_read () and taktuk_readv() are used to receive a message sent by a distant process spawned by TakTuk. taktuk_recv() and taktuk_recvv() perform a blocking attempt to receive a message. Upon success, the TakTuk rank of the sending process is placed at the address pointed to by 'from' and the content of the message is either placed at the address pointed to by 'buffer' (and 'length' must exactly match the message size) or placed into the 'iovcnt' buffers specified by the members of the iov array: iov[0], iov[1], ..., iov[iovcnt-1] (and in this case the total length of these buffer must exactly match the message length). If the given timeout is not nul and expires or in any other case of error, a positive number is returned and the content of buffer is undefined. taktuk_wait_message(), taktuk_read () and taktuk_readv() are lower level functions performing the same task. taktuk_recv() and taktuk_recvv() are respectively equivalent to a call to taktuk_wait_message(), some error checking tests and a call to either taktuk_read() or taktuk_readv(). \param from the address where to place the TakTuk rank of the sender \param buffer the address at which the message should be placed \param length the length in bytes of the message \param iov the array of iovector entries for the reception \param iovcnt the size of the array iov \return 0 upon success, an error code otherwise \see taktuk_error_msg \see taktukcomm(3) */ int taktuk_recv(unsigned long *from, void *buffer, size_t *length, struct timeval *timeout); int taktuk_recvv(unsigned long *from, const struct iovec *iov, int iovcnt, struct timeval *timeout); int taktuk_wait_message(unsigned long *from, size_t *size, struct timeval *timeout); int taktuk_read (void *buffer, size_t length); int taktuk_readv(const struct iovec *iov, int iovcnt); #endif taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/COPYING000066400000000000000000000431331506422324000234140ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/ChangeLog000066400000000000000000000211151506422324000241270ustar00rootroot000000000000003.7.8 - removed the release information (obsolete) 3.7.7 - fixed a bug with -V option that prevented execution - fixed a perl warning with operator precedence - fixed 'network state' misbehaving when loosing a connection - fixed broken targeting system with inter-processes messages 3.7.6 - fixed perl warning with operator precedence (avoid spurious output) - fixed tests run 3.7.5 - fixed bug with setpgrp causing the raise of 'No such process' message 3.7.4 - added missing informations in manual page - added netproto information in TakTuk version - fixed improper synchronization between get command and wait reduce - fixed wrong behavior : gateways were the target of file transfers - fixed 'send_termination' not taken into account inbetween run and continue in TakTuk::Pilot - fixed minor connections cancellation issue - fixed 'taktuk' stream handling in TakTuk::Pilot - fixed improper reset of a TakTuk::Pilot when used with timeouts - added pid and create_session in TakTuk::Pilot 3.7.3 - add TAKTUK_VERSION_COMMC_API in taktuk.h so that software can be source compatible with different TakTuk versions - "make distcheck" works 3.7.2 - added peers_given fields in connector stream - added id as exec parameter, env info, and get info - added wait commands 3.7.1 - fixed a bug causing hangup on connection timeout when deploying on some peculiar platforms (such as grid5000) - fixed libtaktuk version information - fixed interoperability bug caused by behavior change in latest revision of the Term::ReadLine module. In particular, this fixes kanif bug that appeared along with the latest perl revision. - several other changes in the code are ongoing works that will serve in the upcoming 3.7.2 3.7 The following change makes TakTuk 3.7 incompatible with earlier revisions: - changed syntax of the -R option - removed the $to information from TakTuk::recv - changed C-interface TakTuk groups implied a deep modification of TakTuk scheduler: - added -G option for gateways handling - added TakTuk groups : - contexts for options - work-stealing confined in groups - new scheduler that balances load among groups - removed the limitation of message to a single simultaneous cummunicating process (this was anyway required to implement targets) - added target parameter for messages and some commands - added "message" command - messages to the root node are now outputed to the stream 'message' - fixed minor bugs - added -u option to let user limit the size of TakTuk internal write cache - made TatTuk insensitive to absence of Hostname package - added state event for file opening failure when sending - added state events for communication failures - added tests and doc related to new functionalities - fixed installation bug for Perl module - rewrote code handling processes termination. Should be cleaner. 3.6.3 - fix hostname ranges starting with 0, eg taktuk -m toto[0-4] - removed an error message during configure - make taktuk perl 5.6.1 friendly - add -I option to allow to specify the perl interprete to use - add -V option to allow to specify an alternate PATH environement 3.6.2 - added Perl modules in the installation process - fixed interpreter potential issue (potential hang but never encountered) - added TakTuk::Pilot module along with doc and test - fixed the 'quit' bug using more brutal means for termination - now it is possible to execute on node 0 (but broadcast still does not includes the originating node) - extended set expressions - added new environment variables TAKTUK_FATHER, TAKTUK_CHILD_MIN and TAKTUK_CHILD_MAX - changed the name of taktuk package to TakTuk - reorganized manual pages - fixed minor issues : norms compliance and doc typos 3.6.1 - fixed bug with -t : option didn't work properly - made work-stealing tunable - fixed issues with reduce mechanics : - no more locks with network state - network state can be synchronized - wrote some new tests - fixed connector suppression issue when timeouting - fixed interpreter termination problem 3.6 The following modification make TakTuk 3.6 incompatible with earlier versions - changed commands set: - grouped *_input and close commands into variants of input command - grouped network_state and resign into variants of network command - improved option command: new syntaxic form and now able to deploy nodes - changed internal information transport system: avoids some deadlock situations and should be more efficient - added network renumber and update to assign logical numbers to new nodes - added get function to perl communication interface - completely rewrote and changed C-interface - added -M option to prevent option inherintence - rewrote tests to make them human readable - added new tests (multithreaded, put/get) - made quit command usable in all parts of the tree - added new tests (dynamic) - actually made options set by environment propagate themselves - added new form of environment option setting (local setting) - stolen connectors use the connector command of the thief - added state information for files tranfer 3.5.2 - fixed a small bug related to files propagation 3.5.1 - new add command (do not use, still in development) - enhanced interpolation for filenames (now handles backquotes) - interpolation for machine names 3.5 - replaced output_template command by a special form of option command 3.4 - added error message when setting invalid environment variables - removed initial setpgrp which caused troubles in scripts - added -S option for 'on connection' connector files propagation - added shell environment variable interpolation on filenames (especially remote filenames) - replaced print_tree command by network_state - added put, get and output_template commands - fixed some bug in the C interface - extended C interface with three new lower level functions - fixed connector cancellation issues when connector forks 3.3 The following modifications make TakTuk 3.3 slightly incompatible with earlier revisions (3.2.5 and before). - moved 'initialization failed' notification from 'connector' to 'state' - changed the way 'state' behaves : reports event code - added synchronizer::event_msg function for use in templates - added notification when a connection is lost but TakTuk is not terminating - added $peer_position to keep track of position of failed connections - added $reply_date and $init_date to allow connections benchmarking - made TakTuk tolerant to unknown variables in templates - made TakTuk quit when the command interpreter is killed 3.2.5 - removed limitations on connection timeouts and self-propagation - added -z option: user can choose which parts are to be self propagated - removed $father_position and $depth variables for stream state - extended $position computation to reflect command line hierarchy 3.2.4 - uses time() instead of gettimeofday() when Time::HiRes is not available - fixed issues with errors reporting when slow responding hosts are timeouted - added $father_position and $depth variables for stream state 3.2.3 - added kill command - added resign command - process managed by groups by the kill command 3.2.2 - added version command - added $position variable for templates - added events for commands start/termination in the stream state - this is internal change only : restored fcntl calls instead of $^F stuff which might have cause troubles 3.2.1 - new variables $start_date and $stop_date for "status" stream - new stream "state" - changed the call to open in favor of the 2 arguments form (input files) - removed dependencies to POSIX, fcntl and Socket modules (no more use of them) - fixed hostnames ranges bug with lexicographic comparison - fixed version bug - added $failed variable to stream "connector" 3.2 - fixed bug with input given to already terminated commands (broken pipe were not handled) - replaced socketpairs calls with pipe calls because early commands termination can cause disconnections and possible loss of data - added parameters to the exec command (this roughly allows to timeout commands) - updated and check documentation 3.1 - changed taktuk commands parameters syntax (needs spaces to separate braces) - updated doc - Vince's additions (automatic tests scripts generation) - first (rough) implementation of -W option 3.0.3 (actually never published) - fixed commands parsing bug introduced in 3.0.2 - added -E option for escape character 3.0.2 - fixed -P bug of 3.0.1 - taktuk compiles and uses infinite timeouts if Time::HiRes is not installed - change in set specification syntax and internal integrity check on separators - environement variables are now usable in taktuk_perl filename 3.0.1 - added -l option to change login name on remote hosts 3.0 - first stable release taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/DISCLAIMER000066400000000000000000000040411506422324000237130ustar00rootroot00000000000000############################################################################### # # # TakTuk, a middleware for adaptive large scale parallel remote executions # # deployment. Perl implementation, copyright(C) 2006 Guillaume Huard. # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # # # Contact: Guillaume.Huard@imag.fr # # Laboratoire LIG - ENSIMAG - Antenne de Montbonnot # # 51 avenue Jean Kuntzmann # # 38330 Montbonnot Saint Martin # # FRANCE # # # ############################################################################### taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/INSTALL000066400000000000000000000224321506422324000234110ustar00rootroot00000000000000Installation Instructions ************************* Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc. This file is free documentation; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' installs the package's commands under `/usr/local/bin', include files under `/usr/local/include', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PREFIX'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option `--exec-prefix=PREFIX' to `configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=DIR' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, `configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option `--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to `configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified `gcc' to be used as the C compiler (unless it is overridden in the site shell script). Here is a another example: /bin/bash ./configure CONFIG_SHELL=/bin/bash Here the `CONFIG_SHELL=/bin/bash' operand causes subsequent configuration-related scripts to be executed by `/bin/bash'. `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/Makefile.am000066400000000000000000000120421506422324000244100ustar00rootroot00000000000000############################################################################### # # # TakTuk, a middleware for adaptive large scale parallel remote executions # # deployment. Perl implementation, copyright(C) 2006 Guillaume Huard. # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # # # Contact: Guillaume.Huard@imag.fr # # Laboratoire LIG - ENSIMAG - Antenne de Montbonnot # # 51 avenue Jean Kuntzmann # # 38330 Montbonnot Saint Martin # # FRANCE # # # ############################################################################### .PHONY: commit clean_doc # flags to aclocal if Makefile rules trigger it ACLOCAL_AMFLAGS=-I acinclude PERL_MODULES=Perl-Module/lib/TakTuk.pm Perl-Module/lib/TakTuk/Select.pm PERL_MODULES_FILES= Perl-Module/Makefile.PL Perl-Module/MANIFEST.SKIP \ Perl-Module/lib/TakTuk/Pilot.pm DISCLAIMER all-am: $(PERL_MODULES) taktuk-light modules_make docdir = ${datadir}/doc pkgdocdir = ${docdir}/@PACKAGE@ htmldocdir = ${pkgdocdir}/html pkgconfigdir = $(libdir)/pkgconfig dist_bin_SCRIPTS = taktuk pkgconfig_DATA= taktuk.pc pkgdoc_DATA= COPYING AUTHORS README NEWS ChangeLog SUBDIRS=C-Module . tests if TAKTUK_GENDOC_HTML nodist_htmldoc_DATA=taktuk.html taktukcomm.html taktuk_module.html \ taktuk_pilot.html endif if TAKTUK_GENDOC_MAN nodist_man1_MANS=taktuk.1 nodist_man3_MANS=taktukcomm.3 endif if TAKTUK_NOPERL modules_make: install-exec-hook: @echo;echo WARNING: perl is required for taktuk execution; @ echo " and full installation"; else PERLSRC=@abs_top_srcdir@/Perl-Module Perl-Module/Makefile: Perl-Module/Makefile.PL Perl-Module/lib/TakTuk.pm Perl-Module/lib/TakTuk/Select.pm set -e ; \ cd Perl-Module ; \ if [ ! -f Makefile.PL ] \ && [ -f $(PERLSRC)/Makefile.PL ]; then \ mkdir -p lib/TakTuk ;\ ln -s $(PERLSRC)/MANIFEST.SKIP . ; \ ln -s $(PERLSRC)/lib/TakTuk/Pilot.pm lib/TakTuk ; \ ln -s $(PERLSRC)/Makefile.PL . ; \ fi ;\ perl Makefile.PL PREFIX=${prefix} modules_make: Perl-Module/Makefile $(MAKE) -C Perl-Module install-exec-hook: Perl-Module/Makefile $(MAKE) -C Perl-Module install clean-local: Perl-Module/Makefile $(MAKE) -C Perl-Module distclean $(MAKE) clean-generic endif taktuk.1: taktuk.pod $(POD2MAN) --name=TAKTUK --section=1 \ --center="TakTuk Deployment Engine" $^ >$@ taktukcomm.3: taktukcomm.pod $(POD2MAN) --name=TAKTUK --section=3 \ --center="TakTuk Library Functions Manual" $^ >$@ taktuk.html taktukcomm.html taktuk_module.html: %.html: %.pod $(POD2HTML) --title="TakTuk" $^ >$@ $(RM) pod2htmd.tmp pod2htmi.tmp taktuk_pilot.html: Perl-Module/lib/TakTuk/Pilot.pm $(POD2HTML) --title="TakTuk" $^ >$@ $(RM) pod2htmd.tmp pod2htmi.tmp CLEANFILES = taktuk-light taktuk-light: taktuk echo "#!/usr/bin/perl" >$@ sed -e "s/^ *//g;s/ */ /g;s/^ *#.*$$//g;/^$$/d" $^ >>$@ chmod u+x $@ CLEANFILES += $(PERL_MODULES) Perl-Module/lib/TakTuk.pm: taktuk DISCLAIMER taktuk_module.pod mkdir -p $(dir $@) cat $(filter %DISCLAIMER,$^) >$@ ./$(filter %taktuk,$^) -p TakTuk >>$@ cat $(filter %taktuk_module.pod,$^) >>$@ Perl-Module/lib/TakTuk/Select.pm: taktuk DISCLAIMER mkdir -p $(dir $@) cat $(filter %DISCLAIMER,$^) >$@ ./$(filter %taktuk,$^) -p TakTuk::Select >>$@ DISTCLEANFILES = $(nodist_htmldoc_DATA) $(nodist_man1_MANS) $(nodist_man3_MANS) CLEANFILES += $(PERL_MODULES) EXTRA_DIST = taktukcomm.pod taktuk.pod taktuk_module.pod \ $(PERL_MODULES_FILES) Bugs bootstrap API-versions.txt check_SCRIPTS=check_versions TESTS=$(check_SCRIPTS) # no uninstall check as ExtUtils::MakeMaker does not support uninstall distuninstallcheck: @: taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/NEWS000066400000000000000000000064211506422324000230570ustar00rootroot0000000000000015/03/2012 TakTuk appear as a base tool for Grid5000/FutureGrid in the ANL MCS Technical Memo 326, "Supporting Experimental Computer Science". 19/02/2010 Taktuk 3.7.2 introduces 'wait' commands which are actual synchronization mechanisms for commands execution in various parts of the deployment network. 19/11/2009 TakTuk 3.7 brings new major features : deployment groups, gateways, targets and 'message' stream. These features are especially important on one hand in heterogeneous grids contexts and on the other hand to facilitate out-of-band communications. Some changes imply that TakTuk 3.7 is not compatible with earlier versions (see ChangeLog for more details). 12/06/2009 TakTuk presented at the HPDC international conference : B. Claudel, G. Huard, and O. Richard. Taktuk, adaptive deployment of remote executions. Proceedings of the International Symposium on High Performance Distributed Computing (HPDC), June 2009. 26/11/2008 3.6.2 brings minor bugfixes any many small enhancements that should help users and programmers that rely on TakTuk 27/06/2008 Long time no see... 3.6.1 release finally fixes several remaining bugs from 3.6. These bugs were mostly related to timeouts and termination. 27/11/2007 3.6 release. Changed some commands that makes TakTuk 3.6 slightly incompatible with earlier version. This has impact on kanif: 1.1.1 and earlier do not work with TakTuk 3.6 12/10/2007 3.5 version with small changes in some commands (causing very light incompatibilities, only with version 3.4). 10/10/2007 The 3.4 release introduce significant improvements in TakTuk with files transfer capabilities (both connector files and data files). One command changed name (print_tree), potentially causing light incompatibilities. 19/09/2007 3.3 release. Change some stuff in streams that makes TakTuk 3.3 slightly incompatible with earlier version. This has impact on kanif: 1.0.2 and earlier do not work with TakTuk 3.3 05/09/2007 3.2.5 release. Better link beetween command line and logical numbering. less limitations. 03/07/2007 3.2.3 release. Added last stuff needed for kanif tool : signals and interactive connections management. 20/06/2007 3.2.2 release. No major changes : little fix of a previous mistake (fcntl) and added 'state' stream to help external programs to monitor taktuk. 15/06/2007 Long time, no news... Current stable version is now 3.2 that contains minor syntaxic changes (hence the second number increment). Release of the 3.2.1 is planned for today. Some small evolutionary changes and bugfixes. No ascending compatibility issue with 3.2. 13/02/2007 Release of the 3.0.2 fixing minor bugs of 3.0.1 02/02/2007 Release of the 3.0.1 minor revision which adds the -l option to TakTuk 26/01/2007 Release of the 3.0, the first public stable version. 01/12/2006 TakTuk has now been used successfully in a real large scale situation (over 800 heterogeneous processors). The release of the 3.0 is not far away. 03/08/2006 Release of the 3.0-perl-beta6 version, Now taktuk support point-to-point communications. Still internal to ID laboratory. 24/07/2006 Release of the 3.0-perl-beta4 version (first stable enough version for actual use). Still internal to ID laboratory 05/12/2005 Creation of the repository containing the first prototype of Taktuk 3 Repository still internal to ID laboratory taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/Perl-Module/000077500000000000000000000000001506422324000245025ustar00rootroot00000000000000taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/Perl-Module/MANIFEST.SKIP000066400000000000000000000000401506422324000263720ustar00rootroot00000000000000\.svn \.bak$ \.SKIP$ ^Makefile$ taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/Perl-Module/Makefile.PL000066400000000000000000000042311506422324000264540ustar00rootroot00000000000000#!/usr/bin/perl -w ############################################################################### # # # TakTuk, a middleware for adaptive large scale parallel remote executions # # deployment. Perl implementation, copyright(C) 2006 Guillaume Huard. # # # # This program is free software; you can redistribute it and/or modify # # it under the terms of the GNU General Public License as published by # # the Free Software Foundation; either version 2 of the License, or # # (at your option) any later version. # # # # This program is distributed in the hope that it will be useful, # # but WITHOUT ANY WARRANTY; without even the implied warranty of # # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # # GNU General Public License for more details. # # # # You should have received a copy of the GNU General Public License # # along with this program; if not, write to the Free Software # # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA # # # # Contact: Guillaume.Huard@imag.fr # # Laboratoire LIG - ENSIMAG - Antenne de Montbonnot # # 51 avenue Jean Kuntzmann # # 38330 Montbonnot Saint Martin # # FRANCE # # # ############################################################################### use strict; use ExtUtils::MakeMaker; WriteMakefile (NAME=>"TakTuk", VERSION_FROM=>"lib/TakTuk.pm"); taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/Perl-Module/lib/000077500000000000000000000000001506422324000252505ustar00rootroot00000000000000taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/Perl-Module/lib/TakTuk/000077500000000000000000000000001506422324000264535ustar00rootroot00000000000000taktuk-version-3.7.8-e7126aeaa310d89c05dbe0629be422ee3eeb1c76/Perl-Module/lib/TakTuk/Pilot.pm000066400000000000000000000535521506422324000301120ustar00rootroot00000000000000package TakTuk::Pilot; use strict; use bytes; use Carp; use Exporter; our $VERSION = "1.1"; our $RELEASE = sprintf "%d", q$Rev: 1 $ =~ /(\d+)/g; our @ISA = qw(Exporter); use constant EARGCM => 1; use constant ETMOUT => 2; use constant EARGCB => 3; use constant ETKTRN => 4; use constant ETKTNR => 5; use constant ESPIPE => 6; use constant ESFORK => 7; use constant ESCLOS => 8; use constant ESELEC => 9; use constant ETPBUG => 10; use constant EARGFH => 11; use constant EARGTP => 12; our @messages = ( "Argument 'command' missing", "Timeouted", "Argument 'callback' missing", "TakTuk is already running", "TakTuk is not running", "pipe system call failed", "fork system call failed", "close system call failed", "select error", "Internal bug in TakTuk Pilot module", "Argument 'filehandle' missing", "Argument 'type' missing" ); use TakTuk::Select; use Data::Dumper; our @taktuk_streams = ('taktuk', 'info', 'status', 'connector', 'default', 'state'); our $redirect_options = "-R taktuk='>&=1'"; our $has_setsid = eval("use POSIX 'setsid';1")?1:0; our $read_granularity = 4096; our $write_granularity = 4096; # Internal functions sub dummy_callback(%); sub no_flush($); sub taktuk_read_callback(%); sub taktuk_write_callback(%); sub set_callback($$$$); # User interface sub new(); sub error_msg($); sub run(%); sub continue(); sub create_session(); sub pid(); sub quiet(); sub verbose(); sub add_callback(%); sub send_command($); sub send_termination(); sub add_descriptor(%); sub remove_descriptor(%); sub create_session() { my $self = shift; if ($self->{running} and not $self->{setsid}) { return ETKTRN; } else { $self->{setsid} = 1; return 0; } } sub pid() { my $self = shift; if (!$self->{running}) { return ETKTNR; } else { return $self->{pid}; } } sub quiet() { my $self = shift; if ($self->{running} and not $self->{quiet}) { return ETKTRN; } else { $self->{quiet} = 1; return 0; } } sub verbose() { my $self = shift; if ($self->{running} and $self->{quiet}) { return ETKTRN; } else { $self->{quiet} = 0; return 0; } } sub dummy_callback(%) { my %args = @_; print STDERR "WARNING: Unhandled TakTuk data on stream $args{stream}\n" unless $args{taktuk}->{quiet}; } sub new() { my $self = shift; my $data = {}; $data->{quit} = 0; $data->{option} = {}; $data->{quiet} = 1; $data->{setsid} = 0; $data->{stream} = {}; $data->{callback} = {}; $data->{argument} = {}; $data->{read} = {callback => {}, argument => {}}; $data->{write} = {callback => {}, argument => {}}; $data->{exception} = {callback => {}, argument => {}}; $data->{running} = 0; $data->{read_buffer} = ""; $data->{write_buffer} = ""; $data->{read}->{select} = TakTuk::Select->new or die "Select creation\n"; $data->{write}->{select} = TakTuk::Select->new or die "Select creation\n"; $data->{exception}->{select} = TakTuk::Select->new or die "Select creation\n"; return bless $data, $self; } sub error_msg($) { my $number = shift; if (($number < 1) or ($number > scalar(@messages))) { return "Unknown error"; } else { return $messages[$number-1]; } } sub run(%) { my $self = shift; my %arguments = @_; $self->{command} = $arguments{command}; $self->{timeout} = $arguments{timeout}; return EARGCM unless defined($self->{command}); return ETKTRN if $self->{running}; my ($command, $remaining) = split / /,$self->{command},2; foreach my $stream (@taktuk_streams) { if (not exists($self->{option}->{$stream})) { if ($self->{quiet}) { $self->{option}->{$stream} = "-o $stream"; } else { $self->add_callback(callback=>\&dummy_callback, stream=>$stream); } } } $command .= " ".$redirect_options; foreach my $stream (keys(%{$self->{option}})) { $command .= " ".$self->{option}->{$stream}; } my ($taktuk_read, $taktuk_write); pipe($self->{read_channel}, $taktuk_write) or return ESPIPE; pipe($taktuk_read, $self->{write_channel}) or return ESPIPE; $self->{pid} = fork(); return ESFORK unless defined($self->{pid}); if ($self->{pid}) { close($taktuk_read) or return ESCLOS; close($taktuk_write) or return ESCLOS; binmode($self->{read_channel}); no_flush($self->{write_channel}); } else { setsid() if $self->{setsid} and $has_setsid; close($self->{read_channel}) or die "$!"; close($self->{write_channel}) or die "$!"; open(STDIN,"<&",$taktuk_read) or die "$!"; open(STDOUT,">&",$taktuk_write) or die "$!"; no_flush(\*STDOUT); close($taktuk_read) or die "$!"; close($taktuk_write) or die "$!"; exec("$command $remaining") or die "$!"; } $self->add_descriptor(type=>'read', filehandle=>$self->{read_channel}, callback=>\&taktuk_read_callback); if (length($self->{write_buffer})) { $self->add_descriptor(type=>'write', filehandle=>$self->{write_channel}, callback=>\&taktuk_write_callback); } else { if ($self->{quit}) { $self->remove_descriptor(type=>'write', filehandle=>$self->{write_channel}); close($self->{write_channel}) or return ESCLOS; delete $self->{write_channel}; } } $self->{running} = 1; return $self->continue(); } sub continue() { my $self = shift; return ETKTNR unless $self->{running}; # Main processing loop while (scalar($self->{read}->{select}->handles())) { if (exists($self->{write_channel}) and $self->{quit} and not length($self->{write_buffer})) { $self->remove_descriptor(type=>'write', filehandle=>$self->{write_channel}); close($self->{write_channel}) or return ESCLOS; delete($self->{write_channel}); } my @select_result = TakTuk::Select::select($self->{read}->{select}, $self->{write}->{select}, $self->{exception}->{select}, $self->{timeout}); if (scalar(@select_result)) { my @types = ('read', 'write', 'exception'); my $rank = 0; $rank++ while $rank < 3 and not scalar(@{$select_result[$rank]}); return ETMOUT if $rank == 3; while ($rank < 3) { my $type = $types[$rank]; my $handle = shift @{$select_result[$rank]}; my $callback = $self->{$type}->{callback}->{$handle}; my $argument = $self->{$type}->{argument}->{$handle}; return ETPBUG unless defined $callback; my %call_args = (taktuk=>$self, type=>$type, filehandle=>$handle, argument=>$argument); &$callback(%call_args); $rank++ while $rank < 3 and not scalar(@{$select_result[$rank]}); } } else { return ESELEC; } } $self->{running} = 0; delete $self->{pid}; $self->{write_buffer} = ""; $self->{read_buffer} = ""; close($self->{read_channel}) or return ESCLOS; if (exists($self->{write_channel})) { close($self->{write_channel}) or return ESCLOS; } return 0; } sub no_flush($) { my $new_fd = shift; my $old_fd=select($new_fd); $|=1; select($old_fd); } sub taktuk_read_callback(%) { my %args = @_; my $self = $args{taktuk}; my $descriptor = $args{filehandle}; my $done = 0; my $result = sysread($descriptor, $self->{read_buffer}, $read_granularity, length($self->{read_buffer})); carp "$!" unless defined $result; if (not $result) { $self->remove_descriptor(type=>'read', filehandle=>$descriptor); $done = 1; } while (not $done) { if (length($self->{read_buffer}) >= 4) { my ($size) = unpack("N", $self->{read_buffer}); if (length($self->{read_buffer}) >= $size + 4) { my $buffer = substr $self->{read_buffer}, 4, $size; my ($stream, $data) = split / /, $buffer, 2; $self->{read_buffer} = substr $self->{read_buffer}, $size + 4; my $result = {}; foreach my $field (@{$self->{stream}->{$stream}}) { my $field_size = unpack("N", $data); $result->{$field} = substr($data, 4, $field_size); $data = substr $data, $field_size+4; } my %call_args = (taktuk=>$self, argument=>$self->{argument}->{$stream}, stream=>$stream, fields=>$result); if (exists($self->{callback}->{$stream})) { &{$self->{callback}->{$stream}}(%call_args); } elsif (exists($self->{callback}->{default})) { &{$self->{callback}->{default}}(%call_args); } else { carp "Internal bug in TakTuk::Pilot\n"; } } else { $done = 1; } } else { $done = 1; } } } sub taktuk_write_callback(%) { my %args = @_; my $self = $args{taktuk}; my $descriptor = $args{filehandle}; my $size = length($self->{write_buffer}); my $write_size = ($size > $write_granularity) ? $write_granularity : $size; my $result = syswrite($descriptor, $self->{write_buffer}, $write_size); carp "$!" unless defined($result); if ($result < $size) { $self->{write_buffer} = substr $self->{write_buffer}, $result; } else { $self->{write_buffer} = ""; $self->remove_descriptor(type=>'write', filehandle=>$descriptor); } } sub set_callback($$$$) { my $self = shift; my $callback = shift; my $argument = shift; my $stream = shift; my $fields = shift; my $option = '-o '.$stream.'=\'$user_scalar="'.$stream.' "'; foreach my $field (@$fields) { $option .= '.pack("N",length($'.$field.')).$'.$field; } $option .= ',pack("N",length($user_scalar)).$user_scalar\''; $self->{option}->{$stream} = $option; $self->{stream}->{$stream} = $fields; $self->{callback}->{$stream} = $callback; $self->{argument}->{$stream} = $argument; } sub add_callback(%) { my $self = shift; my %arguments = @_; my $callback = $arguments{callback}; my $argument = $arguments{argument}; my $stream = $arguments{stream}; my $fields = $arguments{fields}; return EARGCB unless defined($callback); $stream = 'default' unless defined($stream); $fields = [] unless defined($fields); if ($stream eq 'default') { foreach my $taktuk_stream (@taktuk_streams) { $self->set_callback($callback, $argument, $taktuk_stream, $fields) unless exists($self->{option}->{$taktuk_stream}); } } else { $self->set_callback($callback, $argument, $stream, $fields); } return 0; } sub send_command($) { my $self = shift; my $command = shift; if (length($command)) { if (not length($self->{write_buffer}) and $self->{running}) { $self->add_descriptor(type=>'write', filehandle=>$self->{write_channel}, callback=>\&taktuk_write_callback); } $self->{write_buffer} .= "$command\n"; } } sub send_termination() { my $self = shift; $self->{quit} = 1; } sub add_descriptor(%) { my $self = shift; my %arguments = @_; my $type = $arguments{type}; my $descriptor = $arguments{filehandle}; my $callback = $arguments{callback}; my $argument = $arguments{argument}; return EARGCB unless defined $callback; return EARGFH unless defined $descriptor; return EARGTP unless defined $type; $self->{$type}->{callback}->{$descriptor} = $callback; $self->{$type}->{argument}->{$descriptor} = $argument; my $error = $self->{$type}->{select}->add($descriptor); return ESELEC if $error; return 0; } sub remove_descriptor(%) { my $self = shift; my %arguments = @_; my $type = $arguments{type}; my $descriptor = $arguments{filehandle}; return EARGFH unless defined $descriptor; return EARGTP unless defined $type; delete($self->{$type}->{callback}->{$descriptor}); delete($self->{$type}->{argument}->{$descriptor}); my $error = $self->{$type}->{select}->remove($descriptor); return ESELEC if $error; return 0; } 1; __END__ =pod TakTuk pilot Perl module =begin html

USER MANUAL

=end html =head1 NAME TakTuk::Pilot - Perl module that ease C execution and related I/O management =head1 SYNOPSIS use TakTuk::Pilot; our @line_counter; sub output_callback(%) { my %parameters = @_; my $field = $parameters{fields}; my $rank = $field->{rank}; my $argument = $parameters{argument}; $argument->[$rank] = 1 unless defined($argument->[$rank]); print "$field->{host}-$rank : ". "$argument->[$rank] > $field->{line}\n"; $argument->[$rank]++; } sub user_input_callback(%) { my %parameters = @_; my $taktuk = $parameters{taktuk}; my $descriptor = $parameters{filehandle}; my $buffer; my $result = sysread($descriptor, $buffer, 1024); warn "Read error $!" if not defined($result); # basic parsing, we assume input is buffered on a line basis chomp($buffer); if (length($buffer)) { print "Executing $buffer\n"; $taktuk->send_command("broadcast exec [ $buffer ]"); } if (not $result) { print "Terminating\n"; $taktuk->remove_descriptor(type=>'read', filehandle=>$descriptor); $taktuk->send_termination(); } } die "This script requieres as arguments hostnames to contact\n" unless scalar(@ARGV); my $taktuk = TakTuk::Pilot->new(); $taktuk->add_callback(callback=>\&output_callback, stream=>'output', argument=>\@line_counter, fields=>['host', 'rank', 'line']); $taktuk->add_descriptor(type=>'read', filehandle=>\*STDIN, callback=>\&user_input_callback); $taktuk->run(command=>"taktuk -s -m ".join(" -m ", @ARGV)); =head1 DESCRIPTION The TakTuk::Pilot Perl module ease the use of B from within a Perl program (see C for a detailed description of B). It transparently manages I/O exchanges as well as B data demultiplexing and decoding. =head1 CONSTRUCTOR =over =item BB<()> Creates a new B object on which the following method can be called. =back =head1 METHODS =over =item B Adds a callback function associated to some B output stream to the calling B object. This callback function will be called by B for each batch of output data incoming from the related stream. The hash passed as argument to this function call may contain the following fields: callback => reference to the callback fonction (mandatory) stream => stream related to this callback, might be 'default' (mandatory) fields => reference to an array of fields names relevant to the user argument => scalar that should be passed to each callback function call The callback function should accept a hash as argument. This hash will be populated with the following fields : taktuk => reference to the taktuk object calling this callback argument => scalar given at callback addition or undef stream => stream on which output data came fields => reference to a hash containing a fieldname/value pair for each field requested upon callback addition =item B Sends to the calling B object the command passed as argument. Note that if the B object is not running, this command will be buffered and executed upon run. =item BB<()> Sends to the calling B object a termination command. As for C, if the B object is not running, this command will be issued upon run. =item B Runs B, executing pending commands and waiting for B output. Note that this function is blocking: it waits for B outputs, possibly calls related callback functions and returns when B terminates. Thus, all B commands should be given either before calling C or within a callback function. This commands takes a hash as argument that may contain the following fields: command => TakTuk command line to be executed timeout => optional timeout on the wait for TakTuk output Upon occurence of the timeout (if one has been given), C will returns an C error code. Note the in this case B execution will not be terminated and should be resumed at some point by calling C. =item BB<()> Resumes a B execution interrupted by timeout occurence. =item B Because the call to C is blocking, waiting for B output, it might be interesting to let the C module monitor I/O occurence related to other file descriptors. This is the intent of C. This function takes a hash as parameter in which the following fields might be defined: type => 'read', 'write' or 'exception', this is the type of I/O possiblities that should be monitored on the descriptor, as in select system call (mandatory). filehandle => file descriptor to monitor (mandatory). callback => reference to the callback function that should be called when I/O is possible on the file descriptor. argument => optional scalar value that will be passed with each call to the callback function The callback function should also accept a hash as an argument in which the following fields will be defined: taktuk => reference to the TakTuk object from which the function was called. type => type of I/O occuring (as in add_callback) filehandle => the related file descriptor. Notice that the user is in charge of performing the I/O operation itslef (sysread or syswrite). Notice also that, because of the use of a select in TakTuk::Pilot, the use of buffered I/O on this descriptor is strongly discouraged argument => the argument that was given to add_descriptor =item B Function that should be called to remove from the B object a descriptor previously added with C. It takes a hash as argument in which the following fields may be defined: type => type of I/O (see add_descriptor) filehandle => file descriptor to remove =item BB<() / verbose>B<()> Change verbosity of C on STDOUT (default is quiet). Should not be called when B is running. =item BB<()> Call C in the B process created by C. The main purpose of this call is to prevent B from receiving signals sent to the process group to which the pilot belong. Should not be called when B is running. =item BB<()> Returns the pid of the process spawned to run B. Should only be called when B is running. =item B Static function. Returns a character string that corresponds to the error code given as argument. The error code should be one of the values returned by other C functions (C, C, C, ...). =back =head1 ERRORS When an error occur in one of these functions, it returns a non nul numeric error code. This code can take one of the following values: =over =item B Field 'command' is missing in a call to C. =item B Field 'callback' is missing in a call to C or C. =item B Field 'filehandle' is missing in a call to C or C. =item B Field 'type' is missing in a call to C or C. =item B A timeout occured in a call to C. =item B B is alredy running but C, C or C has been called. =item B B is not running but C has been called. =item B A call to C failed in C (the error should be in $!). =item B A call to C failed in C (the error should be in $!). =item B A call to C failed in C (the error should be in $!). =item B A call to C B<[ target> target B<]> * data * =item B B<[ target> target B<]> B * data * Sends the given data as input to commands in execution on the local machine as specified by the given target. If no target is given, the data is sent to all commands. For more details about targets, see L<"SET AND TARGETS SPECIFICATION"> =item B B<[ target> target B<]> B Closes the inputs descriptor of executing commands on the local machine as specified by the given target. If no target is given, the inputs of all commands are closed. =item B B<[ target> target B<]> B * filename * Sends the content of a file (which must be local to the node executing the input file) as input to commands in execution on the local machine as specified by the given target. If no target is given, the data is sent to all commands. WARNING: this command is not atomic. If you manage somehow to initiate a input file command from two different B instances, data will probably be interleaved. In this case you should synchronize the two instances. This is not required when spreading files only from the root node. =item B B<[ target> target B<]> B * data * Sends the given data with an additional newline as input to commands in execution on the local machine as specified by the given target. If no target is given, the data is sent to all commands. =item B B<[ target> target B<]> B * filename * Treat the parameter as a file (which must be local to the node executing the input pipe) which behavior is the same as a pipe: data can arrive continuously. B add it as one of its input channels and send data as input to commands when available. If given, the target specifies to which command the data are to be sent, otherwise it is sent to all commands. =item B B<[ target> target B<]> Sends the given signal to local commands processes groups. If no signal is given, sends a TERM signal (signal 15). If given, the target specifies to which command the signal is to be sent, otherwise it is sent to all commands. For more details about targets, see L<"SET AND TARGETS SPECIFICATION"> =item B B<[ target> target B<]> * data * =item B B<[ target> target B<]> B * data * Sends the given data as a message to commands in execution on the local machine as specified by the given target (see C and C for more details about messages). If no target is given, the data is sent to the first command peforming a receive and not already targeted by another message. For more details about targets, see L<"SET AND TARGETS SPECIFICATION"> =item B B<[ target> target B<]> B * filename * Sends the content of a file (which must be local to the node executing the message file) as a message to commands in execution on the local machine as specified by the given target (see C and C for more details about messages). If no target is given, the data is sent to the first command peforming a receive and not already targeted by another message. WARNING: this command is not atomic. If you manage somehow to initiate a message file command from two different B instances, data will probably be interleaved. In this case you should synchronize the two instances. This is not required when spreading files only from the root node. =item B B<[ target> target B<]> B * data * Sends the given data with an additional newline as a message to commands in execution on the local machine as specified by the given target (see C and C for more details about messages). If no target is given, the data is sent to the first command peforming a receive and not already targeted by another message. =item B B<[ target> target B<]> B * data * Treat the parameter as a filename (which must be local to the node executing the input pipe) which behavior is the same as a pipe: data can arrive continuously. B add it as one of its input channels and send data as a message to commands when available (see C and C for more details about messages). If given, the target specifies to which command the data are to be sent, otherwise it is sent to the first command peforming a receive and not already targeted by another message. =item B =item B Prints the current B deployment tree. Numbers in parenthesis match the peer rank in the logical B numbering and the peer ready state. If the deployment is not complete, the printed tree will display C leaves. =item B Cancels all ongoing connections. Consequently, this causes immediate starting of the possible numbering of B instances and the execution of B commands. =item B Completely recomputes the logical numbering of B instances. This is especially useful when adding new nodes to the deployed network after initial numbering. =item B Updates the logical numbering of B instances without changing already existing numbers. Does not always succeed as B uses a depth first scheme for numbering. Sends an event 9 in the stream 'state' for each node of the tree that cannot be updated while keeping B numbering scheme. This is especially useful when adding new nodes to the deployed network after initial numbering. =item B