cctools
mpi_queue.h
Go to the documentation of this file.
1 /*
2 Copyright (C) 2011- The University of Notre Dame
3 This software is distributed under the GNU General Public License.
4 See the file COPYING for details.
5 */
6 
7 #ifndef MPI_QUEUE_H
8 #define MPI_QUEUE_H
9 
12 #include "timestamp.h"
13 
14 
15 #define MPI_QUEUE_LINE_MAX 256
16 #define MPI_QUEUE_DEFAULT_PORT 9123
17 
18 #define MPI_QUEUE_WAITFORTASK -1
19 
20 #define MPI_QUEUE_RETURN_STATUS_UNSET -1
21 #define MPI_QUEUE_RESULT_UNSET -1
22 
23 #define MPI_QUEUE_INPUT 0
24 #define MPI_QUEUE_OUTPUT 1
25 
29  char *tag;
30  char *command_line;
31  char *output;
32  struct list *input_files;
33  struct list *output_files;
34  int taskid;
35  int status;
37  int result;
47 };
48 
49 
54 struct mpi_queue_task *mpi_queue_task_create(const char *full_command);
55 
63 void mpi_queue_task_specify_file(struct mpi_queue_task *t, const char *name, int type);
64 
65 
71 void mpi_queue_task_specify_tag(struct mpi_queue_task *t, const char *tag);
72 
73 
78 
79 
96 struct mpi_queue *mpi_queue_create(int port);
97 
103 void mpi_queue_submit(struct mpi_queue *q, struct mpi_queue_task *t);
104 
110 struct mpi_queue_task *mpi_queue_wait(struct mpi_queue *q, int timeout);
111 
115 int mpi_queue_empty(struct mpi_queue *q);
116 
121 int mpi_queue_port(struct mpi_queue *q);
122 
126 void mpi_queue_delete(struct mpi_queue *q);
127 
128 #endif
129 
timestamp_t computation_time
The time of executing the command.
Definition: mpi_queue.h:43
struct list * input_files
The files to transfer to the worker and place in the executing directory.
Definition: mpi_queue.h:32
INT64_T total_bytes_transferred
Number of bytes transferred since task has last started transferring input data.
Definition: mpi_queue.h:45
void mpi_queue_delete(struct mpi_queue *q)
Delete a work queue.
void mpi_queue_task_specify_file(struct mpi_queue_task *t, const char *name, int type)
Add a file to a task.
void mpi_queue_task_delete(struct mpi_queue_task *t)
Delete a task specification.
struct list * output_files
The output files (other than the standard output stream) created by the program expected to be retrie...
Definition: mpi_queue.h:33
Portable routines for high resolution timing.
UINT64_T timestamp_t
A type to hold the current time, in microseconds since January 1st, 1970.
Definition: timestamp.h:19
char * tag
An optional user-defined logical name for the task.
Definition: mpi_queue.h:29
struct mpi_queue_task * mpi_queue_wait(struct mpi_queue *q, int timeout)
Wait for tasks to complete.
void mpi_queue_task_specify_tag(struct mpi_queue_task *t, const char *tag)
Attach a user defined logical name to the task.
int result
The result of the task (successful, failed return_status, missing input file, missing output file)...
Definition: mpi_queue.h:37
char * output
The standard output of the task.
Definition: mpi_queue.h:31
timestamp_t total_transfer_time
Time comsumed in microseconds for transferring total_bytes_transferred.
Definition: mpi_queue.h:46
int mpi_queue_port(struct mpi_queue *q)
Get the listening port of the queue.
int mpi_queue_empty(struct mpi_queue *q)
Determine whether there are any known tasks queued, running, or waiting to be collected.
timestamp_t start_time
The time at which the task began.
Definition: mpi_queue.h:40
char * command_line
The program(s) to execute, as a shell command line.
Definition: mpi_queue.h:30
timestamp_t transfer_start_time
The time at which it started to transfer input files.
Definition: mpi_queue.h:42
timestamp_t finish_time
The time at which it completed.
Definition: mpi_queue.h:41
int return_status
The exit code of the command line.
Definition: mpi_queue.h:36
timestamp_t submit_time
The time the task was submitted.
Definition: mpi_queue.h:39
Definition: list.h:48
int status
Current status of the task.
Definition: mpi_queue.h:35
int taskid
A unique task id number.
Definition: mpi_queue.h:34
A task description.
Definition: mpi_queue.h:28
void mpi_queue_submit(struct mpi_queue *q, struct mpi_queue_task *t)
Submit a job to a work queue.
struct mpi_queue * mpi_queue_create(int port)
Create a new work queue.
struct mpi_queue_task * mpi_queue_task_create(const char *full_command)
Create a new task specification.