- Timestamp:
- 18 Feb 2008, 20:28:57 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
WAeUP_SRP/base/WAeUPTool.py
r3180 r3181 1373 1373 info = importer.info 1374 1374 data_keys = importer.data_keys 1375 csv_keys = importer.csv_keys 1375 csv_keys = importer.csv_keys 1376 1376 #csv_keys.extend(info.keys()) 1377 1377 headline_mapping = dict((k,k) for k in csv_keys) … … 1449 1449 items = [item for item in reader] 1450 1450 total_to_import = len(items) 1451 tti_float = float(total_to_import) 1451 tti_float = float(total_to_import) 1452 1452 if pending_only: 1453 1453 pending_at_start = total_to_import … … 1494 1494 error = results[1] 1495 1495 mapping = results[2] 1496 data_string = ", ".join("%s: %s" % (k,v) for k,v in mapping.items())1496 data_string = ", ".join("%s: %s" % (k,v) for k,v in mapping.items()) 1497 1497 info['error'] = error 1498 1498 mapping.update(info) … … 1506 1506 pending.append(mapping) 1507 1507 if not pending_only: 1508 log_list += " added to %(pending_fn)s%(data_string)s" % vars(),1508 log_list += "record added to %(pending_fn)s, %(data_string)s" % vars(), 1509 1509 #logger.info("%(percent_finished)6.3f %% done added to %(pending_fn)s %(data_string)s" % vars()) 1510 1510 else: … … 1515 1515 imported_count += 1 1516 1516 imported += mapping, 1517 log_list += " imported and added to %(imported_fn)s%(data_string)s" % vars(),1517 log_list += "record imported and added to %(imported_fn)s, %(data_string)s" % vars(), 1518 1518 #percent_finished = (with_error_count + imported_count)/tti_float*100 1519 1519 #logger.info("%(percent_finished)6.3f %% done imported and added to %(imported_fn)s %(data_string)s" % vars()) … … 1521 1521 time_till_now = time.time() - elapse 1522 1522 percent_finished = (with_error_count + imported_count)/tti_float*100 1523 log_list.insert(0,("%(percent_finished)6.3f %% done in %(time_till_now)3.2f secs" % vars()),)1523 log_list.insert(0,("%(percent_finished)6.3f %% done in %(time_till_now)3.2fs," % vars()),) 1524 1524 logger.info(' '.join(log_list)) 1525 1525 finished = count > total_to_import - 1 … … 1529 1529 must_commit = True 1530 1530 old_commit_count = len(imported) 1531 1531 1532 1532 if must_commit or finished: 1533 1533 if len(imported): … … 1556 1556 elapse = time.time() - elapse 1557 1557 copy2(pending_tmp,pending_path) 1558 msg = " Finished importing in %(mode)s mode from %(import_source_fn)s in %(elapse)6.2f seconds:" % vars()1559 msg += " read = %(count)d; %(imported_fn)s: added = %(total_added_to_imported)d;" % vars()1558 msg = "finished importing in %(mode)s mode from %(import_source_fn)s in %(elapse)6.2f seconds, " % vars() 1559 msg += "%(count)d records totally read, %(total_added_to_imported)d added to %(imported_fn)s, " % vars() 1560 1560 if pending_only: 1561 1561 removed_pending = pending_at_start - total_pending 1562 msg += "%( pending_fn)s: removed = %(removed_pending)d, " % vars()1562 msg += "%(removed_pending)d removed from %(pending_fn)s, " % vars() 1563 1563 else: 1564 added_pending = total_pending - pending_at_start 1565 msg += "%( pending_fn)s: added = %(added_pending)d, already in = %(already_in)s," % vars()1566 msg += " total %(total_pending)d; " % vars()1564 added_pending = total_pending - pending_at_start 1565 msg += "%(added_pending)d added to %(pending_fn)s, %(already_in)s already in %(pending_fn)s" % vars() 1566 #msg += "%(total_pending)d totally written" % vars() # this line does not make any sense 1567 1567 logger.info(msg) 1568 1568 os.remove(pending_tmp)
Note: See TracChangeset for help on using the changeset viewer.