Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 5fc8a3a

Browse files
authored
Deprecate ECSTask block (#395)
1 parent 1add0b9 commit 5fc8a3a

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

Diff for: prefect_aws/ecs.py

+18-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
"""
2+
DEPRECATION WARNING:
3+
4+
This module is deprecated as of March 2024 and will not be available after September 2024.
5+
It has been replaced by the ECS worker, which offers enhanced functionality and better performance.
6+
7+
For upgrade instructions, see https://docs.prefect.io/latest/guides/upgrade-guide-agents-to-workers/.
8+
29
Integrations with the Amazon Elastic Container Service.
310
411
Examples:
@@ -102,7 +109,8 @@
102109
],
103110
)
104111
```
105-
"""
112+
""" # noqa
113+
106114
import copy
107115
import difflib
108116
import json
@@ -118,6 +126,7 @@
118126
import yaml
119127
from anyio.abc import TaskStatus
120128
from jsonpointer import JsonPointerException
129+
from prefect._internal.compatibility.deprecated import deprecated_class
121130
from prefect.blocks.core import BlockNotSavedError
122131
from prefect.exceptions import InfrastructureNotAvailable, InfrastructureNotFound
123132
from prefect.infrastructure.base import Infrastructure, InfrastructureResult
@@ -205,6 +214,14 @@ def _pretty_diff(d1: dict, d2: dict) -> str:
205214
)
206215

207216

217+
@deprecated_class(
218+
start_date="Mar 2024",
219+
help=(
220+
"Use the ECS worker instead."
221+
" Refer to the upgrade guide for more information:"
222+
" https://docs.prefect.io/latest/guides/upgrade-guide-agents-to-workers/."
223+
),
224+
)
208225
class ECSTask(Infrastructure):
209226
"""
210227
Run a command as an ECS task.

Diff for: requirements.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ boto3>=1.24.53
22
botocore>=1.27.53
33
mypy_boto3_s3>=1.24.94
44
mypy_boto3_secretsmanager>=1.26.49
5-
prefect>=2.14.10
5+
prefect>=2.16.4
66
tenacity>=8.0.0

Diff for: tests/test_ecs.py

+15
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from botocore.exceptions import ClientError
1313
from moto import mock_ec2, mock_ecs, mock_logs
1414
from moto.ec2.utils import generate_instance_identity_document
15+
from prefect._internal.compatibility.deprecated import PrefectDeprecationWarning
1516
from prefect.exceptions import InfrastructureNotAvailable, InfrastructureNotFound
1617
from prefect.logging.configuration import setup_logging
1718
from prefect.server.schemas.core import Deployment, Flow, FlowRun
@@ -35,6 +36,20 @@
3536
parse_task_identifier,
3637
)
3738

39+
40+
def test_ecs_task_emits_deprecation_warning():
41+
with pytest.warns(
42+
PrefectDeprecationWarning,
43+
match=(
44+
"prefect_aws.ecs.ECSTask has been deprecated."
45+
" It will not be available after Sep 2024."
46+
" Use the ECS worker instead."
47+
" Refer to the upgrade guide for more information"
48+
),
49+
):
50+
ECSTask()
51+
52+
3853
setup_logging()
3954

4055

0 commit comments

Comments
 (0)