📄 toolkit.h
字号:
int maxrun; /* Queue run limit */ int userrun; /* Queue per-user run limit */ int nodes_max; /* Maximum node usage */ int nodes_min; /* Minimum node usage */ int nodes_default; /* Default node request for jobs */ time_t wallt_max; /* Maximum walltime allowed (sec) */ time_t wallt_min; /* Minimum walltime allowed (sec) */ time_t wallt_default; /* Default walltime for jobs (sec) */ int nodes_assn; /* Number of nodes assigned (used) */ int nodes_rsvd; /* Number of nodes reserved */};typedef struct queue Queue;/* * External list of queues. Needed so that there can be multiple * distinct orderings of the same set of structs. */struct queuelist { struct queuelist *next; Queue *queue;};typedef struct queuelist QueueList;/* * This structure contains information about a scheduled outage for a * machine. Each execution host may have one or more scheduled outages * listed for it. This relies upon a clone of the NAS 'schedule' program * (see README and dedicated.c for more information.) */struct outage { struct outage *next; char *exechost; /* Outage for this host. */ time_t beg_time; /* Time when outage begins. */ time_t end_time; /* Time the outage ends. */ int flags; /* Miscellaneous flags. *//* * OUTAGE_FLAGS_SYSTEM: This is a system outage, not a per-host one. */#define OUTAGE_FLAGS_SYSTEM (1) char beg_datestr[DATE_LENGTH + 1]; /* Date of outage start. */ char beg_timestr[TIME_LENGTH + 1]; /* Time of outage start. */ char end_datestr[DATE_LENGTH + 1]; /* Date of outage end. */ char end_timestr[TIME_LENGTH + 1]; /* Time of outage end. */};typedef struct outage Outage;/* This structure holds the values returned by the resource monitor. */struct resources { struct resources *next; /* Pointer to next resource list */ char *exechost; /* Name of this execution host */ int usrtime; /* % wall time spent in user code */ int systime; /* % wall time spent in syscalls */ int idltime; /* % wall time spent in idle loop */ size_t freemem; /* Amount of free memory */ int njobs; /* number of jobs running */ int nodes_total; /* Number of nodes on system */ int nodes_alloc; /* Number of nodes allocated */ int flags; /* Miscellaneous flags. */};typedef struct resources Resources;/* Per-group allocation and usage database table constants. */#ifndef MAX_USER_NAME_SIZE#define MAX_USER_NAME_SIZE 10#endif /* ! MAX_USER_NAME_SIZE */#ifndef MAX_GROUP_NAME_SIZE#define MAX_GROUP_NAME_SIZE 10#endif /* ! MAX_GROUP_NAME_SIZE */#ifndef MAX_GROUP#define MAX_GROUP 1024#endif /* ! MAX_GROUP */#ifndef MAX_USERS#define MAX_USERS 256#endif /* ! MAX_USERS */#ifndef MAX_TXT#define MAX_TXT 127#endif /* ! MAX_TXT *//* Group usage and allocation counters. */struct alloc_group { char gname[MAX_GROUP_NAME_SIZE]; /* Name of the group */ double total_usage; /* Allocation usage YTD */ double allocation; /* Total Allocation given */};typedef struct alloc_group Alloc_Group;/* PE map specific globals: */#define MAX_LABEL_SZ 8#define MAX_PE_MAP_SIZE 555 /* large enough to hold all APP PEs */#define STAT_DOWN -1#define STAT_AVAIL 0#define STAT_JOB_PBS 1#define STAT_JOB_CMD 2struct pe_info { Job *job; /* pointer to running job or NULL */ char label[MAX_LABEL_SZ+1]; /* max label size = 8 */ int status; /* status of Node -1 == down */ int apps_max; /* maximum number of apps allowed */ int apps_num; /* current number of apps running */};typedef struct pe_info PE_Info;PE_Info schd_PEMAP[ MAX_PE_MAP_SIZE ]; /*****************************************************************************//* Exported function prototypes for the scheduler toolkit. *//*****************************************************************************//* acl_support.c */UserAcl *schd_create_useracl (char *useracl);int schd_free_useracl (UserAcl *);int schd_useracl_okay (Job *job, Queue *queue, char *reason);/* allocations.c */void schd_alloc_info (void);int schd_is_over_alloc (char *group);int schd_reject_over_alloc (Job *job);/* byte2val.c */char *schd_byte2val(size_t bytes);/* cleanup.c */int schd_cleanup (void);/* comment.c */#define JOB_COMMENT_REQUIRED 0#define JOB_COMMENT_OPTIONAL 1void schd_comment_job (Job *job, char *reason, int optional);void schd_comment_server (char *reason);int schd_alterjob(int sv_conn, Job *job, char *name, char *value, char *rsrc);/* dedicated.c */void schd_clear_outage_cache (void);Outage *schd_host_outage (char *exechost, time_t when);int schd_dedicated_can_run (Job *job, Queue *srcq, time_t when, char *reason);/* dedqueue.c */int schd_handle_dedicated_time(Queue *dedq);#if PE_MASK != 0/* dyn_nodemask.c */char *schd_format_nodemask (Bitfield *mask_mask, Bitfield *ndmask);int schd_bits2mask (char *string, Bitfield *mask);int schd_str2mask (char *maskstr, Bitfield *maskp);int schd_mask2str (char *maskstr, Bitfield *maskp);int schd_node_count (Bitfield *mask);#if defined(sgi)int schd_alloc_nodes (int nnodes, Queue *queue, Bitfield *job_mask);#endif#endif /* PE_MASK *//* evaluate_system.c */int schd_evaluate_system(Resources *rsrcs, char *reason);/* file_chgs.c */int schd_register_file (char *filename);int schd_file_has_changed (char *filename, int reset_stamp);int schd_forget_file (char *filename);/* fragments.c */int schd_fragment_okay (Job *job, Queue *queue, char *reason);/* getat.c */char *schd_getat (char *at, Batch_Status *bs, char *rs);/* getconfig.c */int schd_get_config (char *filename);/* getjobs.c */Job *schd_get_jobs (char *qname, char *state);/* getqueues.c */int schd_get_queue_limits (Queue *queue);#ifdef DEBUG#define QUEUE_DUMP_JOBS 1#define QUEUE_DUMP_STATS_ONLY 0void schd_dump_queue (Queue *queue, int dumpjobs);#endif /* DEBUG *//* getrsrcs.c */Resources *schd_get_resources (char *exechost);void schd_dump_rsrclist (void);/* grminfo.c */int load_pe_map(Job *Jobs);/* how_many.c */int schd_how_many (char *str, char *state);/* jobinfo.c */int schd_get_jobinfo (Batch_Status *bs, Job *job);int schd_free_jobs (Job *list);void calc_job_weight(Job *job);/* misc.c */void schd_timestamp (char *msg);int schd_free_qlist (QueueList *qlist);int schd_destroy_qlist (QueueList *qlist);char *schd_strdup (char *string);char *schd_lowercase (char *string);char *schd_shorthost (char *fqdn);/* movejob.c */int schd_move_job_to (Job *job, Queue *destq);/* overlaps.c */Queue *schd_find_drain(QueueList *qlist, Job *job);/* pack_queues.c */int schd_pack_queues (Job *jlist, QueueList *qlist, char *reason);/* pnp.c */int schd_prime_time (time_t when);int schd_secs_til_prime (time_t when);int schd_secs_til_nonprime (time_t when);int schd_read_holidays (void);int schd_reset_observed_pt (QueueList *qlist);/* queue_limits.c */int schd_job_fits_queue (Job *job, Queue *queue, char *reason);int schd_job_can_queue (Job *job);int schd_check_queue_limits (Queue *queue, char *reason);/* resource_limits.c */int schd_resource_limits (Job *job, Resources *rsrcs, char *reason);int schd_resources_avail (Job *job, Resources *rsrcs, char *reason);/* rejectjob.c */int schd_reject_job(Job *job, char *reason);/* runjob.c */#define SET_JOB_COMMENT 1#define LEAVE_JOB_COMMENT 0int schd_run_job_on (Job *job, Queue *queue, char *exechost, int set_comment);int schd_charge_job (Job *job, Queue *queue, Resources *rsrcs);/* schedinit.c */int schedinit (int argc, char **argv);/* sec2val.c */char *schd_sec2val (int seconds);/* time_limits.c */int schd_primetime_limits (Job *job, Queue *queue, time_t when, char *reason);int schd_finish_before_np(Job *job, Queue *queue, time_t when, char *reason);/* user_limits.c */int schd_user_limits (Job *job, Queue *queue, char *reason);/* usersort.c */Job *schd_sort_jobs (Job *jobs);int schd_save_decay (void);void schd_decay_info (char *mode);void schd_update_resource_usage (Job *job);double get_resource_usage (char *user);/* val2bool.c */int schd_val2bool (char *val, int *bool);char *schd_bool2val (int bool);int schd_val2datetime (char *string, time_t *when);int schd_val2booltime (char *val, time_t *t);char *schd_booltime2val (time_t bool);/* val2byte.c */size_t schd_val2byte (char *val);/* val2sec.c */time_t schd_val2sec (char *val);#endif /* ! TOOLKIT_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -