HomeElementl

Stub AWS before instance construction

Description

Stub AWS before instance construction

Summary:
Previously, we were stubbing our AWS objects (the ECS resource and EC2
client) after an instance was constructed. This was simpler, but it
prevented us from using our stubbed objects in the launcher's
__init__ function.

Instead, we're now stubbing our AWS objects before the launcher has bee
initialized. Once the fixture is called, any call to boto3.client()
(with any arguments) will return our ecs fixture. Any call to
boto3.resource() (with any arguments) will return our ec2 fixture.
Should we ever make multiple calls to either boto3.client() or
boto3.resource(), we'll need to modify this fixture.

Now, we'll be able to use our stubbed objects inside the launcher's
__init__ - for example, if we wanted to do an invariant check to make
sure something like a cluster or task definition already exists.

Depends on D8638

Test Plan: unit

Reviewers: dgibson, alangenfeld, johann

Reviewed By: dgibson

Differential Revision: https://dagster.phacility.com/D8639

Details

Provenance
jordansandersAuthored on Jun 30 2021, 5:43 PM
Reviewer
dgibson
Differential Revision
D8639: Stub AWS before instance construction
Parents
R1:e8d44528eca9: Add documentation fro terminate mutation in graphql
Branches
Unknown
Tags
Unknown