Added (belatedly) progress bars to some long-running migrations.
- Legacy-Id: 11025
This commit is contained in:
parent
337694ab64
commit
db3a3c3081
|
@ -1,21 +1,24 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from tqdm import tqdm
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
|
|
||||||
def populate_submission_draft(apps, schema_editor):
|
def populate_submission_draft(apps, schema_editor):
|
||||||
Submission = apps.get_model('submit', 'Submission')
|
Submission = apps.get_model('submit', 'Submission')
|
||||||
Document = apps.get_model('doc', 'Document')
|
Document = apps.get_model('doc', 'Document')
|
||||||
print("")
|
print("")
|
||||||
for submission in Submission.objects.filter(state_id='posted'):
|
submissions = Submission.objects.filter(state_id='posted', draft=None)
|
||||||
if submission.draft == None:
|
count = submissions.count()
|
||||||
try:
|
print(" Fixing up draft information for %s submissions" % count)
|
||||||
draft = Document.objects.get(name=submission.name)
|
for submission in tqdm(submissions):
|
||||||
except Document.DoesNotExist:
|
try:
|
||||||
print( "Failed to find %s-%s" % (submission.name, submission.rev))
|
draft = Document.objects.get(name=submission.name)
|
||||||
continue
|
except Document.DoesNotExist:
|
||||||
submission.draft = draft
|
print( " Failed to find %s-%s" % (submission.name, submission.rev))
|
||||||
submission.save()
|
continue
|
||||||
|
submission.draft = draft
|
||||||
|
submission.save()
|
||||||
|
|
||||||
def backward(apps, schema_editor):
|
def backward(apps, schema_editor):
|
||||||
pass # nothing to do
|
pass # nothing to do
|
||||||
|
|
|
@ -1,12 +1,16 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
|
from tqdm import tqdm
|
||||||
from django.db import migrations
|
from django.db import migrations
|
||||||
from ietf.submit.checkers import DraftIdnitsChecker, DraftYangChecker
|
from ietf.submit.checkers import DraftIdnitsChecker, DraftYangChecker
|
||||||
|
|
||||||
def set_submission_check_symbol(apps, schema_editor):
|
def set_submission_check_symbol(apps, schema_editor):
|
||||||
SubmissionCheck = apps.get_model('submit','SubmissionCheck')
|
SubmissionCheck = apps.get_model('submit','SubmissionCheck')
|
||||||
for s in SubmissionCheck.objects.all():
|
checks = SubmissionCheck.objects.all()
|
||||||
|
print("")
|
||||||
|
print(" Adding submission check symbol info to existing checks")
|
||||||
|
for s in tqdm():
|
||||||
if not s.symbol:
|
if not s.symbol:
|
||||||
if s.checker == "idnits check":
|
if s.checker == "idnits check":
|
||||||
s.symbol = DraftIdnitsChecker.symbol
|
s.symbol = DraftIdnitsChecker.symbol
|
||||||
|
|
|
@ -27,6 +27,7 @@ python-magic>=0.4.6
|
||||||
python-memcached>=1.48 # for django.core.cache.backends.memcached
|
python-memcached>=1.48 # for django.core.cache.backends.memcached
|
||||||
pytz>=2014.7
|
pytz>=2014.7
|
||||||
six>=1.8.0
|
six>=1.8.0
|
||||||
|
tqdm>=3.5.0
|
||||||
Unidecode>=0.4.18
|
Unidecode>=0.4.18
|
||||||
#wsgiref>=0.1.2
|
#wsgiref>=0.1.2
|
||||||
xml2rfc>=2.5.
|
xml2rfc>=2.5.
|
||||||
|
|
Loading…
Reference in a new issue