Changeset df88ee9


Ignore:
Timestamp:
May 31, 2012, 2:59:36 AM (14 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage
Children:
b32adb6
Parents:
d768e47
git-author:
Alex Dehnert <adehnert@…> (05/31/12 02:37:46)
git-committer:
Alex Dehnert <adehnert@…> (05/31/12 02:59:36)
Message:

Use transaction.commit_on_success for imports

Fixed the following scripts:

  • forms/update_validations.py (15s->1s for 70ish validations)
  • space/import_into_db.py (67s->1s for 75 spaces and 100 assignments)
  • util/sync_moira_authz.py (65s->4s for importing ~50 new people)

util/update_old_previews.py was skipped:

  • it's dead code, I believe --- I think previews are unused
  • preview updating is slow, IIRC; it's dubious we'd get noticeably better runtime on the script, and there may even be utility to the progress updates not doing this transactionally supplies

This closes ASA Trac #59.

Location:
asadb
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • asadb/forms/update_validations.py

    r654c9af rdf88ee9  
    1212    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
    1313
     14from django.db import transaction
     15
    1416import forms.models
    1517import groups.models
    1618
    1719
     20@transaction.commit_on_success
    1821def revalidate_confirmations():
    1922    confirmations = forms.models.PersonMembershipUpdate.objects.filter(deleted__isnull=True, valid=forms.models.VALID_UNSET)
  • asadb/space/import_into_db.py

    r5680065 rdf88ee9  
    1010    sys.path.append(django_dir)
    1111    os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
     12
     13from django.db import transaction
    1214
    1315import groups.models
     
    4042    assignment.save()
    4143
     44@transaction.commit_on_success
    4245def process_spaces(reader):
    4346    space.models.SpaceAssignment.objects.filter(end=max_date).update(end=today)
  • asadb/util/sync_moira_authz.py

    rc8cb9ba rdf88ee9  
    1616
    1717import django.contrib.auth.models
     18from django.db import transaction
    1819
    1920import mit
     
    7778        return self.sync_helper(sys_name, dj_members, adder, remover, )
    7879
     80    @transaction.commit_on_success
    7981    def sync_many(con, what, force_print=False, ):
    8082        changed = False
Note: See TracChangeset for help on using the changeset viewer.