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
fd9f4fb9
Commit
fd9f4fb9
authored
11 years ago
by
David Bigagli
Browse files
Options
Downloads
Patches
Plain Diff
Allow requeue of a single job array task.
parent
7f68ded5
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/scontrol/update_job.c
+100
-11
100 additions, 11 deletions
src/scontrol/update_job.c
with
100 additions
and
11 deletions
src/scontrol/update_job.c
+
100
−
11
View file @
fd9f4fb9
...
@@ -47,7 +47,8 @@ static int _parse_restart_args(int argc, char **argv,
...
@@ -47,7 +47,8 @@ static int _parse_restart_args(int argc, char **argv,
uint16_t
*
stick
,
char
**
image_dir
);
uint16_t
*
stick
,
char
**
image_dir
);
static
void
_update_job_size
(
uint32_t
job_id
);
static
void
_update_job_size
(
uint32_t
job_id
);
static
int
_parse_requeue_flags
(
char
*
,
uint32_t
*
state_flags
);
static
int
_parse_requeue_flags
(
char
*
,
uint32_t
*
state_flags
);
static
inline
bool
is_job_array
(
const
char
*
);
static
uint32_t
get_array_job_id
(
const
char
*
);
/*
/*
* scontrol_checkpoint - perform some checkpoint/resume operation
* scontrol_checkpoint - perform some checkpoint/resume operation
* IN op - checkpoint operation
* IN op - checkpoint operation
...
@@ -350,11 +351,20 @@ scontrol_requeue(int argc, char **argv)
...
@@ -350,11 +351,20 @@ scontrol_requeue(int argc, char **argv)
return
0
;
return
0
;
}
}
job_id
=
(
uint32_t
)
strtol
(
argv
[
0
],
&
next_str
,
10
);
if
(
is_job_array
(
argv
[
0
]))
{
if
(
next_str
[
0
]
!=
'\0'
)
{
job_id
=
get_array_job_id
(
argv
[
0
]);
fprintf
(
stderr
,
"Invalid job id specified
\n
"
);
if
(
job_id
==
NO_VAL
)
{
exit_code
=
1
;
fprintf
(
stderr
,
"Invalid array job id specified
\n
"
);
return
0
;
exit_code
=
1
;
return
0
;
}
}
else
{
job_id
=
(
uint32_t
)
strtol
(
argv
[
0
],
&
next_str
,
10
);
if
(
next_str
[
0
]
!=
'\0'
)
{
fprintf
(
stderr
,
"Invalid job id specified
\n
"
);
exit_code
=
1
;
return
0
;
}
}
}
rc
=
slurm_requeue
(
job_id
,
0
);
rc
=
slurm_requeue
(
job_id
,
0
);
...
@@ -378,11 +388,20 @@ scontrol_requeue_hold(int argc, char **argv)
...
@@ -378,11 +388,20 @@ scontrol_requeue_hold(int argc, char **argv)
else
else
job_id_str
=
argv
[
1
];
job_id_str
=
argv
[
1
];
job_id
=
(
uint32_t
)
strtol
(
job_id_str
,
&
next_str
,
10
);
if
(
is_job_array
(
job_id_str
))
{
if
(
next_str
[
0
]
!=
'\0'
)
{
job_id
=
get_array_job_id
(
job_id_str
);
fprintf
(
stderr
,
"Invalid job id specified
\n
"
);
if
(
job_id
==
NO_VAL
)
{
exit_code
=
1
;
fprintf
(
stderr
,
"Invalid array job id specified
\n
"
);
return
0
;
exit_code
=
1
;
return
0
;
}
}
else
{
job_id
=
(
uint32_t
)
strtol
(
job_id_str
,
&
next_str
,
10
);
if
(
next_str
[
0
]
!=
'\0'
)
{
fprintf
(
stderr
,
"Invalid job id specified
\n
"
);
exit_code
=
1
;
return
0
;
}
}
}
if
(
argc
==
2
)
{
if
(
argc
==
2
)
{
...
@@ -1008,3 +1027,73 @@ _parse_requeue_flags(char *s, uint32_t *state)
...
@@ -1008,3 +1027,73 @@ _parse_requeue_flags(char *s, uint32_t *state)
xfree
(
p0
);
xfree
(
p0
);
return
-
1
;
return
-
1
;
}
}
/* is_job_array()
* Detect the _ jobid separator.
*/
static
inline
bool
is_job_array
(
const
char
*
jobid
)
{
int
cc
;
cc
=
0
;
while
(
*
jobid
)
{
if
(
*
jobid
==
'_'
)
++
cc
;
++
jobid
;
}
if
(
cc
==
1
)
return
true
;
return
false
;
}
/* get_array_job_id()
*/
static
uint32_t
get_array_job_id
(
const
char
*
jobid
)
{
char
job_id
[
64
];
char
*
taskid
;
char
*
next_str
;
int
ntaskid
;
int
njobid
;
int
cc
;
int
ujobid
;
job_info_msg_t
*
job_info
;
if
(
strlen
(
jobid
)
>
63
)
return
NO_VAL
;
strcpy
(
job_id
,
jobid
);
taskid
=
strchr
(
job_id
,
'_'
);
if
(
taskid
==
NULL
)
return
NO_VAL
;
*
taskid
=
0
;
++
taskid
;
ntaskid
=
(
uint32_t
)
strtol
(
taskid
,
&
next_str
,
10
);
if
(
next_str
[
0
]
!=
'\0'
)
return
NO_VAL
;
njobid
=
(
uint32_t
)
strtol
(
job_id
,
&
next_str
,
10
);
if
(
next_str
[
0
]
!=
'\0'
)
return
NO_VAL
;
cc
=
slurm_load_job
(
&
job_info
,
njobid
,
SHOW_ALL
);
if
(
cc
<
0
)
return
NO_VAL
;
ujobid
=
-
1
;
for
(
cc
=
0
;
cc
<
job_info
->
record_count
;
cc
++
)
{
if
(
ntaskid
==
job_info
->
job_array
[
cc
].
array_task_id
)
{
ujobid
=
job_info
->
job_array
[
cc
].
job_id
;
break
;
}
}
slurm_free_job_info_msg
(
job_info
);
return
ujobid
;
}
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