-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e3a9e1c
commit 9fcd509
Showing
3 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import os | ||
import json | ||
import boto3 | ||
from transferrer.transfer import transfer_shoot | ||
import logging | ||
logging.basicConfig(level=logging.INFO) | ||
|
||
logger = logging.getLogger() | ||
logger.setLevel(logging.INFO) | ||
|
||
ACCESSION_NUMBER = os.getenv("ACCESSION_NUMBER", "2754") | ||
|
||
|
||
def lambda_handler(event, context): | ||
shoots = [single_handler(shoot_id) for shoot_id in get_shoot_ids(event)] | ||
return { | ||
'statusCode': 200, | ||
'body': shoots | ||
} | ||
|
||
|
||
def single_handler(shoot_id): | ||
logger.info(f"transferring {shoot_id}") | ||
transfer_shoot( | ||
from_session=boto3.Session(), | ||
to_session=boto3.Session(), | ||
shoot_number=shoot_id, | ||
accession_number=ACCESSION_NUMBER | ||
) | ||
return shoot_id | ||
|
||
|
||
def get_shoot_ids(event): | ||
for record in event['Records']: | ||
yield json.loads(record['body'])["Message"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
import logging | ||
import os | ||
import tempfile | ||
from transferrer.download import download_shoot | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters