Skip to content

Commit

Permalink
black updates, replace mock_s3 with mock_aws
Browse files Browse the repository at this point in the history
  • Loading branch information
raswaters committed Feb 26, 2024
1 parent 6d074ed commit cfe744d
Show file tree
Hide file tree
Showing 14 changed files with 15 additions and 4 deletions.
1 change: 1 addition & 0 deletions calcloud/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions calcloud/common.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 0 additions & 1 deletion calcloud/exit_codes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]


Expand Down
1 change: 1 addition & 0 deletions calcloud/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions calcloud/lambda_submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
handlers for more information on how jobs are initiated and
retried.
"""

import time
import os

Expand Down
1 change: 1 addition & 0 deletions calcloud/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
>>> _ = log.set_verbose(old_verbose)
"""

import sys
import os
import logging
Expand Down
1 change: 1 addition & 0 deletions calcloud/model_ingest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions calcloud/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions calcloud/s3.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
bucket_name, object_path = s3_split_path(s3_path)
"""

import os
import os.path

Expand Down
1 change: 1 addition & 0 deletions calcloud/timing.py
Original file line number Diff line number Diff line change
@@ -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
Expand Down
1 change: 1 addition & 0 deletions lambda/JobPredict/predict_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions lambda/broadcast/broadcast_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 3 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -67,15 +67,15 @@ 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


@pytest.fixture(scope="function")
def s3_resource(aws_credentials):
with mock_s3():
with mock_aws():
yield boto3.resource("s3", region_name="us-east-1")


Expand Down
1 change: 1 addition & 0 deletions tests/test_ami_rotation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
""" test that the ami rotation lambda will launch an ec2 instance """

import os


Expand Down

0 comments on commit cfe744d

Please sign in to comment.