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

Deprecate ECSTask block #395

Merged
merged 2 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion prefect_aws/ecs.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
"""
DEPRECATION WARNING:

This module is deprecated as of March 2024 and will not be available after September 2024.
It has been replaced by the ECS worker, which offers enhanced functionality and better performance.

For upgrade instructions, see https://docs.prefect.io/latest/guides/upgrade-guide-agents-to-workers/.

Integrations with the Amazon Elastic Container Service.

Examples:
Expand Down Expand Up @@ -102,7 +109,8 @@
],
)
```
"""
""" # noqa

import copy
import difflib
import json
Expand All @@ -118,6 +126,7 @@
import yaml
from anyio.abc import TaskStatus
from jsonpointer import JsonPointerException
from prefect._internal.compatibility.deprecated import deprecated_class
from prefect.blocks.core import BlockNotSavedError
from prefect.exceptions import InfrastructureNotAvailable, InfrastructureNotFound
from prefect.infrastructure.base import Infrastructure, InfrastructureResult
Expand Down Expand Up @@ -205,6 +214,14 @@ def _pretty_diff(d1: dict, d2: dict) -> str:
)


@deprecated_class(
start_date="Mar 2024",
help=(
"Use the ECS worker instead."
" Refer to the upgrade guide for more information:"
" https://docs.prefect.io/latest/guides/upgrade-guide-agents-to-workers/."
),
)
class ECSTask(Infrastructure):
"""
Run a command as an ECS task.
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ boto3>=1.24.53
botocore>=1.27.53
mypy_boto3_s3>=1.24.94
mypy_boto3_secretsmanager>=1.26.49
prefect>=2.14.10
prefect>=2.16.4
tenacity>=8.0.0
15 changes: 15 additions & 0 deletions tests/test_ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
from botocore.exceptions import ClientError
from moto import mock_ec2, mock_ecs, mock_logs
from moto.ec2.utils import generate_instance_identity_document
from prefect._internal.compatibility.deprecated import PrefectDeprecationWarning
from prefect.exceptions import InfrastructureNotAvailable, InfrastructureNotFound
from prefect.logging.configuration import setup_logging
from prefect.server.schemas.core import Deployment, Flow, FlowRun
Expand All @@ -35,6 +36,20 @@
parse_task_identifier,
)


def test_ecs_task_emits_deprecation_warning():
with pytest.warns(
PrefectDeprecationWarning,
match=(
"prefect_aws.ecs.ECSTask has been deprecated."
" It will not be available after Sep 2024."
" Use the ECS worker instead."
" Refer to the upgrade guide for more information"
),
):
ECSTask()


setup_logging()


Expand Down
Loading