Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/vert timeouts #11

Merged
merged 3 commits into from
Jun 15, 2018
Merged

Feature/vert timeouts #11

merged 3 commits into from
Jun 15, 2018

Conversation

rkallos
Copy link
Owner

@rkallos rkallos commented Jun 8, 2018

Fix #10.

This works is by changing exec:run/2 to exec:run_link/2, causing erlexec to kill
the OS pid when the erlang Pid exits.
end,

#{count := Count} = Map,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any particular reason you are using indirect matching to get Count here? I mean, for other test cases you match directly against #{count := Cnt} -> Cnt in the receive clause.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No real reason. Fixed!


FailMsgs = lists:filter(fun
(#wrek_event{type = {wrek, error}, msg = {vert, _}}) -> true;
(#wrek_event{type = {vert, done}, msg = timeout}) -> true;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, if any vertex times out, then we will have an error event for the graph, plus a done event with timeout message for the corresponding vertex, right?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. The done event with timeout is sent by a wrek_vert process, and after shutting down with {shutdown, timeout}, which does not match {shutdown, {ok, _}}, a wrek process will emit a error event.

gen_event:stop(EvMgr),

% {wrek, start} +
% ({starting_vert}, {vert, start}, {vert, done}) * #ok_verts +
% ({starting_vert}, {vert, start}, {exec, exit_status}, {vert, done}) * #bad_verts +
% {wrek, done} =
% (3 * #ok_verts) + (4 * #bad_verts) + 2
?assertEqual((3 * maps:size(VertMap)) + 3, Count).
?assertEqual((3 * maps:size(VertMap)) + 2, Count).

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is my understanding that in this test case, there are 3 ok vertices and 1 bad vertex. If that is true, then it seems like the assertion does not comply with the formula in the comments.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a bad test. I guess there's no time like the present to rewrite it!

} = State,
wrek_event:vert_done(EvMgr, Id, timeout),
{stop, {shutdown, timeout}, State};

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, with total failure mode, this will terminate the whole graph, whereas with partial failure mode this will terminate this vertex only (and any others that depend on it), right? I mean once this is merged.
If the above is correct, then this timeout feature is essentially a timeout for individual vertices (which is good).

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Timeouts are meant to be set on individual vertices. It would be possible to have a timeout for an entire wrek, but right now it is implicitly the sum of the vertex timeouts in the critical path.

@@ -24,13 +24,14 @@ exec(Dir0, Cmd0, Env, EventFun) ->
sync,
{cd, Dir},
{env, Env},
{kill_timeout, 0},

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is kill_timeout used?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kill_timeout is an option for erlexec that governs how long to wait for a child OS process to exit gracefully after a SIGTERM before sending a SIGKILL.

- Replace lists:filter calls with list comprehensions
- Split test that counts number of events
@rkallos rkallos merged commit a1c71d3 into master Jun 15, 2018
@rkallos rkallos deleted the feature/vert-timeouts branch June 15, 2018 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants