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 #include "path_disk_size_info.h"
7 
8 #include <unistd.h>
9 #include <sys/types.h>
10 #include <sys/resource.h>
11 
12 #define NONE 0
13 #define DOCKER 1
14 #define DOCKER_PRESERVE 2
15 #define UMBRELLA 3
16 
17 #define MAX_BUFFER_SIZE 4096
18 
19 /*
20 work_queue_process is a running instance of a work_queue_task.
21 This object is private to the work_queue_worker.
22 */
23 
25  pid_t pid;
26  int task_status; // Any of WORK_QUEUE_RESULT_*
27  int exit_status; // Exit code, or signal number to task process.
28 
29  struct rusage rusage;
30  timestamp_t execution_start;
31  timestamp_t execution_end;
32 
33  char *sandbox;
34 
35  char *output_file_name;
36  int output_fd;
37 
38  struct work_queue_task *task;
39 
40  /* disk size and number of files found in the process sandbox. */
41  int64_t sandbox_size;
42  int64_t sandbox_file_count;
43 
44  /* state between complete disk measurements. */
45  struct path_disk_size_info *disk_measurement_state;
46 
47  char container_id[MAX_BUFFER_SIZE];
48 };
49 
50 struct work_queue_process * work_queue_process_create( int taskid );
51 pid_t work_queue_process_execute( struct work_queue_process *p, int container_mode, ... );
52 // lunching process with container, arg_3 can be either img_name or container_name, depending on container_mode
53 void work_queue_process_kill( struct work_queue_process *p );
54 void work_queue_process_delete( struct work_queue_process *p);
55 
56 int work_queue_process_measure_disk(struct work_queue_process *p, int max_time_on_measurement);
57 
58 #endif
A task description.
Definition: work_queue.h:94
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: path_disk_size_info.h:13
Query disk space on the given directory.
Definition: work_queue_process.h:24