Skip to content

Instantly share code, notes, and snippets.

@simon-weber
simon-weber / disable_troublesom_scaling_processes.py
Created August 26, 2016 19:28
disable ASG scaling processes during CodeDeploy deploys
"""
Suspend an auto scaling group's scaling processes that can interfere with CodeDeploy deploys.
It assumes a single ASG per deployment group.
To use this:
* create a lambda function with this code, then hook up it up to an SNS topic that receives all deployment events (but not host events).
* attach that topic as a trigger in your deployment groups.
Unlike AWS's in-appspec approach, this supports arbitrary deploy concurrency.
@simon-weber
simon-weber / logutil.py
Created December 8, 2013 03:48
A context manager to temporarily disable all logging in Python that supports previous calls to logging.disable.
from contextlib import contextmanager
import logging
@contextmanager
def all_logging_disabled(highest_level=logging.CRITICAL):
"""
A context manager that will prevent any logging messages
triggered during the body from being processed.
:param highest_level: the maximum logging level in use.