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

Remove usage of project.documentation_type in tasks #4896

Merged

Conversation

@stsewd
Copy link
Member

@stsewd stsewd commented Nov 12, 2018

This depends on #4895, because we check if search/epub/pdf is supported by sphinx there

Ref #4638

@@ -828,7 +831,7 @@ def is_type_sphinx(self):

# Web tasks
@app.task(queue='web')
def sync_files(project_pk, version_pk, hostname=None, html=False,
def sync_files(project_pk, version_pk, doctype, hostname=None, html=False,
Copy link
Member Author

@stsewd stsewd Nov 12, 2018

I'm passing only the doctype here rather than the whole config object, we only use the doctype, but if someone thinks it's useful passing the config I can change it.

@codecov
Copy link

@codecov codecov bot commented Nov 12, 2018

Codecov Report

No coverage uploaded for pull request base (master@aace732). Click here to learn what that means.
The diff coverage is 90.47%.

@@            Coverage Diff            @@
##             master    #4896   +/-   ##
=========================================
  Coverage          ?   76.86%           
=========================================
  Files             ?      158           
  Lines             ?    10042           
  Branches          ?     1267           
=========================================
  Hits              ?     7719           
  Misses            ?     1983           
  Partials          ?      340
Impacted Files Coverage Δ
readthedocs/projects/tasks.py 75.75% <90.47%> (ø)

@stsewd
Copy link
Member Author

@stsewd stsewd commented Nov 12, 2018

Looks like I touched an untested code, need to figure out where to add the tests

@stsewd
Copy link
Member Author

@stsewd stsewd commented Nov 13, 2018

Need to add more tests for the test god

@stsewd stsewd requested a review from Nov 13, 2018
@stsewd
Copy link
Member Author

@stsewd stsewd commented Nov 13, 2018

The last commits added the missing tests here

Copy link
Contributor

@agjohnson agjohnson left a comment

I think passing a dict of the validated config would be cleaner, but I don't have any strong opinions about it. If there are potentially any other cases where we'll need more access to the config dict in these tasks, lets just pass a dict object.

readthedocs/projects/tasks.py Outdated Show resolved Hide resolved
update_search(
version.pk,
commit,
doctype=version.project.documentation_type,
Copy link
Member Author

@stsewd stsewd Nov 15, 2018

@agjohnson this is the only place that I'm worried about passing a config object, we don't have one here.

@humitos
Copy link
Member

@humitos humitos commented Dec 17, 2018

We need to decide what to do with these projects: shouldn't we update this to say sphinx here and avoid this issues?

In [6]: Project.objects.filter(documentation_type='auto').count()
Out[6]: 514

We can also remove this chunk of code, https://github.com/rtfd/readthedocs.org/blob/4cf6a2ee8a86d6366e726ac53d696f3bae7dbdba/readthedocs/projects/models.py#L273-L277

Sentry issue: https://sentry.io/read-the-docs/readthedocs-org/issues/785965991/

@stsewd
Copy link
Member Author

@stsewd stsewd commented Dec 17, 2018

@humitos I can do another PR to solve that.

@stsewd stsewd mentioned this pull request Dec 17, 2018
Copy link
Member

@ericholscher ericholscher left a comment

Seems reasonable. Feels like a lot of work to be sending the doctype around, where we don't use it much. I wonder if we can make the update_search function smarter so it can just figure out which type of docs they are, instead of passing it around a bunch before getting there.

readthedocs/projects/tasks.py Show resolved Hide resolved
@stsewd
Copy link
Member Author

@stsewd stsewd commented Jan 15, 2019

I wonder if we can make the update_search function smarter so it can just figure out which type of docs they are

Yeah, I'm getting more familiar with those bits of code here, but I guess we could kind of drop the usage of doctype to make some decisions here.

@ericholscher
Copy link
Member

@ericholscher ericholscher commented Jan 22, 2019

This should be updated once #5121 passes and it should then be much simpler I think 👍

include_file=False,
)
Syncer.copy(from_path, to_path, host=hostname)
# Always move PDF's because the return code lies.
Copy link
Member Author

@stsewd stsewd Jan 23, 2019

This comment looks outdated

@ericholscher ericholscher merged commit 4f7e9ff into readthedocs:master Jan 23, 2019
1 check passed
@stsewd stsewd mentioned this pull request Jan 23, 2019
@stsewd stsewd deleted the remove-usage-of-project-doctype branch Jan 28, 2019
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

5 participants