Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Slurm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tud-zih-energy
Slurm
Commits
5de236db
Commit
5de236db
authored
22 years ago
by
tewk
Browse files
Options
Downloads
Patches
Plain Diff
Added pack routines for job_desc and continued clean up
parent
b5ad4161
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/common/slurm_protocol_defs.h
+35
-2
35 additions, 2 deletions
src/common/slurm_protocol_defs.h
src/common/slurm_protocol_pack.c
+196
-0
196 additions, 0 deletions
src/common/slurm_protocol_pack.c
with
231 additions
and
2 deletions
src/common/slurm_protocol_defs.h
+
35
−
2
View file @
5de236db
...
@@ -18,6 +18,7 @@
...
@@ -18,6 +18,7 @@
#define true -1
#define true -1
#define false 0
#define false 0
#include
<src/common/slurm_protocol_common.h>
/* for sendto and recvfrom commands */
/* for sendto and recvfrom commands */
#define NO_SEND_RECV_FLAGS 0
#define NO_SEND_RECV_FLAGS 0
...
@@ -96,7 +97,8 @@ typedef enum {
...
@@ -96,7 +97,8 @@ typedef enum {
REQUEST_RUN_JOB_STEP = 48,
REQUEST_RUN_JOB_STEP = 48,
RESPONSE_RUN_JOB_STEP = 49
RESPONSE_RUN_JOB_STEP = 49
*/
*/
}
slurm_msg_type_t
;
}
SLURM_MSG_TYPE_T
;
typedef
uint16_t
slurm_msg_type_t
;
#define REQUEST_NODE_REGISRATION_STATUS 1
#define REQUEST_NODE_REGISRATION_STATUS 1
#define MESSAGE_NODE_REGISRATION_STATUS 2
#define MESSAGE_NODE_REGISRATION_STATUS 2
...
@@ -161,9 +163,40 @@ typedef struct slurm_node_registration_status_msg
...
@@ -161,9 +163,40 @@ typedef struct slurm_node_registration_status_msg
uint32_t
temporary_disk_space
;
uint32_t
temporary_disk_space
;
}
node_registration_status_msg_t
;
}
node_registration_status_msg_t
;
typedef
struct
job_desc
{
/* Job descriptor for submit, allocate, and update requests */
uint16_t
contiguous
;
/* 1 if job requires contiguous nodes, 0 otherwise,
* default=0 */
char
*
features
;
/* comma separated list of required features, default NONE */
char
*
groups
;
/* comma separated list of groups the user can access,
* default set output of "/usr/bin/groups" by API,
* can only be set if user is root */
uint32_t
job_id
;
/* job ID, default set by SLURM */
char
*
name
;
/* name of the job, default "" */
void
*
partition_key
;
/* root key to submit job, format TBD, default NONE */
uint32_t
min_procs
;
/* minimum processors required per node, default=0 */
uint32_t
min_memory
;
/* minimum real memory required per node, default=0 */
uint32_t
min_tmp_disk
;
/* minimum temporary disk required per node, default=0 */
char
*
partition
;
/* name of requested partition, default in SLURM config */
uint32_t
priority
;
/* relative priority of the job, default set by SLURM,
* can only be explicitly set if user is root, maximum
* * value is #fffffffe */
char
*
req_nodes
;
/* comma separated list of required nodes, default NONE */
char
*
job_script
;
/* pathname of required script, default NONE */
uint16_t
shared
;
/* 1 if job can share nodes with other jobs, 0 otherwise,
* default in SLURM configuration */
uint32_t
time_limit
;
/* maximum run time in minutes, default is partition
* limit as defined in SLURM configuration, maximum
* * value is #fffffffe */
uint32_t
num_procs
;
/* number of processors required by job, default=0 */
uint32_t
num_nodes
;
/* number of nodes required by job, default=0 */
uint32_t
user_id
;
/* set only if different from current UID, default set
* to UID by API, can only be set if user is root */
}
job_desc_t
;
typedef
struct
slurm_msg
typedef
struct
slurm_msg
{
{
uint16_t
msg_type
;
slurm_msg_type_t
msg_type
;
slurm_addr
address
;
void
*
msg
;
void
*
msg
;
}
slurm_msg_t
;
}
slurm_msg_t
;
#endif
#endif
This diff is collapsed.
Click to expand it.
src/common/slurm_protocol_pack.c
+
196
−
0
View file @
5de236db
#include
<stdlib.h>
#include
<stdlib.h>
#include
<errno.h>
#include
<string.h>
#include
<src/common/slurm_protocol_pack.h>
#include
<src/common/slurm_protocol_pack.h>
#include
<src/common/pack.h>
#include
<src/common/pack.h>
#include
<src/common/log.h>
#include
<src/slurmctld/slurmctld.h>
void
pack_header
(
char
**
buffer
,
uint32_t
*
length
,
header_t
*
header
)
void
pack_header
(
char
**
buffer
,
uint32_t
*
length
,
header_t
*
header
)
{
{
...
@@ -90,6 +95,67 @@ void unpack_msg ( char ** buffer , uint32_t * buf_len , slurm_msg_t * msg )
...
@@ -90,6 +95,67 @@ void unpack_msg ( char ** buffer , uint32_t * buf_len , slurm_msg_t * msg )
{
{
switch
(
msg
->
msg_type
)
switch
(
msg
->
msg_type
)
{
{
case
REQUEST_NODE_REGISRATION_STATUS
:
break
;
case
MESSAGE_NODE_REGISRATION_STATUS
:
break
;
case
REQUEST_RESOURCE_ALLOCATION
:
case
REQUEST_SUBMIT_BATCH_JOB
:
break
;
case
RESPONSE_RESOURCE_ALLOCATION
:
break
;
case
RESPONSE_SUBMIT_BATCH_JOB
:
break
;
case
REQUEST_CANCEL_JOB
:
break
;
case
REQUEST_CANCEL_JOB_STEP
:
break
;
case
REQUEST_SIGNAL_JOB
:
break
;
case
REQUEST_SIGNAL_JOB_STEP
:
break
;
case
REQUEST_RECONFIGURE
:
break
;
case
RESPONSE_CANCEL_JOB
:
case
RESPONSE_RECONFIGURE
:
case
RESPONSE_CANCEL_JOB_STEP
:
case
RESPONSE_SIGNAL_JOB
:
case
RESPONSE_SIGNAL_JOB_STEP
:
break
;
case
REQUEST_JOB_INFO
:
break
;
case
REQUEST_JOB_ATTACH
:
break
;
case
RESPONSE_JOB_ATTACH
:
break
;
case
REQUEST_LAUNCH_TASKS
:
break
;
case
REQUEST_GET_JOB_STEP_INFO
:
break
;
case
RESPONSE_GET_JOB_STEP_INFO
:
break
;
case
REQUEST_JOB_RESOURCE
:
break
;
case
RESPONSE_JOB_RESOURCE
:
break
;
case
REQUEST_RUN_JOB_STEP
:
break
;
case
RESPONSE_RUN_JOB_STEP
:
break
;
case
REQUEST_GET_KEY
:
break
;
case
RESPONSE_GET_KEY
:
break
;
case
MESSAGE_TASK_EXIT
:
break
;
case
REQUEST_BATCH_JOB_LAUNCH
:
break
;
case
MESSAGE_UPLOAD_ACCOUNTING_INFO
:
break
;
default
:
debug
(
"No pack method for msg type %i"
,
msg
->
msg_type
)
;
break
;
}
}
}
}
...
@@ -107,6 +173,136 @@ void unpack_node_registration_status_msg ( char ** buffer , uint32_t * length ,
...
@@ -107,6 +173,136 @@ void unpack_node_registration_status_msg ( char ** buffer , uint32_t * length ,
unpack32
(
&
msg
->
temporary_disk_space
,
(
void
**
)
buffer
,
length
)
;
unpack32
(
&
msg
->
temporary_disk_space
,
(
void
**
)
buffer
,
length
)
;
}
}
int
unpack_build_info
(
struct
build_buffer
**
build_buffer_ptr
,
void
*
buffer
,
int
buffer_size
)
{
uint16_t
uint16_tmp
;
uint32_t
uint32_time
;
struct
build_table
*
build_ptr
;
void
*
buf_ptr
;
/* alloc memory for structure */
build_ptr
=
malloc
(
sizeof
(
struct
build_table
)
)
;
if
(
build_ptr
==
NULL
)
{
return
ENOMEM
;
}
/* load the data values */
/* unpack timestamp of snapshot */
buf_ptr
=
buffer
;
unpack32
(
&
uint32_time
,
&
buf_ptr
,
&
buffer_size
);
unpack16
(
&
build_ptr
->
backup_interval
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
backup_location
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
backup_machine
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
control_daemon
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
control_machine
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpack16
(
&
build_ptr
->
controller_timeout
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
epilog
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpack16
(
&
build_ptr
->
fast_schedule
,
&
buf_ptr
,
&
buffer_size
);
unpack16
(
&
build_ptr
->
hash_base
,
&
buf_ptr
,
&
buffer_size
);
unpack16
(
&
build_ptr
->
heartbeat_interval
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
init_program
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpack16
(
&
build_ptr
->
kill_wait
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
prioritize
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
prolog
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
server_daemon
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpack16
(
&
build_ptr
->
server_timeout
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
slurm_conf
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
build_ptr
->
tmp_fs
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
*
build_buffer_ptr
=
malloc
(
sizeof
(
struct
build_buffer
));
if
(
*
build_buffer_ptr
==
NULL
)
{
free
(
build_ptr
);
return
ENOMEM
;
}
(
*
build_buffer_ptr
)
->
last_update
=
(
time_t
)
uint32_time
;
(
*
build_buffer_ptr
)
->
raw_buffer_ptr
=
buffer
;
(
*
build_buffer_ptr
)
->
build_table_ptr
=
build_ptr
;
return
0
;
}
int
pack_job_desc
(
job_desc_t
*
job_desc_ptr
,
void
*
buffer
,
int
buf_len
)
{
void
*
buf_ptr
;
int
buffer_size
=
buf_len
;
/* load the data values */
/* unpack timestamp of snapshot */
buf_ptr
=
buffer
;
pack16
(
job_desc_ptr
->
contiguous
,
&
buf_ptr
,
&
buffer_size
);
packstr
(
job_desc_ptr
->
features
,
&
buf_ptr
,
&
buffer_size
);
packstr
(
job_desc_ptr
->
groups
,
&
buf_ptr
,
&
buffer_size
);
pack32
(
job_desc_ptr
->
job_id
,
&
buf_ptr
,
&
buffer_size
);
packstr
(
job_desc_ptr
->
name
,
&
buf_ptr
,
&
buffer_size
);
packmem
(
job_desc_ptr
->
partition_key
,
32
,
&
buf_ptr
,
&
buffer_size
);
pack32
(
job_desc_ptr
->
min_procs
,
&
buf_ptr
,
&
buffer_size
);
pack32
(
job_desc_ptr
->
min_memory
,
&
buf_ptr
,
&
buffer_size
);
pack32
(
job_desc_ptr
->
min_tmp_disk
,
&
buf_ptr
,
&
buffer_size
);
packstr
(
job_desc_ptr
->
partition
,
&
buf_ptr
,
&
buffer_size
);
pack32
(
job_desc_ptr
->
priority
,
&
buf_ptr
,
&
buffer_size
);
packstr
(
job_desc_ptr
->
partition
,
&
buf_ptr
,
&
buffer_size
);
packstr
(
job_desc_ptr
->
partition
,
&
buf_ptr
,
&
buffer_size
);
pack16
(
job_desc_ptr
->
shared
,
&
buf_ptr
,
&
buffer_size
);
pack32
(
job_desc_ptr
->
time_limit
,
&
buf_ptr
,
&
buffer_size
);
pack32
(
job_desc_ptr
->
num_procs
,
&
buf_ptr
,
&
buffer_size
);
pack32
(
job_desc_ptr
->
num_nodes
,
&
buf_ptr
,
&
buffer_size
);
pack32
(
job_desc_ptr
->
user_id
,
&
buf_ptr
,
&
buffer_size
);
return
buf_len
-
buffer_size
;
}
int
unpack_job_desc
(
job_desc_t
**
job_desc_buffer_ptr
,
void
*
buffer
,
int
buffer_size
)
{
uint16_t
uint16_tmp
;
void
*
buf_ptr
;
job_desc_t
*
job_desc_ptr
;
/* alloc memory for structure */
job_desc_ptr
=
malloc
(
sizeof
(
job_desc_t
)
)
;
if
(
job_desc_ptr
==
NULL
)
{
return
ENOMEM
;
}
/* load the data values */
/* unpack timestamp of snapshot */
buf_ptr
=
buffer
;
unpack16
(
&
job_desc_ptr
->
contiguous
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
job_desc_ptr
->
features
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
job_desc_ptr
->
groups
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpack32
(
&
job_desc_ptr
->
job_id
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
job_desc_ptr
->
name
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpackmem_ptr
(
(
char
**
)
&
job_desc_ptr
->
partition_key
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpack32
(
&
job_desc_ptr
->
min_procs
,
&
buf_ptr
,
&
buffer_size
);
unpack32
(
&
job_desc_ptr
->
min_memory
,
&
buf_ptr
,
&
buffer_size
);
unpack32
(
&
job_desc_ptr
->
min_tmp_disk
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
job_desc_ptr
->
partition
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpack32
(
&
job_desc_ptr
->
priority
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
job_desc_ptr
->
partition
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpackstr_ptr
(
&
job_desc_ptr
->
partition
,
&
uint16_tmp
,
&
buf_ptr
,
&
buffer_size
);
unpack16
(
&
job_desc_ptr
->
shared
,
&
buf_ptr
,
&
buffer_size
);
unpack32
(
&
job_desc_ptr
->
time_limit
,
&
buf_ptr
,
&
buffer_size
);
unpack32
(
&
job_desc_ptr
->
num_procs
,
&
buf_ptr
,
&
buffer_size
);
unpack32
(
&
job_desc_ptr
->
num_nodes
,
&
buf_ptr
,
&
buffer_size
);
unpack32
(
&
job_desc_ptr
->
user_id
,
&
buf_ptr
,
&
buffer_size
);
return
0
;
}
/* template
/* template
void pack_ ( char ** buffer , uint32_t * length , * msg )
void pack_ ( char ** buffer , uint32_t * length , * msg )
{
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment