Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
HyperLoom
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ADAS
HyperLoom
Commits
a0dc1a90
Commit
a0dc1a90
authored
8 years ago
by
Ada Böhm
Browse files
Options
Downloads
Patches
Plain Diff
ENH: Capturing stderr in run tasks
parent
0dea3f96
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/libloom/tasks/runtask.cpp
+16
-6
16 additions, 6 deletions
src/libloom/tasks/runtask.cpp
src/libloom/tasks/runtask.h
+1
-0
1 addition, 0 deletions
src/libloom/tasks/runtask.h
with
17 additions
and
6 deletions
src/libloom/tasks/runtask.cpp
+
16
−
6
View file @
a0dc1a90
...
@@ -12,7 +12,7 @@
...
@@ -12,7 +12,7 @@
using
namespace
loom
;
using
namespace
loom
;
RunTask
::
RunTask
(
Worker
&
worker
,
std
::
unique_ptr
<
Task
>
task
)
RunTask
::
RunTask
(
Worker
&
worker
,
std
::
unique_ptr
<
Task
>
task
)
:
TaskInstance
(
worker
,
std
::
move
(
task
))
:
TaskInstance
(
worker
,
std
::
move
(
task
))
,
exit_status
(
0
)
{
{
}
}
...
@@ -60,11 +60,11 @@ void RunTask::start(DataVector &inputs)
...
@@ -60,11 +60,11 @@ void RunTask::start(DataVector &inputs)
}
}
/* Streams */
/* Streams */
uv_stdio_container_t
stdio
[
2
];
uv_stdio_container_t
stdio
[
3
];
options
.
stdio
=
stdio
;
options
.
stdio
=
stdio
;
stdio
[
0
].
flags
=
UV_IGNORE
;
stdio
[
0
].
flags
=
UV_IGNORE
;
stdio
[
1
].
flags
=
UV_IGNORE
;
stdio
[
1
].
flags
=
UV_IGNORE
;
options
.
stdio_count
=
2
;
options
.
stdio_count
=
3
;
assert
(
msg
.
map_inputs_size
()
<=
static_cast
<
int
>
(
inputs
.
size
()));
assert
(
msg
.
map_inputs_size
()
<=
static_cast
<
int
>
(
inputs
.
size
()));
...
@@ -103,6 +103,13 @@ void RunTask::start(DataVector &inputs)
...
@@ -103,6 +103,13 @@ void RunTask::start(DataVector &inputs)
}
}
}
}
int
stderr_fd
=
::
open
(
get_path
(
"+err"
).
c_str
(),
O_CREAT
|
O_RDWR
,
S_IRUSR
|
S_IWUSR
);
if
(
stderr_fd
<
0
)
{
log_errno_abort
(
"open +err:"
);
}
stdio
[
2
].
flags
=
UV_IGNORE
;
stdio
[
2
].
data
.
fd
=
stderr_fd
;
int
r
;
int
r
;
r
=
uv_spawn
(
worker
.
get_loop
(),
&
process
,
&
options
);
r
=
uv_spawn
(
worker
.
get_loop
(),
&
process
,
&
options
);
process
.
data
=
this
;
process
.
data
=
this
;
...
@@ -115,6 +122,8 @@ void RunTask::start(DataVector &inputs)
...
@@ -115,6 +122,8 @@ void RunTask::start(DataVector &inputs)
close
(
stdio
[
1
].
data
.
fd
);
close
(
stdio
[
1
].
data
.
fd
);
}
}
close
(
stderr_fd
);
if
(
r
)
{
if
(
r
)
{
fail_libuv
(
"uv_spawn"
,
r
);
fail_libuv
(
"uv_spawn"
,
r
);
return
;
return
;
...
@@ -128,15 +137,16 @@ std::string RunTask::get_path(const std::string &filename)
...
@@ -128,15 +137,16 @@ std::string RunTask::get_path(const std::string &filename)
void
RunTask
::
_on_exit
(
uv_process_t
*
process
,
int64_t
exit_status
,
int
term_signal
)
void
RunTask
::
_on_exit
(
uv_process_t
*
process
,
int64_t
exit_status
,
int
term_signal
)
{
{
//
RunTask *task = static_cast<RunTask*>(process->data);
RunTask
*
task
=
static_cast
<
RunTask
*>
(
process
->
data
);
as
sert
(
exit_status
=
=
0
)
;
t
as
k
->
exit_status
=
exit_status
;
uv_close
((
uv_handle_t
*
)
process
,
_on_close
);
uv_close
((
uv_handle_t
*
)
process
,
_on_close
);
}
}
void
RunTask
::
_on_close
(
uv_handle_t
*
handle
)
void
RunTask
::
_on_close
(
uv_handle_t
*
handle
)
{
{
RunTask
*
task
=
static_cast
<
RunTask
*>
(
handle
->
data
);
RunTask
*
task
=
static_cast
<
RunTask
*>
(
handle
->
data
);
llog
->
debug
(
"Process id={} finished."
,
task
->
get_id
());
llog
->
debug
(
"Process id={} finished (exit_status={})"
,
task
->
get_id
(),
task
->
exit_status
);
assert
(
task
->
exit_status
==
0
);
loomrun
::
Run
msg
;
loomrun
::
Run
msg
;
msg
.
ParseFromString
(
task
->
task
->
get_config
());
msg
.
ParseFromString
(
task
->
task
->
get_config
());
std
::
unique_ptr
<
Data
>
result
;
std
::
unique_ptr
<
Data
>
result
;
...
...
This diff is collapsed.
Click to expand it.
src/libloom/tasks/runtask.h
+
1
−
0
View file @
a0dc1a90
...
@@ -22,6 +22,7 @@ private:
...
@@ -22,6 +22,7 @@ private:
uv_process_t
process
;
uv_process_t
process
;
uv_pipe_t
pipes
[
2
];
uv_pipe_t
pipes
[
2
];
uv_write_t
write_request
;
uv_write_t
write_request
;
int64_t
exit_status
;
static
void
_on_exit
(
uv_process_t
*
process
,
int64_t
exit_status
,
int
term_signal
);
static
void
_on_exit
(
uv_process_t
*
process
,
int64_t
exit_status
,
int
term_signal
);
static
void
_on_close
(
uv_handle_t
*
handle
);
static
void
_on_close
(
uv_handle_t
*
handle
);
...
...
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