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
13bd6d3e
Commit
13bd6d3e
authored
22 years ago
by
Mark Grondona
Browse files
Options
Downloads
Patches
Plain Diff
o fix for persistent io thread
parent
ba7e1543
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/srun/io.c
+11
-3
11 additions, 3 deletions
src/srun/io.c
with
11 additions
and
3 deletions
src/srun/io.c
+
11
−
3
View file @
13bd6d3e
...
@@ -21,6 +21,7 @@
...
@@ -21,6 +21,7 @@
#include
"net.h"
#include
"net.h"
#define IO_BUFSIZ 2048
#define IO_BUFSIZ 2048
#define IO_DONE -9
/* signify that eof has been recvd on stream */
static
void
_accept_io_stream
(
job_t
*
job
);
static
void
_accept_io_stream
(
job_t
*
job
);
static
int
_handle_task_output
(
int
*
fd
,
FILE
*
out
,
int
tasknum
);
static
int
_handle_task_output
(
int
*
fd
,
FILE
*
out
,
int
tasknum
);
...
@@ -48,6 +49,7 @@ void *io_thr(void *job_arg)
...
@@ -48,6 +49,7 @@ void *io_thr(void *job_arg)
}
}
while
(
1
)
{
while
(
1
)
{
unsigned
long
eofcnt
=
0
;
FD_ZERO
(
&
rset
);
FD_ZERO
(
&
rset
);
FD_ZERO
(
&
wset
);
FD_ZERO
(
&
wset
);
...
@@ -63,11 +65,17 @@ void *io_thr(void *job_arg)
...
@@ -63,11 +65,17 @@ void *io_thr(void *job_arg)
FD_SET
(
job
->
out
[
i
],
&
rset
);
FD_SET
(
job
->
out
[
i
],
&
rset
);
if
(
job
->
err
[
i
]
>
0
)
if
(
job
->
err
[
i
]
>
0
)
FD_SET
(
job
->
err
[
i
],
&
rset
);
FD_SET
(
job
->
err
[
i
],
&
rset
);
if
(
job
->
out
[
i
]
==
IO_DONE
&&
job
->
err
[
i
]
==
IO_DONE
)
eofcnt
++
;
}
}
/* exit if we have recieved eof on all streams */
if
(
eofcnt
==
opt
.
nprocs
)
pthread_exit
(
0
);
tv
.
tv_sec
=
0
;
tv
.
tv_sec
=
0
;
tv
.
tv_usec
=
500
;
tv
.
tv_usec
=
500
;
while
((
m
=
select
(
maxfd
+
1
,
&
rset
,
NULL
,
NULL
,
NULL
))
<
0
)
{
while
((
m
=
select
(
maxfd
+
1
,
&
rset
,
NULL
,
NULL
,
&
tv
))
<
0
)
{
if
(
errno
!=
EINTR
)
if
(
errno
!=
EINTR
)
fatal
(
"Unable to handle I/O: %m"
,
errno
);
fatal
(
"Unable to handle I/O: %m"
,
errno
);
}
}
...
@@ -148,10 +156,10 @@ _handle_task_output(int *fd, FILE *out, int tasknum)
...
@@ -148,10 +156,10 @@ _handle_task_output(int *fd, FILE *out, int tasknum)
if
((
len
=
_readx
(
*
fd
,
buf
,
IO_BUFSIZ
))
<=
0
)
{
if
((
len
=
_readx
(
*
fd
,
buf
,
IO_BUFSIZ
))
<=
0
)
{
debug
(
"%d: <%s disconnected>"
,
tasknum
,
debug
(
"%d: <%s disconnected>"
,
tasknum
,
out
==
stdout
?
"stdout"
:
"stderr"
);
out
==
stdout
?
"stdout"
:
"stderr"
);
fflush
(
stderr
);
fflush
(
out
);
shutdown
(
*
fd
,
SHUT_RDWR
);
shutdown
(
*
fd
,
SHUT_RDWR
);
close
(
*
fd
);
close
(
*
fd
);
*
fd
=
-
1
;
*
fd
=
IO_DONE
;
}
}
p
=
buf
;
p
=
buf
;
...
...
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