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

Refactor tasks into decorators #4666

Merged
merged 5 commits into from Oct 2, 2018

Conversation

Projects
None yet
2 participants
@stsewd
Member

stsewd commented Sep 26, 2018

Closes #3973

This will also helps with #3984 later

step = UpdateDocsTaskStep(task=self)
return step.run(*args, **kwargs)
@app.task(bind=True, max_retries=5, default_retry_delay=7 * 60)
def update_docs_task(self, project_id, *args, **kwargs):

This comment has been minimized.

@stsewd

stsewd Sep 26, 2018

Member

Pylint doesn't like binded task, the self parameter gets injected by the decorator.

@stsewd

stsewd Sep 26, 2018

Member

Pylint doesn't like binded task, the self parameter gets injected by the decorator.

tasks.SyncRepositoryTask().run(
version.pk,
)
tasks.sync_repository_task(version.pk)

This comment has been minimized.

@stsewd

stsewd Sep 26, 2018

Member

I assume that calling directly to run is the same as executing the task on the same host.

@stsewd

stsewd Sep 26, 2018

Member

I assume that calling directly to run is the same as executing the task on the same host.

This comment has been minimized.

@agjohnson

agjohnson Oct 2, 2018

Contributor

Yeah, this should be equal

@agjohnson

agjohnson Oct 2, 2018

Contributor

Yeah, this should be equal

@stsewd

This comment has been minimized.

Show comment
Hide comment
@stsewd

stsewd Sep 26, 2018

Member

I think this is ready, we can refactor more: classes aren't needed here, we can refactor those to be just functions. Let me know if you want me to do that here, or maybe we can do it in another PR.

Also, I tested with some builds locally (also some commands), it works.

Member

stsewd commented Sep 26, 2018

I think this is ready, we can refactor more: classes aren't needed here, we can refactor those to be just functions. Let me know if you want me to do that here, or maybe we can do it in another PR.

Also, I tested with some builds locally (also some commands), it works.

@agjohnson

Another nice clean refactor 👍

I did a quick scan on our commercial hosting code, and I don't think we rely on any of the classes here. This probably won't break things, but we'll need some QA here as well.

tasks.SyncRepositoryTask().run(
version.pk,
)
tasks.sync_repository_task(version.pk)

This comment has been minimized.

@agjohnson

agjohnson Oct 2, 2018

Contributor

Yeah, this should be equal

@agjohnson

agjohnson Oct 2, 2018

Contributor

Yeah, this should be equal

@stsewd

This comment has been minimized.

Show comment
Hide comment
@stsewd

stsewd Oct 2, 2018

Member

Looks like need to fix some linter errors

Member

stsewd commented Oct 2, 2018

Looks like need to fix some linter errors

@agjohnson

This comment has been minimized.

Show comment
Hide comment
@agjohnson

agjohnson Oct 2, 2018

Contributor

Yeah i think in part due to my resolve. Seems to be okay now though

Contributor

agjohnson commented Oct 2, 2018

Yeah i think in part due to my resolve. Seems to be okay now though

@agjohnson agjohnson merged commit a984417 into rtfd:master Oct 2, 2018

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
@stsewd

This comment has been minimized.

Show comment
Hide comment
@stsewd

stsewd Oct 2, 2018

Member

Error fixed, it was because of #4653

Member

stsewd commented Oct 2, 2018

Error fixed, it was because of #4653

@stsewd stsewd deleted the stsewd:refactor-project-tasks-to-decorators branch Oct 2, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment