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
cbc7af6b
Commit
cbc7af6b
authored
22 years ago
by
jce
Browse files
Options
Downloads
Patches
Plain Diff
ported reconfigure to new comm layer.
parent
3ff55080
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/api/job_info.c
+1
-1
1 addition, 1 deletion
src/api/job_info.c
src/api/reconfigure.c
+42
-61
42 additions, 61 deletions
src/api/reconfigure.c
with
43 additions
and
62 deletions
src/api/job_info.c
+
1
−
1
View file @
cbc7af6b
...
...
@@ -117,7 +117,7 @@ slurm_load_jobs (time_t update_time, job_info_msg_t **job_info_msg_pptr)
slurm_msg_t
request_msg
;
slurm_msg_t
response_msg
;
last_update_msg_t
last_time_msg
;
return_code_msg_t
*
slurm_rc_msg
;
return_code_msg_t
*
slurm_rc_msg
;
/* init message connection for message communication with controller */
if
(
(
sockfd
=
slurm_open_controller_conn
(
SLURM_PORT
)
)
==
SLURM_SOCKET_ERROR
)
...
...
This diff is collapsed.
Click to expand it.
src/api/reconfigure.c
+
42
−
61
View file @
cbc7af6b
...
...
@@ -10,14 +10,8 @@
#include
<errno.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
<string.h>
#include
<syslog.h>
#include
<sys/socket.h>
#include
<netinet/in.h>
#include
<arpa/inet.h>
#include
<unistd.h>
#include
<src/common/slurm_protocol_api.h>
#include
"slurm.h"
#if DEBUG_MODULE
...
...
@@ -43,59 +37,46 @@ main (int argc, char *argv[]) {
#endif
/*
* reconfigure - _ request that slurmctld re-read the configuration files
* output: returns 0 on success, errno otherwise
*/
int
reconfigure
()
{
int
buffer_offset
,
buffer_size
,
error_code
,
in_size
;
char
request_msg
[
64
],
*
buffer
;
int
sockfd
;
struct
sockaddr_in
serv_addr
;
if
((
sockfd
=
socket
(
AF_INET
,
SOCK_STREAM
,
0
))
<
0
)
return
EINVAL
;
serv_addr
.
sin_family
=
PF_INET
;
serv_addr
.
sin_addr
.
s_addr
=
inet_addr
(
SLURMCTLD_HOST
);
serv_addr
.
sin_port
=
htons
(
SLURMCTLD_PORT
);
if
(
connect
(
sockfd
,
(
struct
sockaddr
*
)
&
serv_addr
,
sizeof
(
serv_addr
))
<
0
)
{
close
(
sockfd
);
return
EINVAL
;
}
sprintf
(
request_msg
,
"Reconfigure"
);
if
(
send
(
sockfd
,
request_msg
,
strlen
(
request_msg
)
+
1
,
0
)
<
strlen
(
request_msg
))
{
close
(
sockfd
);
return
EINVAL
;
}
buffer
=
NULL
;
buffer_offset
=
0
;
buffer_size
=
1024
;
while
(
1
)
{
buffer
=
realloc
(
buffer
,
buffer_size
);
if
(
buffer
==
NULL
)
{
close
(
sockfd
);
return
ENOMEM
;
}
in_size
=
recv
(
sockfd
,
&
buffer
[
buffer_offset
],
(
buffer_size
-
buffer_offset
),
0
);
if
(
in_size
<=
0
)
{
/* end if input */
in_size
=
0
;
break
;
}
buffer_offset
+=
in_size
;
buffer_size
+=
in_size
;
}
close
(
sockfd
);
buffer_size
=
buffer_offset
+
in_size
;
buffer
=
realloc
(
buffer
,
buffer_size
);
if
(
buffer
==
NULL
)
return
ENOMEM
;
error_code
=
atoi
(
buffer
);
free
(
buffer
);
return
error_code
;
slurm_reconfigure
()
{
int
msg_size
;
int
rc
;
slurm_fd
sockfd
;
slurm_msg_t
request_msg
;
slurm_msg_t
response_msg
;
return_code_msg_t
*
rc_msg
;
/* init message connection for message communication with controller */
if
(
(
sockfd
=
slurm_open_controller_conn
(
SLURM_PORT
)
)
==
SLURM_SOCKET_ERROR
)
return
SLURM_SOCKET_ERROR
;
/* send request message */
request_msg
.
msg_type
=
REQUEST_RECONFIGURE
;
if
(
(
rc
=
slurm_send_controller_msg
(
sockfd
,
&
request_msg
)
)
==
SLURM_SOCKET_ERROR
)
return
SLURM_SOCKET_ERROR
;
/* receive message */
if
(
(
msg_size
=
slurm_receive_msg
(
sockfd
,
&
response_msg
)
)
==
SLURM_SOCKET_ERROR
)
return
SLURM_SOCKET_ERROR
;
/* shutdown message connection */
if
(
(
rc
=
slurm_shutdown_msg_conn
(
sockfd
)
)
==
SLURM_SOCKET_ERROR
)
return
SLURM_SOCKET_ERROR
;
switch
(
response_msg
.
msg_type
)
{
case
RESPONSE_SLURM_RC
:
rc_msg
=
(
return_code_msg_t
*
)
response_msg
.
data
;
return
rc_msg
->
return_code
;
break
;
default:
return
SLURM_UNEXPECTED_MSG_ERROR
;
break
;
}
return
SLURM_SUCCESS
;
}
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