diff --git a/readthedocs/projects/tasks/builds.py b/readthedocs/projects/tasks/builds.py index 08605fcdb76..b1c7698cbf5 100644 --- a/readthedocs/projects/tasks/builds.py +++ b/readthedocs/projects/tasks/builds.py @@ -430,7 +430,7 @@ def before_start(self, task_id, args, kwargs): # once we don't need to rely on `self.data.project`. if self.data.project.has_feature(Feature.SCALE_IN_PROTECTION): set_builder_scale_in_protection.delay( - instance=socket.gethostname(), + builder=socket.gethostname(), protected_from_scale_in=True, ) @@ -746,7 +746,7 @@ def after_return(self, status, retval, task_id, args, kwargs, einfo): # Disable scale-in protection on this instance if self.data.project.has_feature(Feature.SCALE_IN_PROTECTION): set_builder_scale_in_protection.delay( - instance=socket.gethostname(), + builder=socket.gethostname(), protected_from_scale_in=False, ) diff --git a/readthedocs/projects/tasks/utils.py b/readthedocs/projects/tasks/utils.py index e157f14051b..fff72b9e833 100644 --- a/readthedocs/projects/tasks/utils.py +++ b/readthedocs/projects/tasks/utils.py @@ -165,14 +165,14 @@ def send_external_build_status(version_type, build_pk, commit, status): @app.task(queue="web") -def set_builder_scale_in_protection(instance, protected_from_scale_in): +def set_builder_scale_in_protection(builder, protected_from_scale_in): """ - Set scale-in protection on this builder ``instance``. + Set scale-in protection on this builder ``builder``. - This way, AWS will not scale-in this instance while it's building the documentation. + This way, AWS will not scale-in this builder while it's building the documentation. This is pretty useful for long running tasks. """ - log.bind(instance=instance, protected_from_scale_in=protected_from_scale_in) + log.bind(builder=builder, protected_from_scale_in=protected_from_scale_in) if settings.DEBUG or settings.RTD_DOCKER_COMPOSE: log.info( @@ -188,7 +188,7 @@ def set_builder_scale_in_protection(instance, protected_from_scale_in): ) # web-extra-i-0c3e866c4e323928f - hostname_match = re.match(r"([a-z\-]+)-(i-[a-f0-9]+)", instance) + hostname_match = re.match(r"([a-z\-]+)-(i-[a-f0-9]+)", builder) if not hostname_match: log.warning( "Unable to set scale-in protection. Hostname name matching not found.",