-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathjob.h
55 lines (46 loc) · 1.74 KB
/
job.h
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
50
51
52
53
54
55
#ifndef _LPJS_JOB_H_
#define _LPJS_JOB_H_
// scanf() is good for converting numbers, but risks buffer overflows
// for strings, just like gets(), etc.
// Numeric fields must be grouped together before string fields
// for job_read_from_string()
// Numeric: job_id, array_index, job_count, processors_per_job, threads_per_process,
// phys_mib_per_processor, chaperone_pid, job_pid, state
// String: user_name, primary_group_name, submit_node, submit_dir,
// script_name, compute_node, log_dir, pull_command, push_command
#define JOB_BASIC_NUMS_FORMAT "%9lu %4lu %4u %3u %3u %5zu"
#define JOB_SPEC_NUMS_FORMAT JOB_BASIC_NUMS_FORMAT " %u %u %u"
#define JOB_SPEC_STRINGS_FORMAT " %s %s %s %s %s %s %s\n%s\n%s\n%s\n"
#define JOB_SPEC_NUMERIC_FIELDS 9
// Complete job specs
#define JOB_SPEC_FORMAT JOB_SPEC_NUMS_FORMAT JOB_SPEC_STRINGS_FORMAT
#define JOB_SPEC_STRING_FIELDS 10
// For lpjs jobs output
#define JOB_BASIC_PARAMS_HEADER \
" JobID IDX J/S P/J T/P MiB/P User Script Compute-node\n"
#define JOB_BASIC_PARAMS_FORMAT JOB_BASIC_NUMS_FORMAT " %s %s %s\n"
#define JOB_SPECS_ITEMS (JOB_SPEC_NUMERIC_FIELDS + JOB_SPEC_STRING_FIELDS)
#define JOB_FIELD_MAX_LEN 1024
#define JOB_STR_MAX_LEN 2048 // Fixme: MAX_PATH + x?
#define JOB_NO_PATH "not-set"
#define JOB_NO_PULL_CMD "not-set"
#define JOB_NO_PUSH_CMD "not-set"
typedef enum
{
JOB_STATE_PENDING = 0,
JOB_STATE_DISPATCHED,
JOB_STATE_CANCELED,
JOB_STATE_RUNNING
} job_state_t;
typedef struct job job_t;
#ifndef _STDIO_H_
#include <stdio.h>
#endif
#ifndef _UNISTD_H_
#include <unistd.h>
#endif
#include "job-rvs.h"
#include "job-accessors.h"
#include "job-mutators.h"
#include "job-protos.h"
#endif // _LPJS_JOB_H_