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

Commit

Permalink
Deprecate ECSTask block
Browse files Browse the repository at this point in the history
  • Loading branch information
desertaxle committed Mar 14, 2024
1 parent 1add0b9 commit ff8e767
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
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
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

0 comments on commit ff8e767

Please sign in to comment.