summaryrefslogtreecommitdiff
path: root/runner/executor.h
blob: 8fe1605bdcb14f375f7f55c7d4a82ffc507295d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#ifndef RUNNER_EXECUTOR_H
#define RUNNER_EXECUTOR_H

#include "job_list.h"
#include "settings.h"

struct execute_state
{
	size_t next;
};

enum {
	_F_JOURNAL,
	_F_OUT,
	_F_ERR,
	_F_DMESG,
	_F_LAST,
};

bool open_output_files(int dirfd, int *fds, bool write);
void close_outputs(int *fds);

/*
 * Initialize execute_state object to a state where it's ready to
 * execute. Will validate the settings and serialize both settings and
 * the job_list into the result directory, overwriting old files if
 * settings set to do so.
 */
bool initialize_execute_state(struct execute_state *state,
			      struct settings *settings,
			      struct job_list *job_list);

/*
 * Initialize execute_state object to a state where it's ready to
 * resume an already existing run. settings and job_list must have
 * been initialized with init_settings et al, and will be read from
 * the result directory pointed to by dirfd.
 */
bool initialize_execute_state_from_resume(int dirfd,
					  struct execute_state *state,
					  struct settings *settings,
					  struct job_list *job_list);

bool execute(struct execute_state *state,
	     struct settings *settings,
	     struct job_list *job_list);


#endif