diff --git a/calcloud/batch.py b/calcloud/batch.py index 8afc3ef..81e7a5b 100644 --- a/calcloud/batch.py +++ b/calcloud/batch.py @@ -2,6 +2,7 @@ particularly pagination for the list and describe jobs functions which let them act on job counts > 100 jobs. """ + import argparse import json import datetime diff --git a/calcloud/common.py b/calcloud/common.py index 1c1bd59..2f8521b 100644 --- a/calcloud/common.py +++ b/calcloud/common.py @@ -1,4 +1,5 @@ """ a module to hold some common configuration items that various scripts may need """ + from botocore.config import Config # we need some mitigation of potential API rate restrictions for the (especially) Batch API diff --git a/calcloud/exit_codes.py b/calcloud/exit_codes.py index 457afbf..b9c621d 100644 --- a/calcloud/exit_codes.py +++ b/calcloud/exit_codes.py @@ -9,7 +9,6 @@ generic values of 0 or 1 to prevent conflicts with these codes. """ - _MEMORY_ERROR_NAMES = ["SUBPROCESS_MEMORY_ERROR", "CALDP_MEMORY_ERROR", "CONTAINER_MEMORY_ERROR", "OS_MEMORY_ERROR"] diff --git a/calcloud/io.py b/calcloud/io.py index bdc04cd..4aa865e 100644 --- a/calcloud/io.py +++ b/calcloud/io.py @@ -2,6 +2,7 @@ It hides the structure of the messaging system and provides a simple API for putting, getting, listing, and deleting messages. """ + import sys import os import doctest diff --git a/calcloud/lambda_submit.py b/calcloud/lambda_submit.py index dc4635e..3442d22 100644 --- a/calcloud/lambda_submit.py +++ b/calcloud/lambda_submit.py @@ -12,6 +12,7 @@ handlers for more information on how jobs are initiated and retried. """ + import time import os diff --git a/calcloud/log.py b/calcloud/log.py index b7ababd..06e933e 100644 --- a/calcloud/log.py +++ b/calcloud/log.py @@ -56,6 +56,7 @@ >>> _ = log.set_verbose(old_verbose) """ + import sys import os import logging diff --git a/calcloud/model_ingest.py b/calcloud/model_ingest.py index b54eed4..d5bff54 100644 --- a/calcloud/model_ingest.py +++ b/calcloud/model_ingest.py @@ -2,6 +2,7 @@ See ModelIngest/lambda_scrape.py for more information on how model data is ingested to DDB. """ + import boto3 import sys import numpy as np diff --git a/calcloud/plan.py b/calcloud/plan.py index 32df897..e53d10a 100644 --- a/calcloud/plan.py +++ b/calcloud/plan.py @@ -8,6 +8,7 @@ of job definitions with increasing memory requirements until the job later succeeds with sufficient memory or exhausts all retries. """ + import sys import os from collections import namedtuple diff --git a/calcloud/s3.py b/calcloud/s3.py index f91eec0..c338a42 100644 --- a/calcloud/s3.py +++ b/calcloud/s3.py @@ -7,6 +7,7 @@ bucket_name, object_path = s3_split_path(s3_path) """ + import os import os.path diff --git a/calcloud/timing.py b/calcloud/timing.py index fb41359..ee22731 100644 --- a/calcloud/timing.py +++ b/calcloud/timing.py @@ -1,6 +1,7 @@ """This module provides functions and classes used to track and compute rate metrics. """ + from collections import Counter import datetime import os diff --git a/lambda/JobPredict/predict_handler.py b/lambda/JobPredict/predict_handler.py index 8d55dec..df6d29e 100644 --- a/lambda/JobPredict/predict_handler.py +++ b/lambda/JobPredict/predict_handler.py @@ -4,6 +4,7 @@ # 3 - load models and generate predictions # 4 - return preds as json to parent lambda function """ + import boto3 import numpy as np from sklearn.preprocessing import PowerTransformer diff --git a/lambda/broadcast/broadcast_handler.py b/lambda/broadcast/broadcast_handler.py index 1e4ae5c..3284060 100644 --- a/lambda/broadcast/broadcast_handler.py +++ b/lambda/broadcast/broadcast_handler.py @@ -11,6 +11,7 @@ For small payloads, the broadcast message iterates over the payload and directly putting each message. """ + from calcloud import io from calcloud import s3 diff --git a/tests/conftest.py b/tests/conftest.py index b477e61..35476cf 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -7,7 +7,7 @@ import pytest import boto3 -from moto import mock_s3, mock_batch, mock_iam, mock_ec2, mock_lambda, mock_dynamodb +from moto import mock_aws, mock_batch, mock_iam, mock_ec2, mock_lambda, mock_dynamodb import yaml # for logging to double-check we're getting fake credentials and not real ones @@ -67,7 +67,7 @@ def aws_credentials(): @pytest.fixture(scope="function") def s3_client(aws_credentials): - with mock_s3(): + with mock_aws(): s3_client = boto3.client("s3", region_name="us-east-1") s3_client.create_bucket(Bucket=os.environ["BUCKET"]) yield s3_client @@ -75,7 +75,7 @@ def s3_client(aws_credentials): @pytest.fixture(scope="function") def s3_resource(aws_credentials): - with mock_s3(): + with mock_aws(): yield boto3.resource("s3", region_name="us-east-1") diff --git a/tests/test_ami_rotation.py b/tests/test_ami_rotation.py index 393e90c..0a2c93e 100644 --- a/tests/test_ami_rotation.py +++ b/tests/test_ami_rotation.py @@ -1,4 +1,5 @@ """ test that the ami rotation lambda will launch an ec2 instance """ + import os