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
f1981eab
Commit
f1981eab
authored
16 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
add some port reservation logic
parent
3cdc2699
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
slurm/slurm_errno.h
+2
-0
2 additions, 0 deletions
slurm/slurm_errno.h
src/common/slurm_errno.c
+6
-1
6 additions, 1 deletion
src/common/slurm_errno.c
src/slurmctld/port_mgr.c
+65
-2
65 additions, 2 deletions
src/slurmctld/port_mgr.c
src/srun/allocate.c
+2
-1
2 additions, 1 deletion
src/srun/allocate.c
with
75 additions
and
4 deletions
slurm/slurm_errno.h
+
2
−
0
View file @
f1981eab
...
@@ -168,6 +168,8 @@ enum {
...
@@ -168,6 +168,8 @@ enum {
ESLURM_RESERVATION_NOT_USABLE
,
ESLURM_RESERVATION_NOT_USABLE
,
ESLURM_INVALID_WCKEY
,
ESLURM_INVALID_WCKEY
,
ESLURM_RESERVATION_OVERLAP
,
ESLURM_RESERVATION_OVERLAP
,
ESLURM_PORTS_BUSY
,
ESLURM_PORTS_INVALID
,
/* switch specific error codes, specific values defined in plugin module */
/* switch specific error codes, specific values defined in plugin module */
ESLURM_SWITCH_MIN
=
3000
,
ESLURM_SWITCH_MIN
=
3000
,
...
...
This diff is collapsed.
Click to expand it.
src/common/slurm_errno.c
+
6
−
1
View file @
f1981eab
/*****************************************************************************\
/*****************************************************************************\
* slurm_errno.c - error codes and functions for slurm
* slurm_errno.c - error codes and functions for slurm
******************************************************************************
******************************************************************************
* Copyright (C) 2002-2006 The Regents of the University of California.
* Copyright (C) 2002-2007 The Regents of the University of California.
* Copyright (C) 2008-2009 Lawrence Livermore National Security.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Jim Garlick <garlick@llnl.gov>, et. al.
* Written by Jim Garlick <garlick@llnl.gov>, et. al.
* CODE-OCEC-09-009. All rights reserved.
* CODE-OCEC-09-009. All rights reserved.
...
@@ -237,6 +238,10 @@ static slurm_errtab_t slurm_errtab[] = {
...
@@ -237,6 +238,10 @@ static slurm_errtab_t slurm_errtab[] = {
"Requested reservation not usable now"
},
"Requested reservation not usable now"
},
{
ESLURM_RESERVATION_OVERLAP
,
{
ESLURM_RESERVATION_OVERLAP
,
"Requested reservation overlaps with another reservation"
},
"Requested reservation overlaps with another reservation"
},
{
ESLURM_PORTS_BUSY
,
"Requires ports are in use"
},
{
ESLURM_PORTS_INVALID
,
"Requires more ports than can be reserved"
},
/* slurmd error codes */
/* slurmd error codes */
...
...
This diff is collapsed.
Click to expand it.
src/slurmctld/port_mgr.c
+
65
−
2
View file @
f1981eab
...
@@ -41,14 +41,77 @@
...
@@ -41,14 +41,77 @@
# include "config.h"
# include "config.h"
#endif
#endif
#include
"src/common/bitstring.h"
#include
"src/common/hostlist.h"
#include
"src/common/xmalloc.h"
#include
"src/common/xstring.h"
#include
"src/slurmctld/slurmctld.h"
#include
"src/slurmctld/slurmctld.h"
bitstr_t
**
port_resv_table
=
(
bitstr_t
**
)
NULL
;
int
port_resv_cnt
=
0
;
int
port_resv_min
=
0
;
int
port_resv_max
=
0
;
/* Reserve ports for a job step
/* Reserve ports for a job step
* RET SLURM_SUCCESS or an error code */
* RET SLURM_SUCCESS or an error code */
extern
int
reserve_ports
(
struct
step_record
*
step_ptr
)
extern
int
reserve_ports
(
struct
step_record
*
step_ptr
)
{
{
info
(
"reserving %u ports"
,
step_ptr
->
resv_port_cnt
);
int
i
,
port_inx
;
step_ptr
->
resv_ports
=
xstrdup
(
"123-456"
);
int
*
port_array
=
NULL
;
char
port_str
[
16
];
hostlist_t
hl
;
if
(
step_ptr
->
resv_port_cnt
>
port_resv_cnt
)
{
info
(
"step %u.%u needs %u reserved ports, but only %d exist"
,
step_ptr
->
job_ptr
->
job_id
,
step_ptr
->
step_id
,
step_ptr
->
resv_port_cnt
,
port_resv_cnt
);
return
ESLURM_PORTS_INVALID
;
}
/* Identify available ports */
port_array
=
xmalloc
(
sizeof
(
int
)
*
step_ptr
->
resv_port_cnt
);
port_inx
=
0
;
for
(
i
=
0
;
i
<
port_resv_cnt
;
i
++
)
{
if
(
bit_overlap
(
step_ptr
->
step_node_bitmap
,
port_resv_table
[
i
]))
continue
;
port_array
[
port_inx
++
]
=
i
;
if
(
port_inx
>=
step_ptr
->
resv_port_cnt
)
break
;
}
if
(
port_inx
<
step_ptr
->
resv_port_cnt
)
{
info
(
"insufficient ports for step %u.%u to reserve (%d of %u)"
,
step_ptr
->
job_ptr
->
job_id
,
step_ptr
->
step_id
,
port_inx
,
step_ptr
->
resv_port_cnt
);
xfree
(
port_array
);
return
ESLURM_PORTS_BUSY
;
}
/* Reserve selected ports */
hl
=
hostlist_create
(
NULL
);
if
(
hl
==
NULL
)
fatal
(
"malloc: hostlist_create"
);
for
(
i
=
0
;
i
<
port_inx
;
i
++
)
{
bit_or
(
port_resv_table
[
port_array
[
i
]],
step_ptr
->
step_node_bitmap
);
snprintf
(
port_str
,
sizeof
(
port_str
),
"%d"
,
(
port_array
[
i
]
+
port_resv_min
));
hostlist_push
(
hl
,
port_str
);
}
hostlist_sort
(
hl
);
for
(
i
=
1024
;
;
i
*=
2
)
{
step_ptr
->
resv_ports
=
xmalloc
(
i
);
if
(
hostlist_ranged_string
(
hl
,
i
,
step_ptr
->
resv_ports
)
>=
0
)
break
;
xfree
(
step_ptr
->
resv_ports
);
}
hostlist_destroy
(
hl
);
xfree
(
port_array
);
info
(
"reserved ports %s for step %u.%u"
,
step_ptr
->
resv_ports
,
step_ptr
->
job_ptr
->
job_id
,
step_ptr
->
step_id
);
return
SLURM_SUCCESS
;
return
SLURM_SUCCESS
;
}
}
This diff is collapsed.
Click to expand it.
src/srun/allocate.c
+
2
−
1
View file @
f1981eab
...
@@ -596,7 +596,8 @@ create_job_step(srun_job_t *job, bool use_all_cpus)
...
@@ -596,7 +596,8 @@ create_job_step(srun_job_t *job, bool use_all_cpus)
rc
=
slurm_get_errno
();
rc
=
slurm_get_errno
();
if
(
opt
.
immediate
||
if
(
opt
.
immediate
||
((
rc
!=
ESLURM_NODES_BUSY
)
&&
(
rc
!=
ESLURM_DISABLED
)))
{
((
rc
!=
ESLURM_NODES_BUSY
)
&&
(
rc
!=
ESLURM_PORTS_BUSY
)
&&
(
rc
!=
ESLURM_DISABLED
)))
{
error
(
"Unable to create job step: %m"
);
error
(
"Unable to create job step: %m"
);
return
-
1
;
return
-
1
;
}
}
...
...
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