Skip to content

Commit

Permalink
[SFR-2434] Simplifying delete record implementation (#491)
Browse files Browse the repository at this point in the history
  • Loading branch information
kylevillegas93 authored Dec 24, 2024
1 parent 3814252 commit b9c2b63
Show file tree
Hide file tree
Showing 5 changed files with 212 additions and 222 deletions.
4 changes: 2 additions & 2 deletions mappings/publisher_backlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def createMapping(self):
'title': ('Title', '{0}'),
'authors': ('Author(s)', '{0}'),
'dates': [('Pub Date', '{0}|publication_date')],
'publisher': [('Publisher (from Projects)', '{0}||')],
'publisher': ('Publisher (from Projects)', '{0}||'),
'identifiers': [
('ISBN', '{0}|isbn'),
('OCLC', '{0}|oclc')
Expand All @@ -19,7 +19,7 @@ def createMapping(self):
'contributors': [('Contributors', '{0}|||contributor')],
'subjects': ('Subject 1', '{0}'),
'source': ('Project Name (from Projects)', '{0}'),
'source_id': ('DRB Record_ID', '{0}'),
'source_id': ('DRB_Record ID', '{0}'),
'publisher_project_source': ('Publisher (from Projects)', '{0}')
}

Expand Down
4 changes: 2 additions & 2 deletions processes/ingest/publisher_backlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class PublisherBacklistProcess(CoreProcess):
def __init__(self, *args):
super(PublisherBacklistProcess, self).__init__(*args[:4])

self.limit = (len(args) >= 5 and args[4] and args(4) <= 100) or None
self.limit = (len(args) >= 5 and args[4] and int(args[4]) <= 100) or None
self.offset = (len(args) >= 6 and args[5]) or None

self.s3_bucket = os.environ['FILE_BUCKET']
Expand All @@ -24,7 +24,7 @@ def runProcess(self):
self.generateEngine()
self.createSession()

self.publisher_backlist_service.delete_records(limit=self.limit)
self.publisher_backlist_service.delete_records()

if self.process == 'daily':
records = self.publisher_backlist_service.get_records(offset=self.offset, limit=self.limit)
Expand Down
7 changes: 3 additions & 4 deletions services/google_drive_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@
class GoogleDriveService:
def __init__(self):
ssm_service = SSMService()
if os.environ['ENVIRONMENT'] == 'production':
SERVICE_ACCOUNT_FILE = ssm_service.get_parameter('arn:aws:ssm:us-east-1:946183545209:parameter/drb/production/google-drive-service-key')
else:
SERVICE_ACCOUNT_FILE = ssm_service.get_parameter('arn:aws:ssm:us-east-1:946183545209:parameter/drb/qa/google-drive-service-key')

SERVICE_ACCOUNT_FILE = ssm_service.get_parameter('google-drive-service-key')

service_account_info = json.loads(SERVICE_ACCOUNT_FILE)
scopes = [
'https://www.googleapis.com/auth/drive',
Expand Down
Loading

0 comments on commit b9c2b63

Please sign in to comment.