Ignore:
Timestamp:
18 Mar 2008, 17:54:22 (17 years ago)
Author:
joachim
Message:

include timing functions,
to enable set with_timing to True

File:
1 edited

Legend:

Unmodified
Added
Removed
  • WAeUP_SRP/base/skins/waeup_student/admitStudents.py

    r3340 r3349  
    4444admitted = 0
    4545cocount = 0
    46 commit_after = 20
     46old_commit_count = -1
     47commit_after = 40
    4748d = {'status': 'created'}
    4849reg_nos = [brain.reg_no for brain in brains]
     50with_timing = True
    4951for reg_no in reg_nos:
    5052    count += 1
    51     if admitted and not admitted % commit_after:
     53    must_commit = (admitted != old_commit_count) and (not admitted % commit_after)
     54    if must_commit:
     55        old_commit_count = admitted
    5256        context.waeup_tool.doCommit()
    5357        logger.info("Committing %s transactions, total %s" % (commit_after,count))
    5458        cocount += 1
    55         #if cocount > 1:
    56         #    break
     59        if cocount > 2:
     60            break
    5761    brain = aq_applicants(Eq('reg_no',reg_no))[0]
    5862    #logger.info("start creating  objects of student %s" % (brain.reg_no))
    59     sid = d['student_id'] = context.waeup_tool.admitOneStudent(brain,entry_session,pin_password)
     63    sid = d['student_id'] = context.waeup_tool.admitOneStudent(brain,
     64                                                               entry_session,
     65                                                               pin_password,
     66                                                               with_timing = with_timing)
     67       
    6068    if sid is not None:
    6169        d['reg_no'] = reg_no
    6270        context.applicants_catalog.modifyRecord(**d)
    6371        logger.info("created objects of student %s with id %s" % (reg_no,sid))
     72        if with_timing:
     73            data = context.waeup_tool.get_timing_data()
     74            logger.info("timing %(i_time)6.2f/%(a_time)6.2f" % data['total'])
    6475        admitted += 1
    6576    else:
Note: See TracChangeset for help on using the changeset viewer.