Changeset 4900 for waeup/trunk


Ignore:
Timestamp:
27 Jan 2010, 12:10:03 (15 years ago)
Author:
uli
Message:

Create the .pending and .finished files in a temporary directory. This
way they can only be seen after operations finished.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • waeup/trunk/src/waeup/utils/batching.py

    r4894 r4900  
    99import os
    1010import sys
     11import tempfile
    1112import time
    1213from zope.component import createObject
     
    203204        logger.info("%s: User: %s" % (user, user))
    204205        if warnings > 0:
    205             logger.info("%s: Failed datasets: %s" % (user, fail_path))
     206            logger.info("%s: Failed datasets: %s" % (
     207                    user, os.path.basename(fail_path)))
    206208        logger.info("%s: Processing time: %0.3f s (%0.4f s/item)" % (
    207209                user, timedelta, timedelta/(num or 1)))
     
    234236        reader = csv.DictReader(open(path, 'rb'))
    235237
     238        temp_dir = tempfile.mkdtemp()
     239       
    236240        (base, ext) = os.path.splitext(path)
    237         failed_path = "%s.pending%s" % (base, ext)
     241        failed_path = os.path.join(temp_dir, "%s.pending%s" % (base, ext))
    238242        failed_headers = [x for x in mapping.values()]
    239243        failed_headers.append('--ERRORS--')
     
    242246        failed_writer.writerow(dict([(x,x) for x in failed_headers]))
    243247
    244         finished_path = "%s.finished%s" % (base, ext)
     248        finished_path = os.path.join(temp_dir, "%s.finished%s" % (base, ext))
    245249        finished_headers = [x for x in mapping.values()]
    246250        finished_writer = csv.DictWriter(open(finished_path, 'wb'),
Note: See TracChangeset for help on using the changeset viewer.