Skip to content

Commit

Permalink
SFR-2285: Fix has part item build
Browse files Browse the repository at this point in the history
  • Loading branch information
kylevillegas93 committed Oct 25, 2024
1 parent d2778ae commit beec0a1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
4 changes: 3 additions & 1 deletion managers/sfrRecord.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,10 @@ def parseInstance(self, workData, editionData, rec):
editionData['dcdw_uuids'].append(rec.uuid.hex)

def buildItems(self, editionData, rec, itemContributors):
max_part_number = max(int(item.split('|')[0]) for item in rec.has_part)

startPos = len(editionData['items']) - 1
editionData['items'].extend([None] * len(rec.has_part))
editionData['items'].extend([None] * max_part_number)

for item in rec.has_part:
no, uri, source, linkType, flags = tuple(item.split('|'))
Expand Down
11 changes: 6 additions & 5 deletions processes/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def __init__(self, *args):

self.createRedisClient()

self.createElasticConnection()
self.createElasticSearchIngestPipeline()
self.createElasticSearchIndex()
# self.createElasticConnection()
# self.createElasticSearchIngestPipeline()
# self.createElasticSearchIndex()

def runProcess(self):
try:
Expand All @@ -55,6 +55,7 @@ def cluster_records(self, full=False, start_datetime=None):
.filter(Record.cluster_status == False)
.filter(Record.source != 'oclcClassify')
.filter(Record.source != 'oclcCatalog')
.filter(Record.uuid == '2ddb63df-e4f5-479a-ad95-c03702c577b2')
)

if not full:
Expand Down Expand Up @@ -83,7 +84,7 @@ def cluster_records(self, full=False, start_datetime=None):
raise e

if len(works_to_index) >= self.CLUSTER_BATCH_SIZE:
self.update_elastic_search(works_to_index, work_ids_to_delete)
# self.update_elastic_search(works_to_index, work_ids_to_delete)
logger.info(f'Clustered {len(works_to_index)} works')
works_to_index = []

Expand All @@ -93,7 +94,7 @@ def cluster_records(self, full=False, start_datetime=None):
self.session.commit()

logger.info(f'Clustered {len(works_to_index)} works')
self.update_elastic_search(works_to_index, work_ids_to_delete)
# self.update_elastic_search(works_to_index, work_ids_to_delete)
self.delete_stale_works(work_ids_to_delete)

self.session.commit()
Expand Down

0 comments on commit beec0a1

Please sign in to comment.