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

Update Build state at the end of UpdateDocsTask.run #3293

Merged
merged 5 commits into from
Nov 23, 2017

Conversation

humitos
Copy link
Member

@humitos humitos commented Nov 21, 2017

Use the update_build method that handles most of the cases but fill
the failure with a unhandled exception in case it was risen.

Related to #3292

Use the `update_build` method that handles most of the cases but fill
the `failure` with a unhandled exception in case it was risen.
@agjohnson agjohnson added this to the Build stability milestone Nov 21, 2017
))
finally:
if unhandled_failure:
self.build_env.build['failure'] = unhandled_failure
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this supposed to be build['error']?

Also, how is build['error'] = failure being set? Seems this would lose normal build errors, no?

It might be good to put some new tests in to test for these failure cases.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is this supposed to be build['error']?

Yes. I got confused with the name.

self.build_env.build['failure'] = unhandled_failure
self.build_env.update_build(BUILD_STATE_FINISHED)

return self.get_build(build_pk)
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be best to leave the return logic here, I'm not sure anything is depending on it though

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it's the same since the code that was here, was returning the response of the patch request to the build endpoint.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh and i missed that we're not doing the api request here anyways, and can't get the response directly.

Instead of hitting the API again, maybe return the build_env.build object?

Copy link
Member Author

Choose a reason for hiding this comment

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

It should be the same, yeah.

@@ -116,6 +116,8 @@ def run(self, pk, version_pk=None, build_pk=None, record=True,

This is fully wrapped in exception handling to account for a number of failure cases.
"""
unhandled_failure = False
Copy link
Member

Choose a reason for hiding this comment

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

Its good to store blank string here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Why not False?

My idea is "if it's False, nothing happens. If it's the user message, and unhandled exception happens"

Copy link
Contributor

Choose a reason for hiding this comment

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

The argument for string is probably that we're treating it as a string below, which will reduce confusion to our future selves :)

Copy link
Member Author

Choose a reason for hiding this comment

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

I personally don't like to do if '': but I will change to that if you think it's better.

@humitos
Copy link
Member Author

humitos commented Nov 22, 2017

After merging #3292, I'm not sure that this PR makes sense anymore. Since it fixes the same issue but in a different way (a bit cleaner for me -it always update the build status in just one place not matter what has happened).

@agjohnson
Copy link
Contributor

Yeah, I agree now. I thought that #3292 wasn't overlapping with this. After reading the same code though, I'd like to get this logic in place, it makes much more sense.

@agjohnson agjohnson merged commit fef1abf into master Nov 23, 2017
@agjohnson agjohnson deleted the humitos/fix/issue3285-2 branch November 23, 2017 19:41
kakulukia added a commit to kakulukia/readthedocs.org that referenced this pull request Nov 24, 2017
* 'master' of github.com:rtfd/readthedocs.org:
  Fix shitpost
  Fix copypasta issue with supervisord config
  Update Build state at the end of UpdateDocsTask.run (readthedocs#3293)
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.

3 participants