Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
zzeppozz committed Dec 20, 2024
1 parent 6fc6d2a commit d105d5a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
10 changes: 5 additions & 5 deletions aws/lambda/bison_s1_annotate_riis.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
from botocore.client import Config
from datetime import datetime

print("*** Loading function bison_s1_annotate_riis")
PROJECT = "bison"
TASK = "annotate_riis"
print(f"*** Loading function {PROJECT}_s1_{TASK}")

# .............................................................................
# Dataload filename postfixes
Expand Down Expand Up @@ -38,7 +39,7 @@

# EC2 launch template/version
EC2_SPOT_TEMPLATE = f"{PROJECT}_spot_task_template"
TASK = "annotate_riis"
EC2_INSTANCE_NAME = f"{PROJECT}_{TASK}"

# .............................................................................
# Initialize Botocore session
Expand All @@ -48,7 +49,7 @@
session = boto3.session.Session()
bc_session = bc.get_session()
session = boto3.Session(botocore_session=bc_session, region_name=REGION)
# Initialize Redshift client
# Initialize AWS clients
config = Config(connect_timeout=timeout, read_timeout=timeout)
s3_client = session.client("s3", config=config, region_name=REGION)
ec2_client = session.client("ec2", config=config)
Expand Down Expand Up @@ -110,7 +111,6 @@ def lambda_handler(event, context):

print("*** ---------------------------------------")
print("*** Launch EC2 instance with task template version")
instance_name = f"{PROJECT}_{TASK}"

try:
response = ec2_client.run_instances(
Expand All @@ -122,7 +122,7 @@ def lambda_handler(event, context):
{
"ResourceType": "instance",
"Tags": [
{"Key": "Name", "Value": instance_name},
{"Key": "Name", "Value": EC2_INSTANCE_NAME},
{"Key": "TemplateName", "Value": EC2_SPOT_TEMPLATE}
]
}
Expand Down
4 changes: 2 additions & 2 deletions aws/lambda/bison_s8_calc_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@
from botocore.client import Config
from datetime import datetime

print("*** Loading function bison_s8_calc_stats")
PROJECT = "bison"
TASK = "calc_stats"
print(f"*** Loading function {PROJECT}_s8_{TASK}")

# .............................................................................
# Dataload filename postfixes
Expand All @@ -29,7 +30,6 @@

# EC2 launch template/version
EC2_SPOT_TEMPLATE = f"{PROJECT}_spot_task_template"
TASK = "calc_stats"
EC2_INSTANCE_NAME = f"{PROJECT}_{TASK}"

# .............................................................................
Expand Down
2 changes: 1 addition & 1 deletion bison/task/calc_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,6 @@ def download_dataframe(s3, table_type, datestr, bucket, bucket_dir):
stats_zip_filename = pam.compress_stats_to_file(local_path=TMP_PATH)
stats_data_dict, stats_meta_dict, table_type, datestr = PAM.uncompress_zipped_data(
stats_zip_filename)
stats_key = f"{S3_SUMMARY_DIR}/{os.path.basename(stats_zip_filename)}"
stats_key = f"{S3_OUT_DIR}/{os.path.basename(stats_zip_filename)}"
_uri = s3.upload(stats_zip_filename, S3_BUCKET, stats_key, overwrite=overwrite)
"""

0 comments on commit d105d5a

Please sign in to comment.