Skip to content

Commit

Permalink
Changed the logger to silence boto correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sean Myers committed Jul 10, 2012
1 parent 9d672de commit e41bf45
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions emrio_lib/EMRio.py
Expand Up @@ -262,9 +262,8 @@ def get_owned_reserved_instances(EC2):
}
}
"""
logging.disable(logging.INFO)
logging.disable(logging.DEBUG)
logging.disable(logging.ERROR)
boto_logger = logging.getLogger('boto')
boto_logger.disabled = True
ec2_conn = boto.connect_ec2()
boto_reserved_instances = ec2_conn.get_all_reserved_instances()
ec2_conn.close()
Expand All @@ -274,7 +273,6 @@ def get_owned_reserved_instances(EC2):
instance_type = reserved_instance.instance_type
purchased_reserved_instances[utilization_class][instance_type] += (
reserved_instance.instance_count)
logging.disable(logging.NOTSET)
return purchased_reserved_instances


Expand Down
2 changes: 2 additions & 0 deletions emrio_lib/graph_jobs.py
Expand Up @@ -37,9 +37,11 @@ def show(self, total_usage=False, instance_usage=False):
Args:
total_usage: A boolean option to graph total hours used
over a job flow history.
instance_usage: A boolean option to graph instance usage
over a job flow history.
"""
self.plt = None
if total_usage or instance_usage:
import matplotlib.dates as mdates
import matplotlib.pyplot as plt
Expand Down
6 changes: 2 additions & 4 deletions emrio_lib/job_handler.py
Expand Up @@ -217,16 +217,14 @@ def describe_all_job_flows(emr_conn, states=None, jobflow_ids=None,
while True:
if created_before and created_after and created_before < created_after:
break
logging.disable(logging.DEBUG)
logging.disable(logging.ERROR)
logging.disable(logging.INFO)
boto_logger = logging.getLogger('boto')
boto_logger.disabled = True
try:
results = emr_conn.describe_jobflows(
states=states, jobflow_ids=jobflow_ids,
created_after=created_after, created_before=created_before)
except boto.exception.BotoServerError, ex:
if 'ValidationError' in ex.body:
logging.disable(logging.NOTSET)
break
else:
raise
Expand Down

0 comments on commit e41bf45

Please sign in to comment.