~thomir-deactivatedaccount/adt-cloud-worker/trunk-make-uci-nova-python

« back to all changes in this revision

Viewing changes to adt_cloud_worker/__init__.py

  • Committer: Ubuntu CI Bot
  • Author(s): Joe Talbott
  • Date: 2015-04-14 23:29:57 UTC
  • mfrom: (33.1.3 adt-cloud-worker)
  • Revision ID: ubuntu_ci_bot-20150414232957-cjf2gbwq8gr1ganp
Add log rotation and flake8 checking.  Fix flake8 issues as well. [r=Celso Providelo]

Show diffs side-by-side

added added

removed removed

Lines of Context:
138
138
 
139
139
 
140
140
def _create_run_metadata_file(directory, request):
141
 
    """Create a metadata file in 'directory' with some of the data from 'request'
 
141
    """Create a metadata file in 'directory' with some of the data from
 
142
    'request'.
142
143
 
143
144
    We want to make sure that, as (potentially confidential) items are added to
144
145
    the request that we don't blindly add them to the metadata file, so we
273
274
        os.path.join(__file__, '../../logs/adt-cloud-worker.log'))
274
275
    log_dir = os.path.dirname(log_path)
275
276
    if os.path.exists(log_dir):
276
 
        handler = logging.FileHandler(log_path)
 
277
        handler = logging.handlers.TimedRotatingFileHandler(
 
278
            log_path,
 
279
            when='D',
 
280
            interval=1
 
281
        )
277
282
    else:
278
283
        print("'logs' directory '{}' does not exist, using stderr "
279
284
              "for app log.".format(log_dir))