cctools
work_queue_process.h
1 #ifndef WORK_QUEUE_PROCESS_H
2 #define WORK_QUEUE_PROCESS_H
3 
4 #include "work_queue.h"
5 #include "timestamp.h"
6 
7 #include <unistd.h>
8 #include <sys/types.h>
9 #include <sys/resource.h>
10 
11 #define NONE 0
12 #define DOCKER 1
13 #define DOCKER_PRESERVE 2
14 #define UMBRELLA 3
15 
16 #define MAX_BUFFER_SIZE 4096
17 
18 /*
19 work_queue_process is a running instance of a work_queue_task.
20 This object is private to the work_queue_worker.
21 */
22 
24  pid_t pid;
25  int task_status; // Any of WORK_QUEUE_RESULT_*
26  int exit_status; // Exit code, or signal number to task process.
27 
28  struct rusage rusage;
29  timestamp_t execution_start;
30  timestamp_t execution_end;
31 
32  char *sandbox;
33 
34  char *output_file_name;
35  int output_fd;
36 
37  struct work_queue_task *task;
38 
39  char container_id[MAX_BUFFER_SIZE];
40 };
41 
42 struct work_queue_process * work_queue_process_create( int taskid );
43 pid_t work_queue_process_execute( struct work_queue_process *p, int container_mode, ... );
44 // lunching process with container, arg_3 can be either img_name or container_name, depending on container_mode
45 void work_queue_process_kill( struct work_queue_process *p );
46 void work_queue_process_delete( struct work_queue_process *p);
47 
48 #endif
A task description.
Definition: work_queue.h:75
A master-worker library.
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:20
Definition: work_queue_process.h:23