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

projects: don't explode trying to update UpdateDocsTaskStep state #4485

Merged

Conversation

@xrmx
Copy link
Contributor

@xrmx xrmx commented Aug 7, 2018

If an exception is raised before run_setup has been called we try to update the setup_env that is not here.

Traceback (most recent call last):
  File "/readthedocs/projects/tasks.py", line 313, in run
    self.version = self.get_version(self.project, version_pk)
  File "/readthedocs/projects/tasks.py", line 84, in get_version
    version_data = api_v2.version(version_pk).get()
  File "/lib/python3.5/site-packages/slumber/__init__.py", line 155, in get
    resp = self._request("GET", params=kwargs)
  File "/lib/python3.5/site-packages/slumber/__init__.py", line 101, in _request
    raise exception_class("Client Error %s: %s" % (resp.status_code, url), response=resp, content=resp.content)
slumber.exceptions.HttpNotFoundError: Client Error 404: http://localhost:8002/api/v2/version/868/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/docsitalia/management/commands/rebuild_projects.py", line 33, in handle
    task.run(version.project.pk, version_pk=version.pk, build_pk=build.pk)
  File "/readthedocs/projects/tasks.py", line 332, in run
    build_id=build_pk,
AttributeError: 'UpdateDocsTaskStep' object has no attribute 'setup_env'
Copy link
Member

@humitos humitos left a comment

Thanks!

I found this while working on another issue and wrote a comment in this PR: #3864

In that PR, I mentioned that this happens for the self.setup_env but also a couple of lines below with self.build_env. It may worth to add the same checking there also.

Loading

If we don't have it because setup_env hasn't been called yet.

Traceback (most recent call last):
  File "/readthedocs/projects/tasks.py", line 313, in run
    self.version = self.get_version(self.project, version_pk)
  File "/readthedocs/projects/tasks.py", line 84, in get_version
    version_data = api_v2.version(version_pk).get()
  File "/lib/python3.5/site-packages/slumber/__init__.py", line 155, in get
    resp = self._request("GET", params=kwargs)
  File "/lib/python3.5/site-packages/slumber/__init__.py", line 101, in _request
    raise exception_class("Client Error %s: %s" % (resp.status_code, url), response=resp, content=resp.content)
slumber.exceptions.HttpNotFoundError: Client Error 404: http://localhost:8002/api/v2/version/868/

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/docsitalia/management/commands/rebuild_projects.py", line 33, in handle
    task.run(version.project.pk, version_pk=version.pk, build_pk=build.pk)
  File "/readthedocs/projects/tasks.py", line 332, in run
    build_id=build_pk,
AttributeError: 'UpdateDocsTaskStep' object has no attribute 'setup_env'

While at it do the same for build_env that may be not set if run_build
fail early.
@xrmx xrmx force-pushed the dontassumebuildsetupenvupstream branch from 4be391d to ac37f53 Aug 7, 2018
@xrmx
Copy link
Contributor Author

@xrmx xrmx commented Aug 7, 2018

Update the PR to check also for build_env.

Loading

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Aug 22, 2018

Looks good. I think we need to think through this more, but 👍 on having the short-term fix.

Loading

@ericholscher ericholscher merged commit ae26ef8 into readthedocs:master Aug 22, 2018
1 check passed
Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants