📄 toolkit.h
字号:
/* * Flags for the internal state of the queue: * * QFLAGS_STOPPED: Queue is stopped -- do not attempt to run jobs on it. * QFLAGS_DISABLED: Queue is disabled -- do not queue or run jobs on it. * QFLAGS_FULL: Queue has jobs running that consume all of at least * one of the queue's limited resources. * QFLAGS_MAXRUN: Queue has enough jobs running. Resources may or may * not be available, but don't run more jobs. * QFLAGS_DRAINING: Queue is being drained, possibly to run a long-waiting * large job. * QFLAGS_USER_ACL: Queue has an active user access control list. */ int flags; /* Flags for this queue (see above). */#define QFLAGS_STOPPED (1 << 0)#define QFLAGS_DISABLED (1 << 1)#define QFLAGS_FULL (1 << 2)#define QFLAGS_MAXRUN (1 << 3)#define QFLAGS_DRAINING (1 << 4)#define QFLAGS_NODEDOWN (1 << 5)#define QFLAGS_USER_ACL (1 << 6) time_t empty_by; /* When this queue will be empty */ time_t drain_by; /* When this queue will be drained */ /* enough to run the waiting job */ Job *jobs; /* Pointer to list of jobs on queue */ UserAcl *useracl; /* Linked list of user ACL's */ int running; /* Num jobs running */ int queued; /* Num jobs queued */ int maxrun; /* Queue run limit */ int userrun; /* Queue per-user run limit */ int ncpus_max; /* Maximum CPU usage */ int ncpus_min; /* Minimum CPU usage */ int ncpus_default; /* Default CPU request for jobs */ int ncpus_assn; /* Number of ncpus assigned (used) */ size_t mem_max; /* Maximum Memory usage */ size_t mem_min; /* Minimum Memory usage */ size_t mem_default; /* Default Memory request for jobs */ size_t mem_assn; /* Amount of memory assigned (used) */ 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) */};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 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 */ char *arch; /* Architecture of 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 */ int flags; /* Miscellaneous flags. */ int njobs; /* Number of jobs running */ int ncpus_total; /* Number of ncpus on system */ int ncpus_alloc; /* Number of ncpus allocated */ double loadave; /* System load average */ size_t freemem; /* Amount of free memory */ size_t mem_total; /* Amount of memory on system */ size_t mem_alloc; /* Amount of memory allocated */};typedef struct resources Resources;#ifndef MAX_TXT#define MAX_TXT 127#endif /* ! MAX_TXT *//* User information. */struct Uinfo { char name[MAX_TXT+1]; int running_jobs; int jobcount;};struct accessentry { char *name; /* queue name for access entry */ int max_percent; /* percentage "share" of system */ int max_running; /* max percentage running jobs */ int past_ndays; /* number of past days' data */ double past_percent; /* percentage used in past */ double today_usage; /* NCPUs*MINUTES used today */ double today_max; /* NCPUs*MINUTES max for today */ size_t default_mem; /* queue's default memory limit */ struct accessentry *next; };typedef struct accessentry AccessEntry;struct accesslist { struct accesslist *next; /* UNUSED at this time */ AccessEntry *entry;};typedef struct accesslist FairAccessList;/*****************************************************************************//* 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);/* cleanup.c */int schd_cleanup (void);int cleanup_rsrcs(Resources *rsrcs);/* 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);/* evaluate_system.c */int schd_evaluate_system(Resources *rsrcs, char *reason);/* fair_access.c */int arg_to_fairshare(char *arg, char *sep, FairAccessList **fairacl_ptr);void schd_print_fairshare(void);int schd_accesslimits(char *qname, int *maxjobs, int *maxtime);int schd_job_exceeds_fairshare(Job *job, Queue *queue, char *reason);double percent_shares_today(AccessEntry *AE);double percent_shares_past(AccessEntry *AE);void update_share_usage(AccessEntry *AE);/* getconfig.c */int schd_get_config (char *filename);void schd_print_fairshare(void);/* getjobs.c */Job *schd_get_jobs (char *qname, char *state);/* getqueues.c */int schd_get_queues(void);int schd_get_queue_limits(Queue *queue);int schd_get_queue_util(void);int schd_get_queue_info(Queue *queue);int queue_claim_jobs(Queue *queue, Job **joblist_ptr);int queue_sanity(Queue *queue);int get_node_status(void);size_t schd_get_queue_memory(char *qName);/* getrsrcs.c */Resources *schd_get_resources (char *exechost);void schd_dump_rsrclist (void);/* jobinfo.c */int schd_get_jobinfo (Batch_Status *bs, Job *job);int schd_free_jobs (Job *list);size_t get_default_mem(char *qName);/* overlaps.c */Queue *schd_find_drain(QueueList *qlist, Job *job);/* pack_queues.c */int schd_pack_queues (Job *jlist, QueueList *qlist, char *reason);Queue *find_best_exechost (Job *job, QueueList *qlist, char *reason);Queue *make_room_for_job (Job *job, QueueList *qlist, char *reason);/* queue_limits.c */int schd_check_queue_limits (Queue *queue, char *reason);int schd_job_fits_queue (Job *job, Queue *queue, char *reason);int schd_job_can_queue (Job *job);/* resource_limits.c */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);/* 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);/* toolkit.c */extern char schd_VersionString[];int schd_register_file (char *filename);int schd_file_has_changed (char *filename, int reset_stamp);int schd_forget_file (char *filename);char *schd_byte2val(size_t bytes);char *schd_bool2val (int bool);char *schd_booltime2val (time_t bool);char *schd_sec2val (int seconds);int schd_val2bool (char *val, int *bool);int schd_val2booltime (char *val, time_t *t);int schd_val2datetime (char *string, time_t *when);size_t schd_val2byte (char *val);time_t schd_val2sec (char *val);void init_holidays (void);int schd_read_holidays (void);void schd_check_primetime(void);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_reset_observed_pt (QueueList *qlist);char *schd_strdup (char *string);char *schd_lowercase (char *string);char *schd_shorthost (char *fqdn);char *schd_getat (char *at, Batch_Status *bs, char *rs);int schd_how_many (char *str, char *state);int schd_move_job_to (Job *job, Queue *destq);int schd_free_qlist (QueueList *qlist);int schd_destroy_qlist (QueueList *qlist);void schd_timestamp (char *msg);/* user_limits.c */int schd_user_limits (Job *job, Queue *queue, char *reason);/* usersort.c */Job *schd_sort_jobs (Job *jobs);void get_users(void);#endif /* ! TOOLKIT_H_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -