def iterate_over_new(recIDs, fmt): """ Iterate over list of IDs @param list: the list of record IDs to format @param fmt: the output format to use @return: tuple (total number of records, time taken to format, time taken to insert) """ tbibformat = 0 # time taken up by external call tbibupload = 0 # time taken up by external call tot = len(recIDs) for count, recID in enumerate(recIDs): t1 = os.times()[4] formatted_record, needs_2nd_pass = format_record_1st_pass(recID=recID, of=fmt, on_the_fly=True, save_missing=False) save_preformatted_record(recID=recID, of=fmt, res=formatted_record, needs_2nd_pass=needs_2nd_pass, low_priority=True) t2 = os.times()[4] tbibformat += t2 - t1 if count % 100 == 0: write_message(" ... formatted %s records out of %s" % (count, tot)) task_update_progress('Formatted %s out of %s' % (count, tot)) task_sleep_now_if_required(can_stop_too=True) if tot % 100 != 0: write_message(" ... formatted %s records out of %s" % (tot, tot)) return tot, tbibformat, tbibupload
def _update_format(recid, fmt): """Usual format update procedure, gets the formatted record and saves it. :param int recid: record id to process :param str fmt: format to update/create, i.e. 'HB' """ record, needs_2nd_pass = format_record_1st_pass(recID=recid, of=fmt, on_the_fly=True, save_missing=False) save_preformatted_record(recID=recid, of=fmt, res=record, needs_2nd_pass=needs_2nd_pass, low_priority=True)
def _update_format(recid, fmt): """Usual format update procedure, gets the formatted record and saves it. :param int recid: record id to process :param str fmt: format to update/create, i.e. 'HB' """ record, needs_2nd_pass = format_record_1st_pass(recID=recid, of=fmt, on_the_fly=True, save_missing=False) save_preformatted_record(recID=recid, of=fmt, res=record, needs_2nd_pass=needs_2nd_pass, low_priority=True)