Changeset 4891


Ignore:
Timestamp:
25 Jan 2010, 08:31:22 (15 years ago)
Author:
uli
Message:

Create a 'finished' file of successful items with batch operations.

File:
1 edited

Legend:

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

    r4889 r4891  
    241241                                       failed_headers)
    242242        failed_writer.writerow(dict([(x,x) for x in failed_headers]))
     243
     244        finished_path = "%s.%s.finished%s" % (base, mode, ext)
     245        finished_headers = [x for x in mapping.values()]
     246        finished_writer = csv.DictWriter(open(finished_path, 'wb'),
     247                                         finished_headers)
     248        finished_writer.writerow(dict([(x,x) for x in finished_headers]))
    243249       
    244250        num =0
     
    289295                    continue
    290296                self.updateEntry(obj, row, site)
     297            finished_writer.writerow(string_row)
    291298
    292299        time_end = time.time()
    293300        timedelta = time_end - time_start
    294301       
    295         if path.endswith('.pending'):
     302        if path.endswith('.pending.csv'):
    296303            os.unlink(path)
    297304            os.rename(failed_path, path)
Note: See TracChangeset for help on using the changeset viewer.