1 #ifndef RUNNER_EXECUTOR_H 2 #define RUNNER_EXECUTOR_H 3 4 #include "job_list.h" 5 #include "settings.h" 6 7 struct execute_state 8 { 9 size_t next; 10 /* 11 * < 0 : No overall timeout used. 12 * = 0 : Timeouted, don't execute any more. 13 * > 0 : Timeout in use, time left. 14 */ 15 double time_left; 16 double resuming; 17 bool dry; 18 }; 19 20 enum { 21 _F_JOURNAL, 22 _F_OUT, 23 _F_ERR, 24 _F_DMESG, 25 _F_LAST, 26 }; 27 28 bool open_output_files(int dirfd, int *fds, bool write); 29 void close_outputs(int *fds); 30 31 /* 32 * Initialize execute_state object to a state where it's ready to 33 * execute. Will validate the settings and serialize both settings and 34 * the job_list into the result directory, overwriting old files if 35 * settings set to do so. 36 */ 37 bool initialize_execute_state(struct execute_state *state, 38 struct settings *settings, 39 struct job_list *job_list); 40 41 /* 42 * Initialize execute_state object to a state where it's ready to 43 * resume an already existing run. settings and job_list must have 44 * been initialized with init_settings et al, and will be read from 45 * the result directory pointed to by dirfd. 46 */ 47 bool initialize_execute_state_from_resume(int dirfd, 48 struct execute_state *state, 49 struct settings *settings, 50 struct job_list *job_list); 51 52 bool execute(struct execute_state *state, 53 struct settings *settings, 54 struct job_list *job_list); 55 56 57 #endif 58