-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Move move_files to a broadcast model. #2946
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
Conversation
05f20b4
to
804b4aa
Compare
Looks like tests are failing. I'll set this back to WIP until ready for review. |
This will require an update to the Settings in prod, to default a RemotePuller instead of the DoubleRemotePuller
804b4aa
to
964e09b
Compare
Tested fixed. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! This feels like a good amount of cruft to clean up and refactor.
@@ -163,7 +163,7 @@ def save(self, *args, **kwargs): # pylint: disable=arguments-differ | |||
def delete(self, *args, **kwargs): # pylint: disable=arguments-differ | |||
from readthedocs.projects import tasks | |||
log.info('Removing files for version %s', self.slug) | |||
tasks.clear_artifacts.delay(version_pk=self.pk) | |||
broadcast(type='app', task=tasks.clear_artifacts, args=[self.pk]) | |||
broadcast(type='app', task=tasks.symlink_project, args=[self.project.pk]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we were using a newer version of celery, this would be a good case for chaining the tasks:
http://docs.celeryproject.org/en/latest/userguide/canvas.html#chains
I'd like to use more celery features, if we can get around to upgrading celery at some point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aye. Would be useful for a few things.
@@ -909,7 +909,7 @@ def remove_dir(path): | |||
shutil.rmtree(path, ignore_errors=True) | |||
|
|||
|
|||
@task(queue='web') | |||
@task() | |||
def clear_artifacts(version_pk): | |||
"""Remove artifacts from the web servers""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If not running on just the web queue, docs need updating here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It will still only work on the web servers, but instead run on the web0[1-4]
queues instead of the generic web queue.
This will require an update to the Settings in prod, to default a
RemotePuller instead of the DoubleRemotePuller