File: api.shtml

package info (click to toggle)
slurm-wlm 22.05.8-4%2Bdeb12u3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 48,492 kB
  • sloc: ansic: 475,246; exp: 69,020; sh: 8,862; javascript: 6,528; python: 6,444; makefile: 4,185; perl: 4,069; pascal: 131
file content (300 lines) | stat: -rw-r--r-- 9,314 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!--#include virtual="header.txt"-->

<h1><a name="top">Slurm APIs</a></h1>

<h3 id="overview">Overview<a class="slurm_link" href="#overview"></a></h3>
<p>All of the Slurm commands utilize a collection of Application Programming
Interfaces (APIs).
User and system applications can directly use these APIs as desired to
achieve tighter integration with Slurm.
For example, Slurm data structures and error codes can be directly
examined rather than executing Slurm commands and parsing their output.
This document describes Slurm APIs.
You should see the man pages for individual APIs to get more details.</p>

<h3 id="overall">Get Overall Slurm Information
<a class="slurm_link" href="#overall"></a>
</h3>
<ul>

<li><b>slurm_api_version</b> &mdash; Get Slurm API version number.</li>

<li><b>slurm_load_ctl_conf</b> &mdash; Load system-wide configuration
specifications. Free with <i>slurm_free_ctl_conf</i> to avoid memory
leak.</li>

<li><b>slurm_print_ctl_conf</b> &mdash; Print system-wide configuration
specifications.</li>

<li><b>slurm_free_ctl_conf</b> &mdash; Free storage allocated by
<i>slurm_load_ctl_conf</i>.</li>

</ul>


<h3 id="job">Get Job Information<a class="slurm_link" href="#job"></a></h3>
<ul>

<li><b>slurm_pid2jobid</b> &mdash; For a given process ID on a node
get the corresponding Slurm job ID.</li>

<li><b>slurm_get_end_time</b> &mdash; For a given Slurm job ID
get the expected termination time.</li>

<li><b>slurm_load_jobs</b> &mdash; Load job information.
Free with <i>slurm_free_job_info_msg</i> to avoid memory leak.</li>

<li><b>slurm_print_job_info_msg</b> &mdash; Print information about
all jobs.</li>

<li><b>slurm_print_job_info</b> &mdash; Print information about
a specific job.</li>

<li><b>slurm_free_job_info_msg</b> &mdash; Free storage allocated by
<i>slurm_load_jobs</i>.</li>

</ul>


<h3 id="step">Get Job Step Information
<a class="slurm_link" href="#step"></a>
</h3>
<ul>

<li><b>slurm_get_job_steps</b> &mdash; Load job step information.
Free with <i>slurm_free_job_step_info_response_msg</i> to
avoid memory leak.</li>

<li><b>slurm_print_job_step_info_msg</b> &mdash; Print information about
all job steps.</li>

<li><b>slurm_print_job_step_info</b> &mdash; Print information about
a specific job step.</li>

<li><b>slurm_free_job_step_info_response_msg</b> &mdash; Free storage
allocated by <i>slurm_get_job_steps</i>.</li>

</ul>


<h3 id="node">Get Node Information<a class="slurm_link" href="#node"></a></h3>
<ul>

<li><b>slurm_load_node</b> &mdash; Load node information.
Free with <i>slurm_free_node_info</i> to avoid memory leak.</li>

<li><b>slurm_print_node_info_msg</b> &mdash; Print information about
all nodes.</li>

<li><b>slurm_print_node_table</b> &mdash; Print information about
a specific node.</li>

<li><b>slurm_free_node_info</b> &mdash; Free storage
allocated by <i>slurm_load_node</i>.</li>

</ul>


<h3 id="partition">Get Partition Information
<a class="slurm_link" href="#partition"></a>
</h3>
<ul>

<li><b>slurm_load_partitions</b> &mdash; Load partition (queue) information.
Free with <i>slurm_free_partition_info</i> to avoid memory leak.</li>

<li><b>slurm_print_partition_info_msg</b> &mdash; Print information about
all partitions.</li>

<li><b>slurm_print_partition_info</b> &mdash; Print information about
a specific partition.</li>

<li><b>slurm_free_partition_info</b> &mdash; Free storage
allocated by <i>slurm_load_partitions</i>.</li>

</ul>


<h3 id="error">Error Handling<a class="slurm_link" href="#error"></a></h3>
<ul>

<li><b>slurm_get_errno</b> &mdash; Return the error code set by the
last Slurm API function executed.</li>

<li><b>slurm_perror</b> &mdash; Prin. Slurm error information to
standard output.</li>

<li><b>slurm_strerror</b> &mdash; Return a string describing a specific
Slurm error code.</li>

</ul>


<h3 id="resource_alloc">Resource Allocation
<a class="slurm_link" href="#resource_alloc"></a>
</h3>
<ul>

<li><b>slurm_init_job_desc_msg</b> &mdash; Initialize the data structure
used in resource allocation requests. You can then just set the fields
of particular interest and let the others use default values.</li>

<li><b>slurm_job_will_run</b> &mdash; Determine if a job would be
immediately initiated if submitted now.</li>

<li><b>slurm_allocate_resources</b> &mdash; Allocate resources for a job.
Response message must be freed using
<i>slurm_free_resource_allocation_response_msg</i> to avoid a
memory leak.</li>

<li><b>slurm_free_resource_allocation_response_msg</b> &mdash;
Frees memory allocated by <i>slurm_allocate_resources</i>.</li>

<li><b>slurm_allocate_resources_and_run</b> &mdash; Allocate resources for a
job and spawn a job step. Response message must be freed using
<i>slurm_free_resource_allocation_and_run_response_msg</i> to avoid a
memory leak.</li>

<li><b>slurm_free_resource_allocation_and_run_response_msg</b> &mdash;
Frees memory allocated by <i>slurm_allocate_resources_and_run</i>.</li>

<li><b>slurm_submit_batch_job</b> &mdash; Submit a script for later
execution. Response message must be freed using
<i>slurm_free_submit_response_response_msg</i> to avoid a
memory leak.</li>

<li><b>slurm_free_submit_response_response_msg</b> &mdash;
Frees memory allocated by <i>slurm_submit_batch_job</i>.</li>

<li><b>slurm_confirm_allocation</b> &mdash; Test if a resource allocation has
already been made for a given job id. Response message must be freed using
<i>slurm_free_resource_allocation_response_msg</i> to avoid a
memory leak. This can be used to confirm that an
allocation is still active or for error recovery.</li>

</ul>


<h3 id="step_creation">Job Step Creation
<a class="slurm_link" href="#step_creation"></a>
</h3>
<p>Slurm job steps involve numerous interactions with the
<i>slurmd</i> daemon. The job step creation is only the
first step in the process. We don't advise direct user
creation of job steps, but include the information here
for completeness.</p>
<ul>

<li><b>slurm_job_step_create</b> &mdash; Initiate a job step.
Allocated memory must be freed by
<i>slurm_free_job_step_create_response_msg</i> to avoid a
memory leak.</li>

<li><b>slurm_free_job_step_create_response_msg</b> &mdash; Free
memory allocated by <i>slurm_job_step_create</i>.

<li><b>slurm_step_ctx_create</b> &mdash; Create job step context.
Destroy using <i>slurm_step_ctx_destroy</i>.</li>

<li><b>slurm_step_ctx_destroy</b> &mdash; Destroy a job step context
created by <i>slurm_step_ctx_create</i>.</li>

<li><b>slurm_step_ctx_get</b> &mdash; Get values from job step context.</li>

<li><b>slurm_step_ctx_set</b> &mdash; Set values in job step context.</li>

<li><b>slurm_jobinfo_ctx_get</b> &mdash; Get values from a <i>jobinfo</i>
field as returned by <i>slurm_step_ctx_get</i>.</li>

<li><b>slurm_spawn</b> &mdash; Spawn tasks and establish communications.</li>

<li><b>slurm_spawn_kill</b> &mdash; Signal spawned tasks.</li>

</ul>


<h3 id="signal">Job and Job Step Signaling and Cancelling
<a class="slurm_link" href="#signal"></a>
</h3>
<ul>

<li><b>slurm_kill_job</b> &mdash; Signal or cancel a job.</li>

<li><b>slurm_kill_job_step</b> &mdash; Signal or cancel a job step.</li>

</ul>


<h3 id="completion">Job Completion
<a class="slurm_link" href="#completion"></a>
</h3>
<ul>

<li><b>slurm_complete_job</b> &mdash; Note completion of a job.
Releases resource allocation for the job.</li>

<li><b>slurm_complete_job_step</b> &mdash; Note completion of a
job step.</li>

</ul>


<h3 id="admin">Administrative Functions
<a class="slurm_link" href="#admin"></a>
</h3>
<p>Most of these functions can only be executed by user <i>root</i>.</p>
<ul>

<li><b>slurm_reconfigure</b> &mdash; Update slurm daemons
based upon current <i>slurm.conf</i> configuration file.
Use this after updating the configuration file to
ensure that it takes effect.</li>

<li><b>slurm_shutdown</b> &mdash; Terminate slurm daemons.</li>

<li><b>slurm_update_job</b> &mdash; Update state
information associated with a given job.</li>

<li><b>slurm_update_node</b> &mdash; Update state
information associated with a given node. NOTE: Most
of a node's characteristics can not be modified.</li>

<li><b>slurm_init_part_desc_msg</b> &mdash; Initialize a
partition update descriptor. Used this to initialize
the data structure used in <i>slurm_update_partition</i>.</li>

<li><b>slurm_update_partition</b> &mdash; Update state
information associated with a given partition.</li>

<li><b>slurm_delete_partition</b> &mdash; Destroy a partition.</li>

</ul>


<h3 id="host_list">Slurm Host List Support
<a class="slurm_link" href="#host_list"></a>
</h3>
<p>Slurm uses a condensed format to express node names.
For example <i>linux[1-3,6]</i> represents <i>linux1</i>,
<i>linux2</i>, <i>linux3</i>, and <i>linux6</i>. These
functions permit you to translate the Slurm expression
into a list of individual node names.</p>

<ul>

<li><b>slurm_hostlist_create</b> &mdash; Translate a Slurm
node name expression into a record used for parsing.
Use <i>slurm_hostlist_destroy</i> to free the allocated
storage.</li>

<li><b>slurm_hostlist_shift</b> &mdash; Get the next node
name.</li>

<li><b>slurm_hostlist_destroy</b> &mdash; Release storage
allocated by <i>slurm_hostlist_create</i>.

</ul>

<p style="text-align:center;">Last modified 23 November 2019</p>

<!--#include virtual="footer.txt"-->