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

Include FAILED and UPSTREAM_FAILED tasks in count_pending #1926

Merged
merged 3 commits into from
Dec 1, 2016

Conversation

daveFNbuck
Copy link
Contributor

@daveFNbuck daveFNbuck commented Nov 21, 2016

Description

Reverts #1789 and replaces it by counting FAILED tasks in count_pending

Motivation and Context

#1789 was meant to allow workers to stay alive in order to keep working on FAILED tasks after they become PENDING again. The approach in that PR didn't really work well, as it missed cases where the root task is failed or where all leaf tasks are failed. Instead, we just directly count FAILED tasks as part of the pending count, as well as counting UPSTREAM_FAILED tasks as PENDING. UPSTREAM_DISABLED tasks are still not counted, even if only one dependency is DISABLED.

Have you tested this? If so, how?

I have included unit tests.

@mention-bot
Copy link

@daveFNbuck, thanks for your PR! By analyzing the history of the files in this pull request, we identified @javrasya, @Tarrasch and @erikbern to be potential reviewers.

@daveFNbuck daveFNbuck changed the title Failed are pending Include FAILED and UPSTREAM_FAILED tasks in count_pending Nov 21, 2016
Copy link
Contributor

@Tarrasch Tarrasch left a comment

Choose a reason for hiding this comment

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

The approach in that PR didn't really work well, as it missed cases where the root task is failed or where all leaf tasks are failed

Oh really? It makes sense wen you say it. I suppose it was quite a blunder from our side.

@@ -363,17 +363,19 @@ def prune(self, config):
if self.last_active + config.worker_disconnect_delay < time.time():
return True

def get_pending_tasks(self, state):
def get_pending_tasks(self, state, include_failed=False):
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to instead implement a get_statuses([list of statuses])? I've always found it a bit weird that get_pending_tasks also returns running tasks. This could be an opportunity to fix that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I'll try to do that tomorrow.

@@ -1774,7 +1793,7 @@ def requires(self):

self.assertTrue(w3.run())
self.assertFalse(w2.run())
self.assertFalse(w1.run())
self.assertTrue(w1.run())
Copy link
Contributor

Choose a reason for hiding this comment

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

Just briefly, what changed here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm actually not sure what happened here. I was planning to look into it but forgot.

@Tarrasch
Copy link
Contributor

Nice refactoring. I think the code is more readable now! :)

These functions are just special cases of more general functions to fetch
tasks by status, so we just implement those instead.
@daveFNbuck
Copy link
Contributor Author

ping

@Tarrasch Tarrasch merged commit 3a38571 into spotify:master Dec 1, 2016
@Tarrasch
Copy link
Contributor

Tarrasch commented Dec 1, 2016

Thanks!

@daveFNbuck daveFNbuck deleted the failed_are_pending branch December 1, 2016 20:58
@daveFNbuck
Copy link
Contributor Author

No problem, just trying to clean up :)

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.

None yet

3 participants