Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

Commit

Permalink
make iterator loading actually work
Browse files Browse the repository at this point in the history
  • Loading branch information
rshorey committed Apr 11, 2019
1 parent 4fd5e86 commit ad9b41b
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions cycle_2020/utils/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,15 +592,15 @@ def load_filing(filing, filename, filing_fieldnames):
sche_count = 0
if 'itemizations' in filing_dict:
load_chunk_size = 20000
i = 0
complete = False
while not complete:
i = 0
itemization_dict = {}
while i < load_chunk_size:
try:
line = next(filing_dict['itemizations'])
i += 1
except StopIteration:
print("stopping")
complete = True
break
#print(line)
Expand All @@ -610,16 +610,16 @@ def load_filing(filing, filename, filing_fieldnames):
itemization_dict[itemization_type].append(line)

if 'SchA' in itemization_dict:
scha_count = load_itemizations(ScheduleA, itemization_dict['SchA'])
scha_count += load_itemizations(ScheduleA, itemization_dict['SchA'])
if 'SchB' in itemization_dict:
schb_count = load_itemizations(ScheduleB, itemization_dict['SchB'])
schb_count += load_itemizations(ScheduleB, itemization_dict['SchB'])
if 'SchE' in itemization_dict:
sche_count = load_itemizations(ScheduleE, itemization_dict['SchE'])
sche_count += load_itemizations(ScheduleE, itemization_dict['SchE'])
if 'F57' in itemization_dict:
sche_count += load_itemizations(ScheduleE, itemization_dict['F57'])
sys.stdout.write("inserted {} schedule A's\n".format(scha_count))
sys.stdout.write("inserted {} schedule B's\n".format(schb_count))
sys.stdout.write("inserted {} schedule E's\n".format(sche_count))
sys.stdout.write("inserted {} schedule A's\n".format(scha_count))
sys.stdout.write("inserted {} schedule B's\n".format(schb_count))
sys.stdout.write("inserted {} schedule E's\n".format(sche_count))

except:
#something failed in the transaction loading, keep the filing as failed
Expand Down

0 comments on commit ad9b41b

Please sign in to comment.