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
033ff4d8
Commit
033ff4d8
authored
19 years ago
by
Moe Jette
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug in processing of "#SLURM" batch script option parsing.
parent
a25cc55d
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
NEWS
+1
-0
1 addition, 0 deletions
NEWS
src/srun/opt.c
+14
-7
14 additions, 7 deletions
src/srun/opt.c
src/srun/srun.c
+31
-56
31 additions, 56 deletions
src/srun/srun.c
testsuite/expect/test1.47
+62
-5
62 additions, 5 deletions
testsuite/expect/test1.47
with
108 additions
and
68 deletions
NEWS
+
1
−
0
View file @
033ff4d8
...
...
@@ -5,6 +5,7 @@ documents those changes that are of interest to users and admins.
=============================
-- Add support for job suspend/resume.
-- Add slurmd cache for group IDs (Takao Hatazaki, HP).
-- Fix bug in processing of "#SLURM" batch script option parsing.
* Changes in SLURM 0.7.0-pre7
=============================
...
...
This diff is collapsed.
Click to expand it.
src/srun/opt.c
+
14
−
7
View file @
033ff4d8
...
...
@@ -2,7 +2,7 @@
* opt.c - options processing for srun
* $Id$
*****************************************************************************
* Copyright (C) 2002 The Regents of the University of California.
* Copyright (C) 2002
-2006
The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Mark Grondona <grondona1@llnl.gov>, et. al.
* UCRL-CODE-217948.
...
...
@@ -829,6 +829,7 @@ _get_int(const char *arg, const char *what)
void
set_options
(
const
int
argc
,
char
**
argv
,
int
first
)
{
int
opt_char
,
option_index
=
0
;
static
bool
set_cwd
=
false
,
set_name
=
false
;
struct
utsname
name
;
static
struct
option
long_options
[]
=
{
{
"attach"
,
required_argument
,
0
,
'a'
},
...
...
@@ -986,9 +987,10 @@ void set_options(const int argc, char **argv, int first)
_get_int
(
optarg
,
"slurmd-debug"
);
break
;
case
(
int
)
'D'
:
if
(
!
first
&&
opt
.
cwd
)
if
(
!
first
&&
set_
cwd
)
break
;
set_cwd
=
true
;
xfree
(
opt
.
cwd
);
opt
.
cwd
=
xstrdup
(
optarg
);
break
;
...
...
@@ -1026,9 +1028,10 @@ void set_options(const int argc, char **argv, int first)
opt
.
join
=
true
;
break
;
case
(
int
)
'J'
:
if
(
!
first
&&
opt
.
job
_name
)
if
(
!
first
&&
set
_name
)
break
;
set_name
=
true
;
xfree
(
opt
.
job_name
);
opt
.
job_name
=
xstrdup
(
optarg
);
break
;
...
...
@@ -1327,8 +1330,12 @@ void set_options(const int argc, char **argv, int first)
}
}
if
(
!
first
&&
!
_opt_verify
())
exit
(
1
);
if
(
!
first
)
{
if
(
!
_opt_verify
())
exit
(
1
);
if
(
_verbose
>
3
)
_opt_list
();
}
}
/*
...
...
This diff is collapsed.
Click to expand it.
src/srun/srun.c
+
31
−
56
View file @
033ff4d8
...
...
@@ -3,7 +3,7 @@
* parallel jobs.
* $Id$
*****************************************************************************
* Copyright (C) 2002 The Regents of the University of California.
* Copyright (C) 2002
-2006
The Regents of the University of California.
* Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
* Written by Mark Grondona <grondona@llnl.gov>, et. al.
* UCRL-CODE-217948.
...
...
@@ -99,6 +99,7 @@ static char *_build_script (char *pathname, int file_type);
static
char
*
_get_shell
(
void
);
static
void
_send_options
(
const
int
argc
,
char
**
argv
);
static
void
_get_options
(
const
char
*
buffer
);
static
char
*
_get_token
(
char
*
buf_ptr
);
static
int
_is_file_text
(
char
*
,
char
**
);
static
int
_run_batch_job
(
void
);
static
int
_run_job_script
(
srun_job_t
*
job
,
env_t
*
env
);
...
...
@@ -501,68 +502,42 @@ _get_shell (void)
return
pw_ent_ptr
->
pw_shell
;
}
/* _get_opts - gather options put in user script. Used for batch scripts. */
static
char
*
_get_token
(
char
*
buf_ptr
)
{
int
i
,
token_size
=
0
;
char
*
token
;
for
(
i
=
1
;
(
buf_ptr
[
i
]
!=
'\n'
)
&&
(
buf_ptr
[
i
]
!=
'\0'
);
i
++
)
{
if
(
isspace
(
buf_ptr
[
i
]))
break
;
}
token_size
=
i
;
token
=
xmalloc
(
token_size
+
1
);
strncpy
(
token
,
buf_ptr
,
token_size
);
return
token
;
}
/* _get_opts - gather options put in user script. Used for batch scripts. */
static
void
_get_options
(
const
char
*
buffer
)
{
int
i
=
0
,
i2
=
0
;
int
argc
=
1
;
char
*
argv
[
MAX_ENTRIES
];
while
(
buffer
[
i
])
{
if
(
!
strncmp
(
buffer
+
i
,
"#SLURM "
,
7
))
{
i
+=
7
;
i2
=
i
;
while
(
buffer
[
i2
]
!=
'\n'
)
{
if
(
buffer
[
i2
]
==
'-'
)
{
i
=
i2
;
while
(
buffer
[
i
]
!=
'\n'
)
{
if
(
i
!=
i2
&&
i
!=
(
i2
+
1
)
&&
buffer
[
i
]
==
'-'
)
{
argv
[
argc
]
=
xmalloc
(
sizeof
(
char
)
*
(
i
-
i2
));
memset
(
argv
[
argc
],
0
,
(
i
-
i2
));
strncpy
(
argv
[
argc
],
buffer
+
i2
,
(
i
-
i2
-
1
));
argc
++
;
if
(
argc
>=
MAX_ENTRIES
)
{
_send_options
(
argc
,
argv
);
argc
=
1
;
}
i2
=
i
;
}
i
++
;
}
argv
[
argc
]
=
xmalloc
(
sizeof
(
char
)
*
(
i
-
i2
+
1
));
memset
(
argv
[
argc
],
0
,
(
i
-
i2
+
1
));
strncpy
(
argv
[
argc
],
buffer
+
i2
,
(
i
-
i2
));
i2
=
i
;
argc
++
;
if
(
argc
>=
MAX_ENTRIES
)
{
_send_options
(
argc
,
argv
);
argc
=
1
;
}
break
;
}
else
i2
++
;
}
i
=
i2
;
char
*
buf_loc
=
(
char
*
)
buffer
;
while
((
buf_loc
=
strstr
(
buf_loc
,
"#SLURM"
)))
{
buf_loc
+=
6
;
/* find the tokens and move them to argv */
for
(
;
((
buf_loc
[
0
]
!=
'\n'
)
&&
(
buf_loc
[
0
]
!=
'\0'
));
buf_loc
++
)
{
if
(
isspace
(
buf_loc
[
0
]))
continue
;
argv
[
argc
]
=
_get_token
(
buf_loc
);
buf_loc
+=
(
strlen
(
argv
[
argc
])
-
1
);
argc
++
;
}
i
++
;
}
if
(
argc
>
1
)
_send_options
(
argc
,
argv
);
...
...
This diff is collapsed.
Click to expand it.
testsuite/expect/test1.47
+
62
−
5
View file @
033ff4d8
...
...
@@ -10,7 +10,7 @@
# Note: This script generates and then deletes files in the working directory
# named test1.47.input and test1.47.output
############################################################################
# Copyright (C) 2005 The Regents of the University of California.
# Copyright (C) 2005
-2006
The Regents of the University of California.
# Produced at Lawrence Livermore National Laboratory (cf, DISCLAIMER).
# Written by Danny Auble <da@llnl.gov>
# UCRL-CODE-217948.
...
...
@@ -38,11 +38,68 @@ set test_id "1.47"
set exit_code 0
set file_in "test$test_id.input"
set file_out "test$test_id.output"
set matches 0
set job_acct "TEST_ACCT"
set job_name "TEST_NAME"
set delay 1
print_header $test_id
#
# Delete left-over input script
exec $bin_rm -f $file_in
exec echo "#!$bin_bash" >$file_in
exec echo "#SLURM --job-name=$job_name" >>$file_in
exec echo "#SLURM --account=$job_acct" >>$file_in
exec echo "$bin_sleep $delay" >>$file_in
exec $bin_chmod 700 $file_in
set timeout $max_job_delay
set job_id 0
spawn $srun -o $file_out -b $file_in
expect {
-re "jobid ($number) submitted" {
set job_id $expect_out(1,string)
exp_continue
}
timeout {
send_user "\nFAILURE: srun not responding\n"
kill_srun
set exit_code 1
exp_continue
}
eof {
wait
}
}
if {$job_id == 0} {
send_user "\nFAILURE: batch submit failure\n"
exit 1
}
set matches 0
spawn $scontrol show job $job_id
expect {
-re "Name=$job_name" {
incr matches
exp_continue
}
-re "Account=$job_acct" {
incr matches
exp_continue
}
timeout {
send_user "\nFAILURE: scontrol not responding\n"
set exit_code 1
exp_continue
}
eof {
wait
}
}
if {$matches != 2} {
send_user "\nFAILURE: did not set job name and account from batch script\n"
set exit_code 1
}
#
# Delete left-over input script
# Build input script file
...
...
@@ -56,7 +113,7 @@ exec echo "#SLURM -N65000" >>$file_in
exec echo "$bin_sleep $delay" >>$file_in
exec $bin_chmod 700 $file_in
set
timeout $max_job_delay
set
matches 0
spawn $srun -o $file_out -b $file_in
expect {
-re "More .* requested than permitted" {
...
...
@@ -85,11 +142,11 @@ exec echo "#SLURM -N650000" >>$file_in
exec echo "$bin_sleep $delay" >>$file_in
exec $bin_chmod 700 $file_in
set timeout $max_job_delay
spawn $srun -N1 -o $file_out -b $file_in
expect {
-re "More nodes requested than permitted" {
send_user "\nFAILURE: srun read from the batch file options over writing the commandline options\n"
send_user "\nFAILURE: srun read from the batch file options"
send_user "over writing the commandline options\n"
set exit_code 1
exp_continue
}
...
...
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