|
| 1 | +/************************************************************\ |
| 2 | + * Copyright 2018 Lawrence Livermore National Security, LLC |
| 3 | + * (c.f. AUTHORS, NOTICE.LLNS, COPYING) |
| 4 | + * |
| 5 | + * This file is part of the Flux resource manager framework. |
| 6 | + * For details, see https://github.com/flux-framework. |
| 7 | + * |
| 8 | + * SPDX-License-Identifier: LGPL-3.0 |
| 9 | +\************************************************************/ |
| 10 | + |
| 11 | +#ifndef _FLUX_JOB_LIST_JOB_DATA_H |
| 12 | +#define _FLUX_JOB_LIST_JOB_DATA_H |
| 13 | + |
| 14 | +#include <flux/core.h> |
| 15 | +#include <jansson.h> |
| 16 | + |
| 17 | +#include "job-list.h" |
| 18 | +#include "src/common/libutil/grudgeset.h" |
| 19 | +#include "src/common/libczmqcontainers/czmq_containers.h" |
| 20 | + |
| 21 | +/* timestamp of when we enter the state |
| 22 | + * |
| 23 | + * associated eventlog entries when restarting |
| 24 | + * |
| 25 | + * t_depend - "submit" |
| 26 | + * t_priority - "priority" (not saved, can be entered multiple times) |
| 27 | + * t_sched - "depend" (not saved, can be entered multiple times) |
| 28 | + * t_run - "alloc" |
| 29 | + * t_cleanup - "finish" or "exception" w/ severity == 0 |
| 30 | + * t_inactive - "clean" |
| 31 | + */ |
| 32 | +struct job { |
| 33 | + struct list_ctx *ctx; |
| 34 | + |
| 35 | + flux_jobid_t id; |
| 36 | + uint32_t userid; |
| 37 | + int urgency; |
| 38 | + int64_t priority; |
| 39 | + double t_submit; |
| 40 | + // t_depend is identical to t_submit |
| 41 | + // double t_depend; |
| 42 | + double t_run; |
| 43 | + double t_cleanup; |
| 44 | + double t_inactive; |
| 45 | + flux_job_state_t state; |
| 46 | + const char *name; |
| 47 | + int ntasks; |
| 48 | + int nnodes; |
| 49 | + char *ranks; |
| 50 | + char *nodelist; |
| 51 | + double expiration; |
| 52 | + int wait_status; |
| 53 | + bool success; |
| 54 | + bool exception_occurred; |
| 55 | + int exception_severity; |
| 56 | + const char *exception_type; |
| 57 | + const char *exception_note; |
| 58 | + flux_job_result_t result; |
| 59 | + json_t *annotations; |
| 60 | + struct grudgeset *dependencies; |
| 61 | + |
| 62 | + /* cache of job information */ |
| 63 | + json_t *jobspec; |
| 64 | + json_t *R; |
| 65 | + char *eventlog; |
| 66 | + size_t eventlog_len; |
| 67 | + json_t *exception_context; |
| 68 | + |
| 69 | + /* Track which states we have seen and have completed transition |
| 70 | + * to. We do not immediately update to the new state and place |
| 71 | + * onto a new list until we have retrieved any necessary data |
| 72 | + * associated to that state. For example, when the 'depend' state |
| 73 | + * has been seen, we don't immediately place it on the `pending` |
| 74 | + * list. We wait until we've retrieved data such as userid, |
| 75 | + * urgency, etc. |
| 76 | + * |
| 77 | + * Track which states we've seen via the states_mask. |
| 78 | + * |
| 79 | + * Track states seen via events stream in states_events_mask. |
| 80 | + */ |
| 81 | + zlist_t *next_states; |
| 82 | + unsigned int states_mask; |
| 83 | + unsigned int states_events_mask; |
| 84 | + void *list_handle; |
| 85 | + |
| 86 | + int eventlog_seq; /* last event seq read */ |
| 87 | +}; |
| 88 | + |
| 89 | +void job_destroy (void *data); |
| 90 | + |
| 91 | +struct job *job_create (struct list_ctx *ctx, flux_jobid_t id); |
| 92 | + |
| 93 | +#endif /* ! _FLUX_JOB_LIST_JOB_DATA_H */ |
| 94 | + |
| 95 | +/* |
| 96 | + * vi:tabstop=4 shiftwidth=4 expandtab |
| 97 | + */ |
0 commit comments