slurmdb.h 73 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089
  1. /*****************************************************************************\
  2. * slurmdb.h - Interface codes and functions for slurm
  3. ******************************************************************************
  4. * Copyright (C) 2010 Lawrence Livermore National Security.
  5. * Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
  6. * Written by Danny Auble da@llnl.gov, et. al.
  7. * CODE-OCEC-09-009. All rights reserved.
  8. *
  9. * This file is part of Slurm, a resource management program.
  10. * For details, see <https://slurm.schedmd.com/>.
  11. * Please also read the included file: DISCLAIMER.
  12. *
  13. * Slurm is free software; you can redistribute it and/or modify it under
  14. * the terms of the GNU General Public License as published by the Free
  15. * Software Foundation; either version 2 of the License, or (at your option)
  16. * any later version.
  17. *
  18. * In addition, as a special exception, the copyright holders give permission
  19. * to link the code of portions of this program with the OpenSSL library under
  20. * certain conditions as described in each individual source file, and
  21. * distribute linked combinations including the two. You must obey the GNU
  22. * General Public License in all respects for all of the code used other than
  23. * OpenSSL. If you modify file(s) with this exception, you may extend this
  24. * exception to your version of the file(s), but you are not obligated to do
  25. * so. If you do not wish to do so, delete this exception statement from your
  26. * version. If you delete this exception statement from all source files in
  27. * the program, then also delete it here.
  28. *
  29. * Slurm is distributed in the hope that it will be useful, but WITHOUT ANY
  30. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  31. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  32. * details.
  33. *
  34. * You should have received a copy of the GNU General Public License along
  35. * with Slurm; if not, write to the Free Software Foundation, Inc.,
  36. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  37. \*****************************************************************************/
  38. #ifndef _SLURMDB_H
  39. #define _SLURMDB_H
  40. #ifdef __cplusplus
  41. extern "C" {
  42. #endif
  43. #include <slurm/slurm.h>
  44. typedef enum {
  45. SLURMDB_ADMIN_NOTSET,
  46. SLURMDB_ADMIN_NONE,
  47. SLURMDB_ADMIN_OPERATOR,
  48. SLURMDB_ADMIN_SUPER_USER
  49. } slurmdb_admin_level_t;
  50. typedef enum {
  51. SLURMDB_CLASS_NONE, /* no class given */
  52. SLURMDB_CLASS_CAPABILITY, /* capability cluster */
  53. SLURMDB_CLASS_CAPACITY, /* capacity cluster */
  54. SLURMDB_CLASS_CAPAPACITY, /* a cluster that is both capability
  55. * and capacity */
  56. } slurmdb_classification_type_t;
  57. typedef enum {
  58. SLURMDB_EVENT_ALL,
  59. SLURMDB_EVENT_CLUSTER,
  60. SLURMDB_EVENT_NODE
  61. } slurmdb_event_type_t;
  62. typedef enum {
  63. SLURMDB_PROBLEM_NOT_SET,
  64. SLURMDB_PROBLEM_ACCT_NO_ASSOC,
  65. SLURMDB_PROBLEM_ACCT_NO_USERS,
  66. SLURMDB_PROBLEM_USER_NO_ASSOC,
  67. SLURMDB_PROBLEM_USER_NO_UID,
  68. } slurmdb_problem_type_t;
  69. typedef enum {
  70. SLURMDB_REPORT_SORT_TIME,
  71. SLURMDB_REPORT_SORT_NAME
  72. } slurmdb_report_sort_t;
  73. typedef enum {
  74. SLURMDB_REPORT_TIME_SECS,
  75. SLURMDB_REPORT_TIME_MINS,
  76. SLURMDB_REPORT_TIME_HOURS,
  77. SLURMDB_REPORT_TIME_PERCENT,
  78. SLURMDB_REPORT_TIME_SECS_PER,
  79. SLURMDB_REPORT_TIME_MINS_PER,
  80. SLURMDB_REPORT_TIME_HOURS_PER,
  81. } slurmdb_report_time_format_t;
  82. typedef enum {
  83. SLURMDB_RESOURCE_NOTSET,
  84. SLURMDB_RESOURCE_LICENSE
  85. } slurmdb_resource_type_t;
  86. typedef enum {
  87. SLURMDB_UPDATE_NOTSET,
  88. SLURMDB_ADD_USER,
  89. SLURMDB_ADD_ASSOC,
  90. SLURMDB_ADD_COORD,
  91. SLURMDB_MODIFY_USER,
  92. SLURMDB_MODIFY_ASSOC,
  93. SLURMDB_REMOVE_USER,
  94. SLURMDB_REMOVE_ASSOC,
  95. SLURMDB_REMOVE_COORD,
  96. SLURMDB_ADD_QOS,
  97. SLURMDB_REMOVE_QOS,
  98. SLURMDB_MODIFY_QOS,
  99. SLURMDB_ADD_WCKEY,
  100. SLURMDB_REMOVE_WCKEY,
  101. SLURMDB_MODIFY_WCKEY,
  102. SLURMDB_ADD_CLUSTER,
  103. SLURMDB_REMOVE_CLUSTER,
  104. SLURMDB_REMOVE_ASSOC_USAGE,
  105. SLURMDB_ADD_RES,
  106. SLURMDB_REMOVE_RES,
  107. SLURMDB_MODIFY_RES,
  108. SLURMDB_REMOVE_QOS_USAGE,
  109. SLURMDB_ADD_TRES,
  110. SLURMDB_UPDATE_FEDS,
  111. } slurmdb_update_type_t;
  112. /* Define QOS flags */
  113. #define QOS_FLAG_BASE 0x0fffffff
  114. #define QOS_FLAG_NOTSET 0x10000000
  115. #define QOS_FLAG_ADD 0x20000000
  116. #define QOS_FLAG_REMOVE 0x40000000
  117. #define QOS_FLAG_PART_MIN_NODE 0x00000001
  118. #define QOS_FLAG_PART_MAX_NODE 0x00000002
  119. #define QOS_FLAG_PART_TIME_LIMIT 0x00000004
  120. #define QOS_FLAG_ENFORCE_USAGE_THRES 0x00000008
  121. #define QOS_FLAG_NO_RESERVE 0x00000010
  122. #define QOS_FLAG_REQ_RESV 0x00000020
  123. #define QOS_FLAG_DENY_LIMIT 0x00000040
  124. #define QOS_FLAG_OVER_PART_QOS 0x00000080
  125. #define QOS_FLAG_NO_DECAY 0x00000100
  126. #define QOS_FLAG_USAGE_FACTOR_SAFE 0x00000200
  127. /* Define Server Resource flags */
  128. #define SLURMDB_RES_FLAG_BASE 0x0fffffff /* apply to get real flags */
  129. #define SLURMDB_RES_FLAG_NOTSET 0x10000000
  130. #define SLURMDB_RES_FLAG_ADD 0x20000000
  131. #define SLURMDB_RES_FLAG_REMOVE 0x40000000
  132. /* Define Federation flags */
  133. #define FEDERATION_FLAG_BASE 0x0fffffff
  134. #define FEDERATION_FLAG_NOTSET 0x10000000
  135. #define FEDERATION_FLAG_ADD 0x20000000
  136. #define FEDERATION_FLAG_REMOVE 0x40000000
  137. /* SLURM CLUSTER FEDERATION STATES */
  138. enum cluster_fed_states {
  139. CLUSTER_FED_STATE_NA,
  140. CLUSTER_FED_STATE_ACTIVE,
  141. CLUSTER_FED_STATE_INACTIVE
  142. };
  143. #define CLUSTER_FED_STATE_BASE 0x000f
  144. #define CLUSTER_FED_STATE_FLAGS 0xfff0
  145. #define CLUSTER_FED_STATE_DRAIN 0x0010 /* drain cluster by not accepting
  146. any new jobs and waiting for all
  147. federated jobs to complete.*/
  148. #define CLUSTER_FED_STATE_REMOVE 0x0020 /* remove cluster from federation
  149. once cluster is drained of
  150. federated jobs */
  151. /* flags and types of resources */
  152. /* when we come up with some */
  153. /*
  154. * Translation of db_flags in job_record_t and flag
  155. * slurmdb_job_[rec|cond]_t
  156. */
  157. #define SLURMDB_JOB_FLAG_NONE 0x00000000 /* No flags */
  158. #define SLURMDB_JOB_CLEAR_SCHED 0x0000000f /* clear scheduling bits */
  159. #define SLURMDB_JOB_FLAG_NOTSET 0x00000001 /* Not set */
  160. #define SLURMDB_JOB_FLAG_SUBMIT 0x00000002 /* Job was started on submit */
  161. #define SLURMDB_JOB_FLAG_SCHED 0x00000004 /* Job was started from main
  162. * scheduler */
  163. #define SLURMDB_JOB_FLAG_BACKFILL 0x00000008 /* Job was started from backfill */
  164. /*
  165. * Slurm job condition flags
  166. * slurmdb_job_cond_t
  167. */
  168. #define JOBCOND_FLAG_DUP 0x00000001 /* Report duplicate job entries */
  169. #define JOBCOND_FLAG_NO_STEP 0x00000002 /* Don't report job step info */
  170. #define JOBCOND_FLAG_NO_TRUNC 0x00000004 /* Report info. without truncating
  171. * the time to the usage_start and
  172. * usage_end */
  173. #define JOBCOND_FLAG_RUNAWAY 0x00000008 /* Report runaway jobs only */
  174. #define JOBCOND_FLAG_WHOLE_HETJOB 0x00000010 /* Report info about all hetjob
  175. * components
  176. */
  177. #define JOBCOND_FLAG_NO_WHOLE_HETJOB 0x00000020 /* Only report info about
  178. * requested hetjob components
  179. */
  180. #define JOBCOND_FLAG_NO_WAIT 0x00000040 /* Tell dbd plugin not to wait
  181. * around for result.
  182. */
  183. #define JOBCOND_FLAG_NO_DEFAULT_USAGE 0x00000080 /* Use usage_time as the
  184. * submit_time of the job.
  185. */
  186. #define JOBCOND_FLAG_DBD_UID 0x00000100 /* give me the uid from the dbd
  187. * instead of filling it in
  188. * later.
  189. */
  190. /* Archive / Purge time flags */
  191. #define SLURMDB_PURGE_BASE 0x0000ffff /* Apply to get the number
  192. * of units */
  193. #define SLURMDB_PURGE_FLAGS 0xffff0000 /* apply to get the flags */
  194. #define SLURMDB_PURGE_HOURS 0x00010000 /* Purge units are in hours */
  195. #define SLURMDB_PURGE_DAYS 0x00020000 /* Purge units are in days */
  196. #define SLURMDB_PURGE_MONTHS 0x00040000 /* Purge units are in months,
  197. * the default */
  198. #define SLURMDB_PURGE_ARCHIVE 0x00080000 /* Archive before purge */
  199. /* Parent account should be used when calculating FairShare */
  200. #define SLURMDB_FS_USE_PARENT 0x7FFFFFFF
  201. #define SLURMDB_CLASSIFIED_FLAG 0x0100
  202. #define SLURMDB_CLASS_BASE 0x00ff
  203. /* Cluster flags */
  204. #define CLUSTER_FLAG_A1 0x00000001 /* UNUSED */
  205. #define CLUSTER_FLAG_A2 0x00000002 /* UNUSED */
  206. #define CLUSTER_FLAG_A3 0x00000004 /* UNUSED */
  207. #define CLUSTER_FLAG_A4 0x00000008 /* UNUSED */
  208. #define CLUSTER_FLAG_A5 0x00000010 /* UNUSED */
  209. #define CLUSTER_FLAG_A6 0x00000020 /* UNUSED */
  210. #define CLUSTER_FLAG_A7 0x00000040 /* UNUSED */
  211. #define CLUSTER_FLAG_MULTSD 0x00000080 /* This cluster is multiple slurmd */
  212. #define CLUSTER_FLAG_CRAYXT 0x00000100 /* This cluster is a ALPS cray
  213. * Removed v19.05 */
  214. #define CLUSTER_FLAG_CRAY_A 0x00000100 /* This cluster is a ALPS cray
  215. * Removed v19.05 */
  216. #define CLUSTER_FLAG_FE 0x00000200 /* This cluster is a front end system */
  217. #define CLUSTER_FLAG_CRAY_N 0x00000400 /* This cluster is a Native cray */
  218. #define CLUSTER_FLAG_FED 0x00000800 /* This cluster is in a federation. */
  219. #define CLUSTER_FLAG_EXT 0x00001000 /* This cluster is external */
  220. /* Cluster Combo flags */
  221. #define CLUSTER_FLAG_CRAY 0x00000500 /* This cluster is a cray.
  222. Combo of CRAY_A | CRAY_N */
  223. /********************************************/
  224. /* Association conditions used for queries of the database */
  225. /* slurmdb_tres_rec_t is used in other structures below so this needs
  226. * to be declared before hand.
  227. */
  228. typedef struct {
  229. uint64_t alloc_secs; /* total amount of secs allocated if used in an
  230. accounting_list */
  231. uint32_t rec_count; /* number of records alloc_secs is, DON'T PACK */
  232. uint64_t count; /* Count of TRES on a given cluster, 0 if
  233. * listed generically. */
  234. uint32_t id; /* Database ID for the TRES */
  235. char *name; /* Name of TRES if type is generic like GRES
  236. * or License. Make include optional GRES type
  237. * (e.g. "gpu" or "gpu:tesla") */
  238. char *type; /* Type of TRES (CPU, MEM, etc) */
  239. } slurmdb_tres_rec_t;
  240. /* slurmdb_assoc_cond_t is used in other structures below so
  241. * this needs to be declared first.
  242. */
  243. typedef struct {
  244. List acct_list; /* list of char * */
  245. List cluster_list; /* list of char * */
  246. List def_qos_id_list; /* list of char * */
  247. List format_list; /* list of char * */
  248. List id_list; /* list of char */
  249. uint16_t only_defs; /* only send back defaults */
  250. List parent_acct_list; /* name of parent account */
  251. List partition_list; /* list of char * */
  252. List qos_list; /* list of char * */
  253. time_t usage_end;
  254. time_t usage_start;
  255. List user_list; /* list of char * */
  256. uint16_t with_usage; /* fill in usage */
  257. uint16_t with_deleted; /* return deleted associations */
  258. uint16_t with_raw_qos; /* return a raw qos or delta_qos */
  259. uint16_t with_sub_accts; /* return sub acct information also */
  260. uint16_t without_parent_info; /* don't give me parent id/name */
  261. uint16_t without_parent_limits; /* don't give me limits from
  262. * parents */
  263. } slurmdb_assoc_cond_t;
  264. /* slurmdb_job_cond_t is used by slurmdb_archive_cond_t so it needs to
  265. * be defined before hand.
  266. */
  267. typedef struct {
  268. List acct_list; /* list of char * */
  269. List associd_list; /* list of char */
  270. List cluster_list; /* list of char * */
  271. List constraint_list; /* list of char * */
  272. uint32_t cpus_max; /* number of cpus high range */
  273. uint32_t cpus_min; /* number of cpus low range */
  274. uint32_t db_flags; /* flags sent from the slurmctld on the job */
  275. int32_t exitcode; /* exit code of job */
  276. uint32_t flags; /* Reporting flags*/
  277. List format_list; /* list of char * */
  278. List groupid_list; /* list of char * */
  279. List jobname_list; /* list of char * */
  280. uint32_t nodes_max; /* number of nodes high range */
  281. uint32_t nodes_min; /* number of nodes low range */
  282. List partition_list; /* list of char * */
  283. List qos_list; /* list of char * */
  284. List reason_list; /* list of char * */
  285. List resv_list; /* list of char * */
  286. List resvid_list; /* list of char * */
  287. List state_list; /* list of char * */
  288. List step_list; /* list of slurmdb_selected_step_t */
  289. uint32_t timelimit_max; /* max timelimit */
  290. uint32_t timelimit_min; /* min timelimit */
  291. time_t usage_end;
  292. time_t usage_start;
  293. char *used_nodes; /* a ranged node string where jobs ran */
  294. List userid_list; /* list of char * */
  295. List wckey_list; /* list of char * */
  296. } slurmdb_job_cond_t;
  297. /* slurmdb_stats_t needs to be defined before slurmdb_job_rec_t and
  298. * slurmdb_step_rec_t.
  299. */
  300. typedef struct {
  301. double act_cpufreq; /* contains actual average cpu frequency */
  302. uint64_t consumed_energy; /* contains energy consumption in joules */
  303. char *tres_usage_in_ave; /* average amount of usage in data */
  304. char *tres_usage_in_max; /* contains max amount of usage in data */
  305. char *tres_usage_in_max_nodeid; /* contains node number max was on */
  306. char *tres_usage_in_max_taskid; /* contains task number max was on */
  307. char *tres_usage_in_min; /* contains min amount of usage in data */
  308. char *tres_usage_in_min_nodeid; /* contains node number min was on */
  309. char *tres_usage_in_min_taskid; /* contains task number min was on */
  310. char *tres_usage_in_tot; /* total amount of usage in data */
  311. char *tres_usage_out_ave; /* average amount of usage out data */
  312. char *tres_usage_out_max; /* contains amount of max usage out data */
  313. char *tres_usage_out_max_nodeid; /* contains node number max was on */
  314. char *tres_usage_out_max_taskid; /* contains task number max was on */
  315. char *tres_usage_out_min; /* contains amount of min usage out data */
  316. char *tres_usage_out_min_nodeid; /* contains node number min was on */
  317. char *tres_usage_out_min_taskid; /* contains task number min was on */
  318. char *tres_usage_out_tot; /* total amount of usage out data */
  319. } slurmdb_stats_t;
  320. /************** alphabetical order of structures **************/
  321. typedef struct {
  322. slurmdb_assoc_cond_t *assoc_cond;/* use acct_list here for
  323. names */
  324. List description_list; /* list of char * */
  325. List organization_list; /* list of char * */
  326. uint16_t with_assocs;
  327. uint16_t with_coords;
  328. uint16_t with_deleted;
  329. } slurmdb_account_cond_t;
  330. typedef struct {
  331. List assoc_list; /* list of slurmdb_assoc_rec_t *'s */
  332. List coordinators; /* list of slurmdb_coord_rec_t *'s */
  333. char *description;
  334. char *name;
  335. char *organization;
  336. } slurmdb_account_rec_t;
  337. typedef struct {
  338. uint64_t alloc_secs; /* number of cpu seconds allocated */
  339. uint32_t id; /* association/wckey ID */
  340. time_t period_start; /* when this record was started */
  341. slurmdb_tres_rec_t tres_rec;
  342. } slurmdb_accounting_rec_t;
  343. typedef struct {
  344. char *archive_dir; /* location to place archive file */
  345. char *archive_script; /* script to run instead of default
  346. actions */
  347. slurmdb_job_cond_t *job_cond; /* conditions for the jobs to archive */
  348. uint32_t purge_event; /* purge events older than this in
  349. * months by default set the
  350. * SLURMDB_PURGE_ARCHIVE bit for
  351. * archiving */
  352. uint32_t purge_job; /* purge jobs older than this in months
  353. * by default set the
  354. * SLURMDB_PURGE_ARCHIVE bit for
  355. * archiving */
  356. uint32_t purge_resv; /* purge reservations older than this in months
  357. * by default set the
  358. * SLURMDB_PURGE_ARCHIVE bit for
  359. * archiving */
  360. uint32_t purge_step; /* purge steps older than this in months
  361. * by default set the
  362. * SLURMDB_PURGE_ARCHIVE bit for
  363. * archiving */
  364. uint32_t purge_suspend; /* purge suspend data older than this
  365. * in months by default set the
  366. * SLURMDB_PURGE_ARCHIVE bit for
  367. * archiving */
  368. uint32_t purge_txn; /* purge transaction data older than this
  369. * in months by default set the
  370. * SLURMDB_PURGE_ARCHIVE bit for
  371. * archiving */
  372. uint32_t purge_usage; /* purge usage data older than this
  373. * in months by default set the
  374. * SLURMDB_PURGE_ARCHIVE bit for
  375. * archiving */
  376. } slurmdb_archive_cond_t;
  377. typedef struct {
  378. char *archive_file; /* archive file containing data that was
  379. once flushed from the database */
  380. char *insert; /* an sql statement to be ran containing the
  381. insert of jobs since past */
  382. } slurmdb_archive_rec_t;
  383. typedef struct {
  384. uint64_t count; /* Count of tres on a given cluster, 0 if
  385. listed generically. */
  386. List format_list;/* list of char * */
  387. List id_list; /* Database ID */
  388. List name_list; /* Name of tres if type is generic like GRES
  389. or License. */
  390. List type_list; /* Type of tres (CPU, MEM, etc) */
  391. uint16_t with_deleted;
  392. } slurmdb_tres_cond_t;
  393. /* slurmdb_tres_rec_t is defined above alphabetical */
  394. /* slurmdb_assoc_cond_t is defined above alphabetical */
  395. /* This has slurmdb_assoc_rec_t's in it so we define the struct afterwards. */
  396. typedef struct slurmdb_assoc_usage slurmdb_assoc_usage_t;
  397. typedef struct slurmdb_bf_usage slurmdb_bf_usage_t;
  398. typedef struct slurmdb_user_rec slurmdb_user_rec_t;
  399. typedef struct slurmdb_assoc_rec {
  400. List accounting_list; /* list of slurmdb_accounting_rec_t *'s */
  401. char *acct; /* account/project associated to
  402. * assoc */
  403. struct slurmdb_assoc_rec *assoc_next; /* next assoc with
  404. * same hash index
  405. * based off the
  406. * account/user
  407. * DOESN'T GET PACKED */
  408. struct slurmdb_assoc_rec *assoc_next_id; /* next assoc with
  409. * same hash index
  410. * DOESN'T GET PACKED */
  411. slurmdb_bf_usage_t *bf_usage; /* data for backfill scheduler,
  412. * (DON'T PACK) */
  413. char *cluster; /* cluster associated to association */
  414. uint32_t def_qos_id; /* Which QOS id is this
  415. * associations default */
  416. uint32_t grp_jobs; /* max number of jobs the
  417. * underlying group of associations can run
  418. * at one time */
  419. uint32_t grp_jobs_accrue; /* max number of jobs the
  420. * underlying group of associations can have
  421. * accruing priority at one time */
  422. uint32_t grp_submit_jobs; /* max number of jobs the
  423. * underlying group of
  424. * associations can submit at
  425. * one time */
  426. char *grp_tres; /* max number of cpus the
  427. * underlying group of
  428. * associations can allocate at one time */
  429. uint64_t *grp_tres_ctld; /* grp_tres broken out in an array
  430. * based off the ordering of the total
  431. * number of TRES in the system
  432. * (DON'T PACK) */
  433. char *grp_tres_mins; /* max number of cpu minutes the
  434. * underlying group of
  435. * associations can run for */
  436. uint64_t *grp_tres_mins_ctld; /* grp_tres_mins broken out in an array
  437. * based off the ordering of the total
  438. * number of TRES in the system
  439. * (DON'T PACK) */
  440. char *grp_tres_run_mins; /* max number of cpu minutes the
  441. * underlying group of
  442. * assoiciations can
  443. * having running at one time */
  444. uint64_t *grp_tres_run_mins_ctld; /* grp_tres_run_mins
  445. * broken out in an array
  446. * based off the ordering
  447. * of the total number of TRES in
  448. * the system
  449. * (DON'T PACK) */
  450. uint32_t grp_wall; /* total time in hours the
  451. * underlying group of
  452. * associations can run for */
  453. uint32_t id; /* id identifing a combination of
  454. * user-account-cluster(-partition) */
  455. uint16_t is_def; /* Is this the users default assoc/acct */
  456. uint32_t lft; /* lft used for grouping sub
  457. * associations and jobs as a left
  458. * most container used with rgt */
  459. uint32_t max_jobs; /* max number of jobs this
  460. * association can run at one time */
  461. uint32_t max_jobs_accrue; /* max number of jobs this association can
  462. * have accruing priority time.
  463. */
  464. uint32_t max_submit_jobs; /* max number of jobs that can be
  465. submitted by association */
  466. char *max_tres_mins_pj; /* max number of cpu seconds this
  467. * association can have per job */
  468. uint64_t *max_tres_mins_ctld; /* max_tres_mins broken out in an array
  469. * based off the ordering of the
  470. * total number of TRES in the system
  471. * (DON'T PACK) */
  472. char *max_tres_run_mins; /* max number of cpu minutes this
  473. * association can
  474. * having running at one time */
  475. uint64_t *max_tres_run_mins_ctld; /* max_tres_run_mins
  476. * broken out in an array
  477. * based off the ordering
  478. * of the total number of TRES in
  479. * the system
  480. * (DON'T PACK) */
  481. char *max_tres_pj; /* max number of cpus this
  482. * association can allocate per job */
  483. uint64_t *max_tres_ctld; /* max_tres broken out in an array
  484. * based off the ordering of the
  485. * total number of TRES in the system
  486. * (DON'T PACK) */
  487. char *max_tres_pn; /* max number of TRES this
  488. * association can allocate per node */
  489. uint64_t *max_tres_pn_ctld; /* max_tres_pn broken out in an array
  490. * based off the ordering of the
  491. * total number of TRES in the system
  492. * (DON'T PACK) */
  493. uint32_t max_wall_pj; /* longest time this
  494. * association can run a job */
  495. uint32_t min_prio_thresh; /* Don't reserve resources for pending jobs
  496. * unless they have a priority equal to or
  497. * higher than this. */
  498. char *parent_acct; /* name of parent account */
  499. uint32_t parent_id; /* id of parent account */
  500. char *partition; /* optional partition in a cluster
  501. * associated to association */
  502. uint32_t priority; /* association priority */
  503. List qos_list; /* list of char * */
  504. uint32_t rgt; /* rgt used for grouping sub
  505. * associations and jobs as a right
  506. * most container used with lft */
  507. uint32_t shares_raw; /* number of shares allocated to
  508. * association */
  509. uint32_t uid; /* user ID */
  510. slurmdb_assoc_usage_t *usage;
  511. char *user; /* user associated to assoc */
  512. slurmdb_user_rec_t *user_rec; /* Cache of user record
  513. * soft ref - mem not managed here
  514. * (DON'T PACK)
  515. */
  516. } slurmdb_assoc_rec_t;
  517. struct slurmdb_assoc_usage {
  518. uint32_t accrue_cnt; /* Count of how many jobs I have accuring prio
  519. * (DON'T PACK for state file) */
  520. List children_list; /* list of children associations
  521. * (DON'T PACK) */
  522. bitstr_t *grp_node_bitmap; /* Bitmap of allocated nodes
  523. * (DON'T PACK) */
  524. uint16_t *grp_node_job_cnt; /* Count of jobs allocated on each node
  525. * (DON'T PACK) */
  526. uint64_t *grp_used_tres; /* array of active tres counts
  527. * (DON'T PACK for state file) */
  528. uint64_t *grp_used_tres_run_secs; /* array of running tres secs
  529. * (DON'T PACK for state file) */
  530. double grp_used_wall; /* group count of time used in running jobs */
  531. double fs_factor; /* Fairshare factor. Not used by all algorithms
  532. * (DON'T PACK for state file) */
  533. uint32_t level_shares; /* number of shares on this level of
  534. * the tree (DON'T PACK for state file) */
  535. slurmdb_assoc_rec_t *parent_assoc_ptr; /* ptr to direct
  536. * parent assoc
  537. * set in slurmctld
  538. * (DON'T PACK) */
  539. double priority_norm; /* normalized priority (DON'T PACK for
  540. * state file) */
  541. slurmdb_assoc_rec_t *fs_assoc_ptr; /* ptr to fairshare parent
  542. * assoc if fairshare
  543. * == SLURMDB_FS_USE_PARENT
  544. * set in slurmctld
  545. * (DON'T PACK) */
  546. double shares_norm; /* normalized shares
  547. * (DON'T PACK for state file) */
  548. uint32_t tres_cnt; /* size of the tres arrays,
  549. * (DON'T PACK for state file) */
  550. long double usage_efctv;/* effective, normalized usage
  551. * (DON'T PACK for state file) */
  552. long double usage_norm; /* normalized usage
  553. * (DON'T PACK for state file) */
  554. long double usage_raw; /* measure of TRESBillableUnits usage */
  555. long double *usage_tres_raw; /* measure of each TRES usage */
  556. uint32_t used_jobs; /* count of active jobs
  557. * (DON'T PACK for state file) */
  558. uint32_t used_submit_jobs; /* count of jobs pending or running
  559. * (DON'T PACK for state file) */
  560. /* Currently FAIR_TREE systems are defining data on
  561. * this struct but instead we could keep a void pointer to system
  562. * specific data. This would allow subsystems to define whatever data
  563. * they need without having to modify this struct; it would also save
  564. * space.
  565. */
  566. long double level_fs; /* (FAIR_TREE) Result of fairshare equation
  567. * compared to the association's siblings
  568. * (DON'T PACK for state file) */
  569. bitstr_t *valid_qos; /* qos available for this association
  570. * derived from the qos_list.
  571. * (DON'T PACK for state file) */
  572. };
  573. struct slurmdb_bf_usage {
  574. uint64_t count;
  575. time_t last_sched;
  576. };
  577. typedef struct {
  578. uint16_t classification; /* how this machine is classified */
  579. List cluster_list; /* list of char * */
  580. List federation_list; /* list of char */
  581. uint32_t flags;
  582. List format_list; /* list of char * */
  583. List plugin_id_select_list; /* list of char * */
  584. List rpc_version_list; /* list of char * */
  585. time_t usage_end;
  586. time_t usage_start;
  587. uint16_t with_deleted;
  588. uint16_t with_usage;
  589. } slurmdb_cluster_cond_t;
  590. typedef struct {
  591. List feature_list; /* list of cluster features */
  592. uint32_t id; /* id of cluster in federation */
  593. char *name; /* Federation name */
  594. void *recv; /* slurm_persist_conn_t we recv information about this
  595. * sibling on. (We get this information) */
  596. void *send; /* slurm_persist_conn_t we send information to this
  597. * cluster on. (We set this information) */
  598. uint32_t state; /* state of cluster in federation */
  599. bool sync_recvd; /* true sync jobs from sib has been processed. */
  600. bool sync_sent; /* true after sib sent sync jobs to sibling */
  601. } slurmdb_cluster_fed_t;
  602. struct slurmdb_cluster_rec {
  603. List accounting_list; /* list of slurmdb_cluster_accounting_rec_t *'s */
  604. uint16_t classification; /* how this machine is classified */
  605. time_t comm_fail_time; /* avoid constant error messages. For
  606. * convenience only. DOESN'T GET PACKED */
  607. slurm_addr_t control_addr; /* For convenience only.
  608. * DOESN'T GET PACKED */
  609. char *control_host;
  610. uint32_t control_port;
  611. uint16_t dimensions; /* number of dimensions this cluster is */
  612. int *dim_size; /* For convenience only.
  613. * Size of each dimension For now only on
  614. * a bluegene cluster. DOESN'T GET
  615. * PACKED, is set up in slurmdb_get_info_cluster */
  616. slurmdb_cluster_fed_t fed; /* Federation information */
  617. uint32_t flags; /* set of CLUSTER_FLAG_* */
  618. pthread_mutex_t lock; /* For convenience only. DOESN"T GET PACKED */
  619. char *name;
  620. char *nodes;
  621. uint32_t plugin_id_select; /* id of the select plugin */
  622. slurmdb_assoc_rec_t *root_assoc; /* root assoc for
  623. * cluster */
  624. uint16_t rpc_version; /* version of rpc this cluter is running */
  625. List send_rpc; /* For convenience only. DOESN'T GET PACKED */
  626. char *tres_str; /* comma separated list of TRES */
  627. };
  628. #ifndef __slurmdb_cluster_rec_t_defined
  629. # define __slurmdb_cluster_rec_t_defined
  630. typedef struct slurmdb_cluster_rec slurmdb_cluster_rec_t;
  631. #endif
  632. typedef struct {
  633. uint64_t alloc_secs; /* number of cpu seconds allocated */
  634. uint64_t down_secs; /* number of cpu seconds down */
  635. uint64_t idle_secs; /* number of cpu seconds idle */
  636. uint64_t over_secs; /* number of cpu seconds overcommitted */
  637. uint64_t pdown_secs; /* number of cpu seconds planned down */
  638. time_t period_start; /* when this record was started */
  639. uint64_t resv_secs; /* number of cpu seconds reserved */
  640. slurmdb_tres_rec_t tres_rec;
  641. } slurmdb_cluster_accounting_rec_t;
  642. typedef struct {
  643. char *cluster; /* name of cluster */
  644. uint16_t percent_allowed; /* percentage of total resources
  645. * allowed for this cluster */
  646. } slurmdb_clus_res_rec_t;
  647. typedef struct {
  648. char *name;
  649. uint16_t direct;
  650. } slurmdb_coord_rec_t;
  651. typedef struct {
  652. List cluster_list; /* list of char * */
  653. uint32_t cpus_max; /* number of cpus high range */
  654. uint32_t cpus_min; /* number of cpus low range */
  655. uint16_t event_type; /* type of events (slurmdb_event_type_t),
  656. * default is all */
  657. List format_list; /* list of char * */
  658. char *node_list; /* node list string */
  659. time_t period_end; /* period end of events */
  660. time_t period_start; /* period start of events */
  661. List reason_list; /* list of char * */
  662. List reason_uid_list; /* list of char * */
  663. List state_list; /* list of char * */
  664. } slurmdb_event_cond_t;
  665. typedef struct {
  666. char *cluster; /* Name of associated cluster */
  667. char *cluster_nodes; /* node list in cluster during time
  668. * period (only set in a cluster event) */
  669. uint16_t event_type; /* type of event (slurmdb_event_type_t) */
  670. char *node_name; /* Name of node (only set in a node event) */
  671. time_t period_end; /* End of period */
  672. time_t period_start; /* Start of period */
  673. char *reason; /* reason node is in state during time
  674. period (only set in a node event) */
  675. uint32_t reason_uid; /* uid of that who set the reason */
  676. uint32_t state; /* State of node during time
  677. period (only set in a node event) */
  678. char *tres_str; /* TRES touched by this event */
  679. } slurmdb_event_rec_t;
  680. typedef struct {
  681. List cluster_list; /* list of char * */
  682. List federation_list; /* list of char * */
  683. List format_list; /* list of char * */
  684. uint16_t with_deleted;
  685. } slurmdb_federation_cond_t;
  686. typedef struct {
  687. char *name; /* Name of federation */
  688. uint32_t flags; /* flags to control scheduling on controller */
  689. List cluster_list; /* List of slurmdb_cluster_rec_t *'s */
  690. } slurmdb_federation_rec_t;
  691. /* slurmdb_job_cond_t is defined above alphabetical */
  692. typedef struct {
  693. char *account;
  694. char *admin_comment;
  695. char *alloc_gres;
  696. uint32_t alloc_nodes;
  697. uint32_t array_job_id; /* job_id of a job array or 0 if N/A */
  698. uint32_t array_max_tasks; /* How many tasks of the array can be
  699. running at one time.
  700. */
  701. uint32_t array_task_id; /* task_id of a job array of NO_VAL
  702. * if N/A */
  703. char *array_task_str; /* If pending these are the array
  704. tasks this record represents.
  705. */
  706. uint32_t associd;
  707. char *blockid;
  708. char *cluster;
  709. char *constraints;
  710. uint64_t db_index; /* index in the table */
  711. uint32_t derived_ec;
  712. char *derived_es; /* aka "comment" */
  713. uint32_t elapsed;
  714. time_t eligible;
  715. time_t end;
  716. uint32_t exitcode;
  717. uint32_t flags;
  718. void *first_step_ptr;
  719. uint32_t gid;
  720. uint32_t het_job_id;
  721. uint32_t het_job_offset;
  722. uint32_t jobid;
  723. char *jobname;
  724. uint32_t lft;
  725. char *mcs_label;
  726. char *nodes;
  727. char *partition;
  728. uint32_t priority;
  729. uint32_t qosid;
  730. uint32_t req_cpus;
  731. char *req_gres;
  732. uint64_t req_mem;
  733. uint32_t requid;
  734. uint32_t resvid;
  735. char *resv_name;
  736. uint32_t show_full;
  737. time_t start;
  738. uint32_t state;
  739. uint32_t state_reason_prev;
  740. slurmdb_stats_t stats;
  741. List steps; /* list of slurmdb_step_rec_t *'s */
  742. time_t submit;
  743. uint32_t suspended;
  744. char *system_comment;
  745. uint32_t sys_cpu_sec;
  746. uint32_t sys_cpu_usec;
  747. uint32_t timelimit;
  748. uint32_t tot_cpu_sec;
  749. uint32_t tot_cpu_usec;
  750. uint16_t track_steps;
  751. char *tres_alloc_str;
  752. char *tres_req_str;
  753. uint32_t uid;
  754. char *used_gres;
  755. char *user;
  756. uint32_t user_cpu_sec;
  757. uint32_t user_cpu_usec;
  758. char *wckey;
  759. uint32_t wckeyid;
  760. char *work_dir;
  761. } slurmdb_job_rec_t;
  762. typedef struct {
  763. uint32_t accrue_cnt; /* Count of how many jobs I have accuring prio
  764. * (DON'T PACK for state file) */
  765. List acct_limit_list; /* slurmdb_used_limits_t's (DON'T PACK
  766. * for state file) */
  767. List job_list; /* list of job pointers to submitted/running
  768. jobs (DON'T PACK) */
  769. bitstr_t *grp_node_bitmap; /* Bitmap of allocated nodes
  770. * (DON'T PACK) */
  771. uint16_t *grp_node_job_cnt; /* Count of jobs allocated on each node
  772. * (DON'T PACK) */
  773. uint32_t grp_used_jobs; /* count of active jobs (DON'T PACK
  774. * for state file) */
  775. uint32_t grp_used_submit_jobs; /* count of jobs pending or running
  776. * (DON'T PACK for state file) */
  777. uint64_t *grp_used_tres; /* count of tres in use in this qos
  778. * (DON'T PACK for state file) */
  779. uint64_t *grp_used_tres_run_secs; /* count of running tres secs
  780. * (DON'T PACK for state file) */
  781. double grp_used_wall; /* group count of time (minutes) used in
  782. * running jobs */
  783. double norm_priority;/* normalized priority (DON'T PACK for
  784. * state file) */
  785. uint32_t tres_cnt; /* size of the tres arrays,
  786. * (DON'T PACK for state file) */
  787. long double usage_raw; /* measure of resource usage */
  788. long double *usage_tres_raw; /* measure of each TRES usage */
  789. List user_limit_list; /* slurmdb_used_limits_t's (DON'T PACK
  790. * for state file) */
  791. } slurmdb_qos_usage_t;
  792. typedef struct {
  793. char *description;
  794. uint32_t id;
  795. uint32_t flags; /* flags for various things to enforce or
  796. override other limits */
  797. uint32_t grace_time; /* preemption grace time */
  798. uint32_t grp_jobs_accrue; /* max number of jobs this qos can
  799. * have accruing priority time
  800. */
  801. uint32_t grp_jobs; /* max number of jobs this qos can run
  802. * at one time */
  803. uint32_t grp_submit_jobs; /* max number of jobs this qos can submit at
  804. * one time */
  805. char *grp_tres; /* max number of tres ths qos can
  806. * allocate at one time */
  807. uint64_t *grp_tres_ctld; /* grp_tres broken out in an array
  808. * based off the ordering of the total
  809. * number of TRES in the system
  810. * (DON'T PACK) */
  811. char *grp_tres_mins; /* max number of tres minutes this
  812. * qos can run for */
  813. uint64_t *grp_tres_mins_ctld; /* grp_tres_mins broken out in an array
  814. * based off the ordering of the total
  815. * number of TRES in the system
  816. * (DON'T PACK) */
  817. char *grp_tres_run_mins; /* max number of tres minutes this
  818. * qos can have running at one time */
  819. uint64_t *grp_tres_run_mins_ctld; /* grp_tres_run_mins
  820. * broken out in an array
  821. * based off the ordering
  822. * of the total number of TRES in
  823. * the system
  824. * (DON'T PACK) */
  825. uint32_t grp_wall; /* total time in hours this qos can run for */
  826. uint32_t max_jobs_pa; /* max number of jobs an account can
  827. * run with this qos at one time */
  828. uint32_t max_jobs_pu; /* max number of jobs a user can
  829. * run with this qos at one time */
  830. uint32_t max_jobs_accrue_pa; /* max number of jobs an account can
  831. * have accruing priority time
  832. */
  833. uint32_t max_jobs_accrue_pu; /* max number of jobs a user can
  834. * have accruing priority time
  835. */
  836. uint32_t max_submit_jobs_pa; /* max number of jobs an account can
  837. submit with this qos at once */
  838. uint32_t max_submit_jobs_pu; /* max number of jobs a user can
  839. submit with this qos at once */
  840. char *max_tres_mins_pj; /* max number of tres seconds this
  841. * qos can have per job */
  842. uint64_t *max_tres_mins_pj_ctld; /* max_tres_mins broken out in an array
  843. * based off the ordering of the
  844. * total number of TRES in the system
  845. * (DON'T PACK) */
  846. char *max_tres_pa; /* max number of tres this
  847. * QOS can allocate per account */
  848. uint64_t *max_tres_pa_ctld; /* max_tres_pa broken out in an array
  849. * based off the ordering of the
  850. * total number of TRES in the system
  851. * (DON'T PACK) */
  852. char *max_tres_pj; /* max number of tres this
  853. * qos can allocate per job */
  854. uint64_t *max_tres_pj_ctld; /* max_tres_pj broken out in an array
  855. * based off the ordering of the
  856. * total number of TRES in the system
  857. * (DON'T PACK) */
  858. char *max_tres_pn; /* max number of tres this
  859. * qos can allocate per job */
  860. uint64_t *max_tres_pn_ctld; /* max_tres_pj broken out in an array
  861. * based off the ordering of the
  862. * total number of TRES in the system
  863. * (DON'T PACK) */
  864. char *max_tres_pu; /* max number of tres this
  865. * QOS can allocate per user */
  866. uint64_t *max_tres_pu_ctld; /* max_tres broken out in an array
  867. * based off the ordering of the
  868. * total number of TRES in the system
  869. * (DON'T PACK) */
  870. char *max_tres_run_mins_pa; /* max number of tres minutes this
  871. * qos can having running at one
  872. * time per account, currently
  873. * this doesn't do anything.
  874. */
  875. uint64_t *max_tres_run_mins_pa_ctld; /* max_tres_run_mins_pa
  876. * broken out in an array
  877. * based off the ordering
  878. * of the total number of TRES in
  879. * the system, currently
  880. * this doesn't do anything.
  881. * (DON'T PACK) */
  882. char *max_tres_run_mins_pu; /* max number of tres minutes this
  883. * qos can having running at one
  884. * time, currently this doesn't
  885. * do anything.
  886. */
  887. uint64_t *max_tres_run_mins_pu_ctld; /* max_tres_run_mins_pu
  888. * broken out in an array
  889. * based off the ordering
  890. * of the total number of TRES in
  891. * the system, currently
  892. * this doesn't do anything.
  893. * (DON'T PACK) */
  894. uint32_t max_wall_pj; /* longest time this
  895. * qos can run a job */
  896. uint32_t min_prio_thresh; /* Don't reserve resources for pending jobs
  897. * unless they have a priority equal to or
  898. * higher than this. */
  899. char *min_tres_pj; /* min number of tres a job can
  900. * allocate with this qos */
  901. uint64_t *min_tres_pj_ctld; /* min_tres_pj broken out in an array
  902. * based off the ordering of the
  903. * total number of TRES in the system
  904. * (DON'T PACK) */
  905. char *name;
  906. bitstr_t *preempt_bitstr; /* other qos' this qos can preempt */
  907. List preempt_list; /* list of char *'s only used to add or
  908. * change the other qos' this can preempt,
  909. * when doing a get use the preempt_bitstr */
  910. uint16_t preempt_mode; /* See PREEMPT_MODE_* in slurm/slurm.h */
  911. uint32_t preempt_exempt_time; /* Job run time before becoming
  912. eligible for preemption */
  913. uint32_t priority; /* ranged int needs to be a unint for
  914. * heterogeneous systems */
  915. slurmdb_qos_usage_t *usage; /* For internal use only, DON'T PACK */
  916. double usage_factor; /* factor to apply to usage in this qos */
  917. double usage_thres; /* percent of effective usage of an
  918. association when breached will deny
  919. pending and new jobs */
  920. time_t blocked_until; /* internal use only, DON'T PACK */
  921. } slurmdb_qos_rec_t;
  922. typedef struct {
  923. List description_list; /* list of char * */
  924. List id_list; /* list of char * */
  925. List format_list;/* list of char * */
  926. List name_list; /* list of char * */
  927. uint16_t preempt_mode; /* See PREEMPT_MODE_* in slurm/slurm.h */
  928. uint16_t with_deleted;
  929. } slurmdb_qos_cond_t;
  930. typedef struct {
  931. List cluster_list; /* cluster reservations are on list of
  932. * char * */
  933. uint64_t flags; /* flags for reservation. */
  934. List format_list;/* list of char * */
  935. List id_list; /* ids of reservations. list of char * */
  936. List name_list; /* name of reservations. list of char * */
  937. char *nodes; /* list of nodes in reservation */
  938. time_t time_end; /* end time of reservation */
  939. time_t time_start; /* start time of reservation */
  940. uint16_t with_usage; /* send usage for reservation */
  941. } slurmdb_reservation_cond_t;
  942. typedef struct {
  943. char *assocs; /* comma separated list of associations */
  944. char *cluster; /* cluster reservation is for */
  945. uint64_t flags; /* flags for reservation. */
  946. uint32_t id; /* id of reservation. */
  947. char *name; /* name of reservation */
  948. char *nodes; /* list of nodes in reservation */
  949. char *node_inx; /* node index of nodes in reservation */
  950. time_t time_end; /* end time of reservation */
  951. time_t time_start; /* start time of reservation */
  952. time_t time_start_prev; /* If start time was changed this is
  953. * the pervious start time. Needed
  954. * for accounting */
  955. char *tres_str;
  956. double unused_wall; /* amount of seconds this reservation wasn't used */
  957. List tres_list; /* list of slurmdb_tres_rec_t, only set when
  958. * job usage is requested.
  959. */
  960. } slurmdb_reservation_rec_t;
  961. typedef struct {
  962. uint32_t array_task_id; /* task_id of a job array or NO_VAL */
  963. uint32_t het_job_offset; /* het_job_offset or NO_VAL */
  964. uint32_t jobid;
  965. uint32_t stepid;
  966. } slurmdb_selected_step_t;
  967. typedef struct {
  968. uint32_t elapsed;
  969. time_t end;
  970. int32_t exitcode;
  971. slurmdb_job_rec_t *job_ptr;
  972. uint32_t nnodes;
  973. char *nodes;
  974. uint32_t ntasks;
  975. char *pid_str;
  976. uint32_t req_cpufreq_min;
  977. uint32_t req_cpufreq_max;
  978. uint32_t req_cpufreq_gov;
  979. uint32_t requid;
  980. time_t start;
  981. uint32_t state;
  982. slurmdb_stats_t stats;
  983. uint32_t stepid; /* job's step number */
  984. char *stepname;
  985. uint32_t suspended;
  986. uint32_t sys_cpu_sec;
  987. uint32_t sys_cpu_usec;
  988. uint32_t task_dist;
  989. uint32_t tot_cpu_sec;
  990. uint32_t tot_cpu_usec;
  991. char *tres_alloc_str;
  992. uint32_t user_cpu_sec;
  993. uint32_t user_cpu_usec;
  994. } slurmdb_step_rec_t;
  995. /* slurmdb_stats_t defined above alphabetical */
  996. typedef struct {
  997. List cluster_list; /* list of char * */
  998. List description_list; /* list of char * */
  999. uint32_t flags;
  1000. List format_list;/* list of char * */
  1001. List id_list; /* list of char * */
  1002. List manager_list; /* list of char * */
  1003. List name_list; /* list of char * */
  1004. List percent_list; /* list of char * */
  1005. List server_list; /* list of char * */
  1006. List type_list; /* list of char * */
  1007. uint16_t with_deleted;
  1008. uint16_t with_clusters;
  1009. } slurmdb_res_cond_t;
  1010. typedef struct {
  1011. List clus_res_list; /* list of slurmdb_clus_res_rec_t *'s */
  1012. slurmdb_clus_res_rec_t *clus_res_rec; /* if only one cluster
  1013. being represented */
  1014. uint32_t count; /* count of resources managed on the server */
  1015. char *description;
  1016. uint32_t flags; /* resource attribute flags */
  1017. uint32_t id;
  1018. char *manager; /* resource manager name */
  1019. char *name;
  1020. uint16_t percent_used;
  1021. char *server; /* resource server name */
  1022. uint32_t type; /* resource type */
  1023. } slurmdb_res_rec_t;
  1024. typedef struct {
  1025. List acct_list; /* list of char * */
  1026. List action_list; /* list of char * */
  1027. List actor_list; /* list of char * */
  1028. List cluster_list; /* list of char * */
  1029. List format_list;/* list of char * */
  1030. List id_list; /* list of char * */
  1031. List info_list; /* list of char * */
  1032. List name_list; /* list of char * */
  1033. time_t time_end;
  1034. time_t time_start;
  1035. List user_list; /* list of char * */
  1036. uint16_t with_assoc_info;
  1037. } slurmdb_txn_cond_t;
  1038. typedef struct {
  1039. char *accts;
  1040. uint16_t action;
  1041. char *actor_name;
  1042. char *clusters;
  1043. uint32_t id;
  1044. char *set_info;
  1045. time_t timestamp;
  1046. char *users;
  1047. char *where_query;
  1048. } slurmdb_txn_rec_t;
  1049. /* Right now this is used in the slurmdb_qos_rec_t structure. In the
  1050. * user_limit_list and acct_limit_list. */
  1051. typedef struct {
  1052. uint32_t accrue_cnt; /* count of jobs accruing prio */
  1053. char *acct; /* If limits for an account this is the accounts name */
  1054. uint32_t jobs; /* count of active jobs */
  1055. uint32_t submit_jobs; /* count of jobs pending or running */
  1056. uint64_t *tres; /* array of TRES allocated */
  1057. uint64_t *tres_run_mins; /* array of how many TRES mins are
  1058. * allocated currently, currently this doesn't
  1059. * do anything and isn't set up. */
  1060. bitstr_t *node_bitmap; /* Bitmap of allocated nodes */
  1061. uint16_t *node_job_cnt; /* Count of jobs allocated on each node */
  1062. uint32_t uid; /* If limits for a user this is the users uid */
  1063. } slurmdb_used_limits_t;
  1064. typedef struct {
  1065. uint16_t admin_level; /* really slurmdb_admin_level_t but for
  1066. packing purposes needs to be uint16_t */
  1067. slurmdb_assoc_cond_t *assoc_cond; /* use user_list here for
  1068. names and acct_list for
  1069. default accounts */
  1070. List def_acct_list; /* list of char * (We can't really use
  1071. * the assoc_cond->acct_list for this
  1072. * because then it is impossible for us
  1073. * to tell which accounts are defaults
  1074. * and which ones aren't, especially when
  1075. * dealing with other versions.)*/
  1076. List def_wckey_list; /* list of char * */
  1077. uint16_t with_assocs;
  1078. uint16_t with_coords;
  1079. uint16_t with_deleted;
  1080. uint16_t with_wckeys;
  1081. uint16_t without_defaults;
  1082. } slurmdb_user_cond_t;
  1083. struct slurmdb_user_rec {
  1084. uint16_t admin_level; /* really slurmdb_admin_level_t but for
  1085. packing purposes needs to be uint16_t */
  1086. List assoc_list; /* list of slurmdb_association_rec_t *'s */
  1087. slurmdb_bf_usage_t *bf_usage; /* data for backfill scheduler,
  1088. * (DON'T PACK) */
  1089. List coord_accts; /* list of slurmdb_coord_rec_t *'s */
  1090. char *default_acct;
  1091. char *default_wckey;
  1092. char *name;
  1093. char *old_name;
  1094. uint32_t uid;
  1095. List wckey_list; /* list of slurmdb_wckey_rec_t *'s */
  1096. };
  1097. typedef struct {
  1098. List objects; /* depending on type */
  1099. uint16_t type; /* really slurmdb_update_type_t but for
  1100. * packing purposes needs to be a
  1101. * uint16_t */
  1102. } slurmdb_update_object_t;
  1103. typedef struct {
  1104. List cluster_list; /* list of char * */
  1105. List format_list; /* list of char * */
  1106. List id_list; /* list of char * */
  1107. List name_list; /* list of char * */
  1108. uint16_t only_defs; /* only give me the defaults */
  1109. time_t usage_end;
  1110. time_t usage_start;
  1111. List user_list; /* list of char * */
  1112. uint16_t with_usage; /* fill in usage */
  1113. uint16_t with_deleted; /* return deleted associations */
  1114. } slurmdb_wckey_cond_t;
  1115. typedef struct {
  1116. List accounting_list; /* list of slurmdb_accounting_rec_t *'s */
  1117. char *cluster; /* cluster associated */
  1118. uint32_t id; /* id identifing a combination of
  1119. * user-wckey-cluster */
  1120. uint16_t is_def; /* Is this the users default wckey */
  1121. char *name; /* wckey name */
  1122. uint32_t uid; /* user ID */
  1123. char *user; /* user associated */
  1124. } slurmdb_wckey_rec_t;
  1125. typedef struct {
  1126. char *name;
  1127. char *print_name;
  1128. char *spaces;
  1129. uint16_t user; /* set to 1 if it is a user i.e. if name[0] is
  1130. * '|' */
  1131. } slurmdb_print_tree_t;
  1132. typedef struct {
  1133. slurmdb_assoc_rec_t *assoc;
  1134. char *sort_name;
  1135. List children;
  1136. } slurmdb_hierarchical_rec_t;
  1137. /************** report specific structures **************/
  1138. typedef struct {
  1139. char *acct;
  1140. char *cluster;
  1141. char *parent_acct;
  1142. List tres_list; /* list of slurmdb_tres_rec_t *'s */
  1143. char *user;
  1144. } slurmdb_report_assoc_rec_t;
  1145. typedef struct {
  1146. char *acct;
  1147. List acct_list; /* list of char *'s */
  1148. List assoc_list; /* list of slurmdb_report_assoc_rec_t's */
  1149. char *name;
  1150. List tres_list; /* list of slurmdb_tres_rec_t *'s */
  1151. uid_t uid;
  1152. } slurmdb_report_user_rec_t;
  1153. typedef struct {
  1154. List accounting_list; /* list of slurmdb_accounting_rec_t *'s */
  1155. List assoc_list; /* list of slurmdb_report_assoc_rec_t *'s */
  1156. char *name;
  1157. List tres_list; /* list of slurmdb_tres_rec_t *'s */
  1158. List user_list; /* list of slurmdb_report_user_rec_t *'s */
  1159. } slurmdb_report_cluster_rec_t;
  1160. typedef struct {
  1161. uint32_t count; /* count of jobs */
  1162. List jobs; /* This should be a NULL destroy since we are just
  1163. * putting a pointer to a slurmdb_job_rec_t here
  1164. * not allocating any new memory */
  1165. uint32_t min_size; /* smallest size of job in cpus here 0 if first */
  1166. uint32_t max_size; /* largest size of job in cpus here INFINITE if
  1167. * last */
  1168. List tres_list; /* list of slurmdb_tres_rec_t *'s */
  1169. } slurmdb_report_job_grouping_t;
  1170. typedef struct {
  1171. char *acct; /* account name */
  1172. uint32_t count; /* total count of jobs taken up by this acct */
  1173. List groups; /* containing slurmdb_report_job_grouping_t's*/
  1174. uint32_t lft;
  1175. uint32_t rgt;
  1176. List tres_list; /* list of slurmdb_tres_rec_t *'s */
  1177. } slurmdb_report_acct_grouping_t;
  1178. typedef struct {
  1179. List acct_list; /* containing slurmdb_report_acct_grouping_t's */
  1180. char *cluster; /* cluster name */
  1181. uint32_t count; /* total count of jobs taken up by this cluster */
  1182. List tres_list; /* list of slurmdb_tres_rec_t *'s */
  1183. } slurmdb_report_cluster_grouping_t;
  1184. enum {
  1185. DBD_ROLLUP_HOUR,
  1186. DBD_ROLLUP_DAY,
  1187. DBD_ROLLUP_MONTH,
  1188. DBD_ROLLUP_COUNT
  1189. };
  1190. typedef struct {
  1191. char *cluster_name; /* Cluster name */
  1192. uint16_t count[DBD_ROLLUP_COUNT]; /* How many rollups have
  1193. * happened in time period */
  1194. time_t timestamp[DBD_ROLLUP_COUNT]; /* Timestamps of last rollup. */
  1195. uint64_t time_last[DBD_ROLLUP_COUNT]; /* Last rollup time */
  1196. uint64_t time_max[DBD_ROLLUP_COUNT]; /* What was the longest time
  1197. * for each rollup */
  1198. uint64_t time_total[DBD_ROLLUP_COUNT]; /* Time it took to do each
  1199. * rollup */
  1200. } slurmdb_rollup_stats_t;
  1201. typedef struct {
  1202. uint32_t cnt; /* count of object processed */
  1203. uint32_t id; /* ID of object */
  1204. uint64_t time; /* total usecs this object */
  1205. uint64_t time_ave; /* ave usecs this object (DON'T PACK) */
  1206. } slurmdb_rpc_obj_t;
  1207. typedef struct {
  1208. slurmdb_rollup_stats_t *dbd_rollup_stats;
  1209. List rollup_stats; /* List of Clusters rollup stats */
  1210. List rpc_list; /* list of RPCs sent to the dbd. */
  1211. time_t time_start; /* When we started collecting data */
  1212. List user_list; /* list of users issuing RPCs */
  1213. } slurmdb_stats_rec_t;
  1214. /* global variable for cross cluster communication */
  1215. extern slurmdb_cluster_rec_t *working_cluster_rec;
  1216. /************** account functions **************/
  1217. /*
  1218. * add accounts to accounting system
  1219. * IN: account_list List of slurmdb_account_rec_t *
  1220. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1221. */
  1222. extern int slurmdb_accounts_add(void *db_conn, List acct_list);
  1223. /*
  1224. * get info from the storage
  1225. * IN: slurmdb_account_cond_t *
  1226. * IN: params void *
  1227. * returns List of slurmdb_account_rec_t *
  1228. * note List needs to be freed with slurm_list_destroy() when called
  1229. */
  1230. extern List slurmdb_accounts_get(void *db_conn,
  1231. slurmdb_account_cond_t *acct_cond);
  1232. /*
  1233. * modify existing accounts in the accounting system
  1234. * IN: slurmdb_acct_cond_t *acct_cond
  1235. * IN: slurmdb_account_rec_t *acct
  1236. * RET: List containing (char *'s) else NULL on error
  1237. * note List needs to be freed with slurm_list_destroy() when called
  1238. */
  1239. extern List slurmdb_accounts_modify(void *db_conn,
  1240. slurmdb_account_cond_t *acct_cond,
  1241. slurmdb_account_rec_t *acct);
  1242. /*
  1243. * remove accounts from accounting system
  1244. * IN: slurmdb_account_cond_t *acct_cond
  1245. * RET: List containing (char *'s) else NULL on error
  1246. * note List needs to be freed with slurm_list_destroy() when called
  1247. */
  1248. extern List slurmdb_accounts_remove(void *db_conn,
  1249. slurmdb_account_cond_t *acct_cond);
  1250. /************** archive functions **************/
  1251. /*
  1252. * expire old info from the storage
  1253. */
  1254. extern int slurmdb_archive(void *db_conn, slurmdb_archive_cond_t *arch_cond);
  1255. /*
  1256. * expire old info from the storage
  1257. */
  1258. extern int slurmdb_archive_load(void *db_conn,
  1259. slurmdb_archive_rec_t *arch_rec);
  1260. /************** association functions **************/
  1261. /*
  1262. * add associations to accounting system
  1263. * IN: assoc_list List of slurmdb_assoc_rec_t *
  1264. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1265. */
  1266. extern int slurmdb_associations_add(void *db_conn, List assoc_list);
  1267. /*
  1268. * get info from the storage
  1269. * IN: slurmdb_assoc_cond_t *
  1270. * RET: List of slurmdb_assoc_rec_t *
  1271. * note List needs to be freed with slurm_list_destroy() when called
  1272. */
  1273. extern List slurmdb_associations_get(void *db_conn,
  1274. slurmdb_assoc_cond_t *assoc_cond);
  1275. /*
  1276. * modify existing associations in the accounting system
  1277. * IN: slurmdb_assoc_cond_t *assoc_cond
  1278. * IN: slurmdb_assoc_rec_t *assoc
  1279. * RET: List containing (char *'s) else NULL on error
  1280. * note List needs to be freed with slurm_list_destroy() when called
  1281. */
  1282. extern List slurmdb_associations_modify(void *db_conn,
  1283. slurmdb_assoc_cond_t *assoc_cond,
  1284. slurmdb_assoc_rec_t *assoc);
  1285. /*
  1286. * remove associations from accounting system
  1287. * IN: slurmdb_assoc_cond_t *assoc_cond
  1288. * RET: List containing (char *'s) else NULL on error
  1289. * note List needs to be freed with slurm_list_destroy() when called
  1290. */
  1291. extern List slurmdb_associations_remove(void *db_conn,
  1292. slurmdb_assoc_cond_t *assoc_cond);
  1293. /************** cluster functions **************/
  1294. /*
  1295. * add clusters to accounting system
  1296. * IN: cluster_list List of slurmdb_cluster_rec_t *
  1297. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1298. */
  1299. extern int slurmdb_clusters_add(void *db_conn, List cluster_list);
  1300. /*
  1301. * get info from the storage
  1302. * IN: slurmdb_cluster_cond_t *
  1303. * IN: params void *
  1304. * returns List of slurmdb_cluster_rec_t *
  1305. * note List needs to be freed with slurm_list_destroy() when called
  1306. */
  1307. extern List slurmdb_clusters_get(void *db_conn,
  1308. slurmdb_cluster_cond_t *cluster_cond);
  1309. /*
  1310. * modify existing clusters in the accounting system
  1311. * IN: slurmdb_cluster_cond_t *cluster_cond
  1312. * IN: slurmdb_cluster_rec_t *cluster
  1313. * RET: List containing (char *'s) else NULL on error
  1314. * note List needs to be freed with slurm_list_destroy() when called
  1315. */
  1316. extern List slurmdb_clusters_modify(void *db_conn,
  1317. slurmdb_cluster_cond_t *cluster_cond,
  1318. slurmdb_cluster_rec_t *cluster);
  1319. /*
  1320. * remove clusters from accounting system
  1321. * IN: slurmdb_cluster_cond_t *cluster_cond
  1322. * RET: List containing (char *'s) else NULL on error
  1323. * note List needs to be freed with slurm_list_destroy() when called
  1324. */
  1325. extern List slurmdb_clusters_remove(void *db_conn,
  1326. slurmdb_cluster_cond_t *cluster_cond);
  1327. /************** cluster report functions **************/
  1328. /* report for clusters of account per user
  1329. * IN: slurmdb_assoc_cond_t *assoc_cond
  1330. * RET: List containing (slurmdb_report_cluster_rec_t *'s) else NULL on error
  1331. * note List needs to be freed with slurm_list_destroy() when called
  1332. */
  1333. extern List slurmdb_report_cluster_account_by_user(void *db_conn,
  1334. slurmdb_assoc_cond_t *assoc_cond);
  1335. /* report for clusters of users per account
  1336. * IN: slurmdb_assoc_cond_t *assoc_cond
  1337. * RET: List containing (slurmdb_report_cluster_rec_t *'s) else NULL on error
  1338. * note List needs to be freed with slurm_list_destroy() when called
  1339. */
  1340. extern List slurmdb_report_cluster_user_by_account(void *db_conn,
  1341. slurmdb_assoc_cond_t *assoc_cond);
  1342. /* report for clusters of wckey per user
  1343. * IN: slurmdb_wckey_cond_t *wckey_cond
  1344. * RET: List containing (slurmdb_report_cluster_rec_t *'s) else NULL on error
  1345. * note List needs to be freed with slurm_list_destroy() when called
  1346. */
  1347. extern List slurmdb_report_cluster_wckey_by_user(void *db_conn,
  1348. slurmdb_wckey_cond_t *wckey_cond);
  1349. /* report for clusters of users per wckey
  1350. * IN: slurmdb_wckey_cond_t *wckey_cond
  1351. * RET: List containing (slurmdb_report_cluster_rec_t *'s) else NULL on error
  1352. * note List needs to be freed with slurm_list_destroy() when called
  1353. */
  1354. extern List slurmdb_report_cluster_user_by_wckey(void *db_conn,
  1355. slurmdb_wckey_cond_t *wckey_cond);
  1356. extern List slurmdb_report_job_sizes_grouped_by_account(
  1357. void *db_conn,
  1358. slurmdb_job_cond_t *job_cond,
  1359. List grouping_list,
  1360. bool flat_view,
  1361. bool acct_as_parent);
  1362. extern List slurmdb_report_job_sizes_grouped_by_wckey(void *db_conn,
  1363. slurmdb_job_cond_t *job_cond,
  1364. List grouping_list);
  1365. extern List slurmdb_report_job_sizes_grouped_by_account_then_wckey(
  1366. void *db_conn,
  1367. slurmdb_job_cond_t *job_cond,
  1368. List grouping_list,
  1369. bool flat_view,
  1370. bool acct_as_parent);
  1371. /* report on users with top usage
  1372. * IN: slurmdb_user_cond_t *user_cond
  1373. * IN: group_accounts - Whether or not to group all accounts together
  1374. * for each user. If 0 a separate entry for each
  1375. * user and account reference is displayed.
  1376. * RET: List containing (slurmdb_report_cluster_rec_t *'s) else NULL on error
  1377. * note List needs to be freed with slurm_list_destroy() when called
  1378. */
  1379. extern List slurmdb_report_user_top_usage(void *db_conn,
  1380. slurmdb_user_cond_t *user_cond,
  1381. bool group_accounts);
  1382. /************** connection functions **************/
  1383. /*
  1384. * get a new connection to the slurmdb
  1385. * RET: pointer used to access db
  1386. */
  1387. extern void *slurmdb_connection_get();
  1388. /*
  1389. * get a new connection to the slurmdb
  1390. * OUT: persist_conn_flags - Flags returned from connection if any see
  1391. * slurm_persist_conn.h.
  1392. * RET: pointer used to access db
  1393. */
  1394. extern void *slurmdb_connection_get2(uint16_t *persist_conn_flags);
  1395. /*
  1396. * release connection to the storage unit
  1397. * IN/OUT: void ** pointer returned from
  1398. * slurmdb_connection_get() which will be freed.
  1399. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1400. */
  1401. extern int slurmdb_connection_close(void **db_conn);
  1402. /*
  1403. * commit or rollback changes made without closing connection
  1404. * IN: void * pointer returned from slurmdb_connection_get()
  1405. * IN: bool - true will commit changes false will rollback
  1406. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1407. */
  1408. extern int slurmdb_connection_commit(void *db_conn, bool commit);
  1409. /************** coordinator functions **************/
  1410. /*
  1411. * add users as account coordinators
  1412. * IN: acct_list list of char *'s of names of accounts
  1413. * IN: slurmdb_user_cond_t *user_cond
  1414. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1415. */
  1416. extern int slurmdb_coord_add(void *db_conn,
  1417. List acct_list,
  1418. slurmdb_user_cond_t *user_cond);
  1419. /*
  1420. * remove users from being a coordinator of an account
  1421. * IN: acct_list list of char *'s of names of accounts
  1422. * IN: slurmdb_user_cond_t *user_cond
  1423. * RET: List containing (char *'s) else NULL on error
  1424. * note List needs to be freed with slurm_list_destroy() when called
  1425. */
  1426. extern List slurmdb_coord_remove(void *db_conn, List acct_list,
  1427. slurmdb_user_cond_t *user_cond);
  1428. /*************** Federation functions **************/
  1429. /*
  1430. * add federations to accounting system
  1431. * IN: list List of slurmdb_federation_rec_t *
  1432. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1433. */
  1434. extern int slurmdb_federations_add(void *db_conn, List federation_list);
  1435. /*
  1436. * modify existing federations in the accounting system
  1437. * IN: slurmdb_federation_cond_t *fed_cond
  1438. * IN: slurmdb_federation_rec_t *fed
  1439. * RET: List containing (char *'s) else NULL on error
  1440. */
  1441. extern List slurmdb_federations_modify(void *db_conn,
  1442. slurmdb_federation_cond_t *fed_cond,
  1443. slurmdb_federation_rec_t *fed);
  1444. /*
  1445. * remove federations from accounting system
  1446. * IN: slurmdb_federation_cond_t *fed_cond
  1447. * RET: List containing (char *'s) else NULL on error
  1448. */
  1449. extern List slurmdb_federations_remove(void *db_conn,
  1450. slurmdb_federation_cond_t *fed_cond);
  1451. /*
  1452. * get info from the storage
  1453. * IN: slurmdb_federation_cond_t *
  1454. * RET: List of slurmdb_federation_rec_t *
  1455. * note List needs to be freed when called
  1456. */
  1457. extern List slurmdb_federations_get(void *db_conn,
  1458. slurmdb_federation_cond_t *fed_cond);
  1459. /*************** Job functions **************/
  1460. /*
  1461. * modify existing job in the accounting system
  1462. * IN: slurmdb_job_cond_t *job_cond
  1463. * IN: slurmdb_job_rec_t *job
  1464. * RET: List containing (char *'s) else NULL on error
  1465. */
  1466. extern List slurmdb_job_modify(void *db_conn,
  1467. slurmdb_job_cond_t *job_cond,
  1468. slurmdb_job_rec_t *job);
  1469. /*
  1470. * get info from the storage
  1471. * returns List of slurmdb_job_rec_t *
  1472. * note List needs to be freed with slurm_list_destroy() when called
  1473. */
  1474. extern List slurmdb_jobs_get(void *db_conn, slurmdb_job_cond_t *job_cond);
  1475. /*
  1476. * Fix runaway jobs
  1477. * IN: jobs, a list of all the runaway jobs
  1478. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1479. */
  1480. extern int slurmdb_jobs_fix_runaway(void *db_conn, List jobs);
  1481. /* initialization of job completion logging */
  1482. extern int slurmdb_jobcomp_init(char *jobcomp_loc);
  1483. /* terminate pthreads and free, general clean-up for termination */
  1484. extern int slurmdb_jobcomp_fini(void);
  1485. /*
  1486. * get info from the storage
  1487. * returns List of jobcomp_job_rec_t *
  1488. * note List needs to be freed when called
  1489. */
  1490. extern List slurmdb_jobcomp_jobs_get(slurmdb_job_cond_t *job_cond);
  1491. /************** extra get functions **************/
  1492. /*
  1493. * reconfigure the slurmdbd
  1494. */
  1495. extern int slurmdb_reconfig(void *db_conn);
  1496. /*
  1497. * shutdown the slurmdbd
  1498. */
  1499. extern int slurmdb_shutdown(void *db_conn);
  1500. /*
  1501. * clear the slurmdbd statistics
  1502. */
  1503. extern int slurmdb_clear_stats(void *db_conn);
  1504. /*
  1505. * get the slurmdbd statistics
  1506. * Call slurmdb_destroy_stats_rec() to free stats_pptr
  1507. */
  1508. extern int slurmdb_get_stats(void *db_conn, slurmdb_stats_rec_t **stats_pptr);
  1509. /*
  1510. * get info from the storage
  1511. * RET: List of config_key_pair_t *
  1512. * note List needs to be freed with slurm_list_destroy() when called
  1513. */
  1514. extern List slurmdb_config_get(void *db_conn);
  1515. /*
  1516. * get info from the storage
  1517. * IN: slurmdb_event_cond_t *
  1518. * RET: List of slurmdb_event_rec_t *
  1519. * note List needs to be freed with slurm_list_destroy() when called
  1520. */
  1521. extern List slurmdb_events_get(void *db_conn,
  1522. slurmdb_event_cond_t *event_cond);
  1523. /*
  1524. * get info from the storage
  1525. * IN: slurmdb_assoc_cond_t *
  1526. * RET: List of slurmdb_assoc_rec_t *
  1527. * note List needs to be freed with slurm_list_destroy() when called
  1528. */
  1529. extern List slurmdb_problems_get(void *db_conn,
  1530. slurmdb_assoc_cond_t *assoc_cond);
  1531. /*
  1532. * get info from the storage
  1533. * IN: slurmdb_reservation_cond_t *
  1534. * RET: List of slurmdb_reservation_rec_t *
  1535. * note List needs to be freed with slurm_list_destroy() when called
  1536. */
  1537. extern List slurmdb_reservations_get(void *db_conn,
  1538. slurmdb_reservation_cond_t *resv_cond);
  1539. /*
  1540. * get info from the storage
  1541. * IN: slurmdb_txn_cond_t *
  1542. * RET: List of slurmdb_txn_rec_t *
  1543. * note List needs to be freed with slurm_list_destroy() when called
  1544. */
  1545. extern List slurmdb_txn_get(void *db_conn, slurmdb_txn_cond_t *txn_cond);
  1546. /*
  1547. * Get information about requested cluster(s). Similar to
  1548. * slurmdb_clusters_get, but should be used when setting up the
  1549. * working_cluster_rec. It replaces the plugin_id_select with
  1550. * the position of the id in the select plugin array, as well as sets up the
  1551. * control_addr and dim_size parts of the structure.
  1552. *
  1553. * IN: cluster_names - comma separated string of cluster names
  1554. * RET: List of slurmdb_cluster_rec_t *
  1555. * note List needs to bbe freed with slurm_list_destroy() when called
  1556. */
  1557. extern List slurmdb_get_info_cluster(char *cluster_names);
  1558. /*
  1559. * get the first cluster that will run a job
  1560. * IN: req - description of resource allocation request
  1561. * IN: cluster_names - comma separated string of cluster names
  1562. * OUT: cluster_rec - record of selected cluster or NULL if none found or
  1563. * cluster_names is NULL
  1564. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1565. *
  1566. * Note: Cluster_rec needs to be freed with slurmdb_destroy_cluster_rec() when
  1567. * called
  1568. * Note: The will_runs are not threaded. Currently it relies on the
  1569. * working_cluster_rec to pack the job_desc's jobinfo. See previous commit for
  1570. * an example of how to thread this.
  1571. */
  1572. extern int slurmdb_get_first_avail_cluster(job_desc_msg_t *req,
  1573. char *cluster_names,
  1574. slurmdb_cluster_rec_t **cluster_rec);
  1575. /*
  1576. * get the first cluster that will run a heterogeneous job
  1577. * IN: req - description of resource allocation request
  1578. * IN: cluster_names - comma separated string of cluster names
  1579. * OUT: cluster_rec - record of selected cluster or NULL if none found or
  1580. * cluster_names is NULL
  1581. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1582. *
  1583. * Note: Cluster_rec needs to be freed with slurmdb_destroy_cluster_rec() when
  1584. * called
  1585. * Note: The will_runs are not threaded. Currently it relies on the
  1586. * working_cluster_rec to pack the job_desc's jobinfo. See previous commit for
  1587. * an example of how to thread this.
  1588. */
  1589. extern int slurmdb_get_first_het_job_cluster(List job_req_list,
  1590. char *cluster_names, slurmdb_cluster_rec_t **cluster_rec);
  1591. /************** helper functions **************/
  1592. extern void slurmdb_destroy_assoc_usage(void *object);
  1593. extern void slurmdb_destroy_bf_usage(void *object);
  1594. extern void slurmdb_destroy_bf_usage_members(void *object);
  1595. extern void slurmdb_destroy_qos_usage(void *object);
  1596. extern void slurmdb_destroy_user_rec(void *object);
  1597. extern void slurmdb_destroy_account_rec(void *object);
  1598. extern void slurmdb_destroy_coord_rec(void *object);
  1599. extern void slurmdb_destroy_clus_res_rec(void *object);
  1600. extern void slurmdb_destroy_cluster_accounting_rec(void *object);
  1601. extern void slurmdb_destroy_cluster_rec(void *object);
  1602. extern void slurmdb_destroy_federation_rec(void *object);
  1603. extern void slurmdb_destroy_accounting_rec(void *object);
  1604. extern void slurmdb_free_assoc_mgr_state_msg(void *object);
  1605. extern void slurmdb_free_assoc_rec_members(slurmdb_assoc_rec_t *assoc);
  1606. extern void slurmdb_destroy_assoc_rec(void *object);
  1607. extern void slurmdb_destroy_event_rec(void *object);
  1608. extern void slurmdb_destroy_job_rec(void *object);
  1609. extern void slurmdb_free_qos_rec_members(slurmdb_qos_rec_t *qos);
  1610. extern void slurmdb_destroy_qos_rec(void *object);
  1611. extern void slurmdb_destroy_reservation_rec(void *object);
  1612. extern void slurmdb_destroy_step_rec(void *object);
  1613. extern void slurmdb_destroy_res_rec(void *object);
  1614. extern void slurmdb_destroy_txn_rec(void *object);
  1615. extern void slurmdb_destroy_wckey_rec(void *object);
  1616. extern void slurmdb_destroy_archive_rec(void *object);
  1617. extern void slurmdb_destroy_tres_rec_noalloc(void *object);
  1618. extern void slurmdb_destroy_tres_rec(void *object);
  1619. extern void slurmdb_destroy_report_assoc_rec(void *object);
  1620. extern void slurmdb_destroy_report_user_rec(void *object);
  1621. extern void slurmdb_destroy_report_cluster_rec(void *object);
  1622. extern void slurmdb_destroy_user_cond(void *object);
  1623. extern void slurmdb_destroy_account_cond(void *object);
  1624. extern void slurmdb_destroy_cluster_cond(void *object);
  1625. extern void slurmdb_destroy_federation_cond(void *object);
  1626. extern void slurmdb_destroy_tres_cond(void *object);
  1627. extern void slurmdb_destroy_assoc_cond(void *object);
  1628. extern void slurmdb_destroy_event_cond(void *object);
  1629. extern void slurmdb_destroy_job_cond(void *object);
  1630. extern void slurmdb_destroy_qos_cond(void *object);
  1631. extern void slurmdb_destroy_reservation_cond(void *object);
  1632. extern void slurmdb_destroy_res_cond(void *object);
  1633. extern void slurmdb_destroy_txn_cond(void *object);
  1634. extern void slurmdb_destroy_wckey_cond(void *object);
  1635. extern void slurmdb_destroy_archive_cond(void *object);
  1636. extern void slurmdb_destroy_update_object(void *object);
  1637. extern void slurmdb_destroy_used_limits(void *object);
  1638. extern void slurmdb_destroy_print_tree(void *object);
  1639. extern void slurmdb_destroy_hierarchical_rec(void *object);
  1640. extern void slurmdb_destroy_selected_step(void *object);
  1641. extern void slurmdb_destroy_report_job_grouping(void *object);
  1642. extern void slurmdb_destroy_report_acct_grouping(void *object);
  1643. extern void slurmdb_destroy_report_cluster_grouping(void *object);
  1644. extern void slurmdb_destroy_rpc_obj(void *object);
  1645. extern void slurmdb_destroy_rollup_stats(void *object);
  1646. extern void slurmdb_free_stats_rec_members(void *object);
  1647. extern void slurmdb_destroy_stats_rec(void *object);
  1648. extern void slurmdb_free_slurmdb_stats_members(slurmdb_stats_t *stats);
  1649. extern void slurmdb_destroy_slurmdb_stats(slurmdb_stats_t *stats);
  1650. extern void slurmdb_init_assoc_rec(slurmdb_assoc_rec_t *assoc,
  1651. bool free_it);
  1652. extern void slurmdb_init_clus_res_rec(slurmdb_clus_res_rec_t *clus_res,
  1653. bool free_it);
  1654. extern void slurmdb_init_cluster_rec(slurmdb_cluster_rec_t *cluster,
  1655. bool free_it);
  1656. extern void slurmdb_init_federation_rec(slurmdb_federation_rec_t *federation,
  1657. bool free_it);
  1658. extern void slurmdb_init_qos_rec(slurmdb_qos_rec_t *qos,
  1659. bool free_it,
  1660. uint32_t init_val);
  1661. extern void slurmdb_init_res_rec(slurmdb_res_rec_t *res,
  1662. bool free_it);
  1663. extern void slurmdb_init_wckey_rec(slurmdb_wckey_rec_t *wckey,
  1664. bool free_it);
  1665. extern void slurmdb_init_tres_cond(slurmdb_tres_cond_t *tres,
  1666. bool free_it);
  1667. extern void slurmdb_init_cluster_cond(slurmdb_cluster_cond_t *cluster,
  1668. bool free_it);
  1669. extern void slurmdb_init_federation_cond(slurmdb_federation_cond_t *federation,
  1670. bool free_it);
  1671. extern void slurmdb_init_res_cond(slurmdb_res_cond_t *cluster,
  1672. bool free_it);
  1673. /* The next two functions have pointers to assoc_list so do not
  1674. * destroy assoc_list before using the list returned from this function.
  1675. */
  1676. extern List slurmdb_get_hierarchical_sorted_assoc_list(
  1677. List assoc_list, bool use_lft);
  1678. extern List slurmdb_get_acct_hierarchical_rec_list(List assoc_list);
  1679. /* IN/OUT: tree_list a list of slurmdb_print_tree_t's */
  1680. extern char *slurmdb_tree_name_get(char *name, char *parent, List tree_list);
  1681. /************** job report functions **************/
  1682. /************** resource functions **************/
  1683. /*
  1684. * add resource's to accounting system
  1685. * IN: res_list List of char *
  1686. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1687. */
  1688. extern int slurmdb_res_add(void *db_conn, List res_list);
  1689. /*
  1690. * get info from the storage
  1691. * IN: slurmdb_res_cond_t *
  1692. * RET: List of slurmdb_res_rec_t *
  1693. * note List needs to be freed with slurm_list_destroy() when called
  1694. */
  1695. extern List slurmdb_res_get(void *db_conn, slurmdb_res_cond_t *res_cond);
  1696. /*
  1697. * modify existing resource in the accounting system
  1698. * IN: slurmdb_res_cond_t *res_cond
  1699. * IN: slurmdb_res_rec_t *res
  1700. * RET: List containing (char *'s) else NULL on error
  1701. * note List needs to be freed with slurm_list_destroy() when called
  1702. */
  1703. extern List slurmdb_res_modify(void *db_conn,
  1704. slurmdb_res_cond_t *res_cond,
  1705. slurmdb_res_rec_t *res);
  1706. /*
  1707. * remove resource from accounting system
  1708. * IN: slurmdb_res_cond_t *res
  1709. * RET: List containing (char *'s) else NULL on error
  1710. * note List needs to be freed with slurm_list_destroy() when called
  1711. */
  1712. extern List slurmdb_res_remove(void *db_conn, slurmdb_res_cond_t *res_cond);
  1713. /************** qos functions **************/
  1714. /*
  1715. * add qos's to accounting system
  1716. * IN: qos_list List of char *
  1717. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1718. */
  1719. extern int slurmdb_qos_add(void *db_conn, List qos_list);
  1720. /*
  1721. * get info from the storage
  1722. * IN: slurmdb_qos_cond_t *
  1723. * RET: List of slurmdb_qos_rec_t *
  1724. * note List needs to be freed with slurm_list_destroy() when called
  1725. */
  1726. extern List slurmdb_qos_get(void *db_conn, slurmdb_qos_cond_t *qos_cond);
  1727. /*
  1728. * modify existing qos in the accounting system
  1729. * IN: slurmdb_qos_cond_t *qos_cond
  1730. * IN: slurmdb_qos_rec_t *qos
  1731. * RET: List containing (char *'s) else NULL on error
  1732. * note List needs to be freed with slurm_list_destroy() when called
  1733. */
  1734. extern List slurmdb_qos_modify(void *db_conn,
  1735. slurmdb_qos_cond_t *qos_cond,
  1736. slurmdb_qos_rec_t *qos);
  1737. /*
  1738. * remove qos from accounting system
  1739. * IN: slurmdb_qos_cond_t *assoc_qos
  1740. * RET: List containing (char *'s) else NULL on error
  1741. * note List needs to be freed with slurm_list_destroy() when called
  1742. */
  1743. extern List slurmdb_qos_remove(void *db_conn, slurmdb_qos_cond_t *qos_cond);
  1744. /************** tres functions **************/
  1745. /*
  1746. * add tres's to accounting system
  1747. * IN: tres_list List of char *
  1748. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1749. */
  1750. extern int slurmdb_tres_add(void *db_conn, List tres_list);
  1751. /*
  1752. * get info from the storage
  1753. * IN: slurmdb_tres_cond_t *
  1754. * RET: List of slurmdb_tres_rec_t *
  1755. * note List needs to be freed with slurm_list_destroy() when called
  1756. */
  1757. extern List slurmdb_tres_get(void *db_conn, slurmdb_tres_cond_t *tres_cond);
  1758. /************** usage functions **************/
  1759. /*
  1760. * get info from the storage
  1761. * IN/OUT: in void * (slurmdb_assoc_rec_t *) or
  1762. * (slurmdb_wckey_rec_t *) of (slurmdb_cluster_rec_t *) with
  1763. * the id, and cluster set.
  1764. * IN: type what type is 'in'
  1765. * IN: start time stamp for records >=
  1766. * IN: end time stamp for records <=
  1767. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1768. */
  1769. extern int slurmdb_usage_get(void *db_conn,
  1770. void *in,
  1771. int type,
  1772. time_t start,
  1773. time_t end);
  1774. /*
  1775. * roll up data in the storage
  1776. * IN: sent_start (option time to do a re-roll or start from this point)
  1777. * IN: sent_end (option time to do a re-roll or end at this point)
  1778. * IN: archive_data (if 0 old data is not archived in a monthly rollup)
  1779. * OUT: rollup_stats_list_in (list containing stats about each clusters rollup)
  1780. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1781. */
  1782. extern int slurmdb_usage_roll(void *db_conn,
  1783. time_t sent_start,
  1784. time_t sent_end,
  1785. uint16_t archive_data,
  1786. List *rollup_stats_list_in);
  1787. /************** user functions **************/
  1788. /*
  1789. * add users to accounting system
  1790. * IN: user_list List of slurmdb_user_rec_t *
  1791. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1792. */
  1793. extern int slurmdb_users_add(void *db_conn, List user_list);
  1794. /*
  1795. * get info from the storage
  1796. * IN: slurmdb_user_cond_t *
  1797. * IN: params void *
  1798. * returns List of slurmdb_user_rec_t *
  1799. * note List needs to be freed with slurm_list_destroy() when called
  1800. */
  1801. extern List slurmdb_users_get(void *db_conn, slurmdb_user_cond_t *user_cond);
  1802. /*
  1803. * modify existing users in the accounting system
  1804. * IN: slurmdb_user_cond_t *user_cond
  1805. * IN: slurmdb_user_rec_t *user
  1806. * RET: List containing (char *'s) else NULL on error
  1807. * note List needs to be freed with slurm_list_destroy() when called
  1808. */
  1809. extern List slurmdb_users_modify(void *db_conn,
  1810. slurmdb_user_cond_t *user_cond,
  1811. slurmdb_user_rec_t *user);
  1812. /*
  1813. * remove users from accounting system
  1814. * IN: slurmdb_user_cond_t *user_cond
  1815. * RET: List containing (char *'s) else NULL on error
  1816. * note List needs to be freed with slurm_list_destroy() when called
  1817. */
  1818. extern List slurmdb_users_remove(void *db_conn,
  1819. slurmdb_user_cond_t *user_cond);
  1820. /************** user report functions **************/
  1821. /************** wckey functions **************/
  1822. /*
  1823. * add wckey's to accounting system
  1824. * IN: wckey_list List of slurmdb_wckey_rec_t *
  1825. * RET: SLURM_SUCCESS on success SLURM_ERROR else
  1826. */
  1827. extern int slurmdb_wckeys_add(void *db_conn, List wckey_list);
  1828. /*
  1829. * get info from the storage
  1830. * IN: slurmdb_wckey_cond_t *
  1831. * RET: List of slurmdb_wckey_rec_t *
  1832. * note List needs to be freed with slurm_list_destroy() when called
  1833. */
  1834. extern List slurmdb_wckeys_get(void *db_conn,
  1835. slurmdb_wckey_cond_t *wckey_cond);
  1836. /*
  1837. * modify existing wckey in the accounting system
  1838. * IN: slurmdb_wckey_cond_t *wckey_cond
  1839. * IN: slurmdb_wckey_rec_t *wckey
  1840. * RET: List containing (char *'s) else NULL on error
  1841. * note List needs to be freed with slurm_list_destroy() when called
  1842. */
  1843. extern List slurmdb_wckeys_modify(void *db_conn,
  1844. slurmdb_wckey_cond_t *wckey_cond,
  1845. slurmdb_wckey_rec_t *wckey);
  1846. /*
  1847. * remove wckey from accounting system
  1848. * IN: slurmdb_wckey_cond_t *assoc_wckey
  1849. * RET: List containing (char *'s) else NULL on error
  1850. * note List needs to be freed with slurm_list_destroy() when called
  1851. */
  1852. extern List slurmdb_wckeys_remove(void *db_conn,
  1853. slurmdb_wckey_cond_t *wckey_cond);
  1854. #ifdef __cplusplus
  1855. }
  1856. #endif
  1857. #endif /* !_SLURMDB_H */