Skip to content

Commit

Permalink
[dagster-aws] move WaiterConfig to a new shared Pipes client utils mo…
Browse files Browse the repository at this point in the history
…dule (#27008)

## Summary & Motivation

Will need this type in a few Pipes clients going forward

## How I Tested These Changes
this is a refactor, existing tests
  • Loading branch information
danielgafni authored Jan 14, 2025
1 parent a32c7a7 commit 59a7588
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from pprint import pformat
from typing import TYPE_CHECKING, Any, Optional, TypedDict, Union, cast
from typing import TYPE_CHECKING, Any, Optional, Union, cast

import boto3
import botocore
Expand All @@ -17,8 +17,8 @@
PipesMessageReader,
)
from dagster._core.pipes.utils import PipesEnvContextInjector, open_pipes_session
from typing_extensions import NotRequired

from dagster_aws.pipes.clients.utils import WaiterConfig
from dagster_aws.pipes.message_readers import PipesCloudWatchLogReader, PipesCloudWatchMessageReader

if TYPE_CHECKING:
Expand All @@ -30,20 +30,6 @@
)


class WaiterConfig(TypedDict):
"""A WaiterConfig representing the configuration of the waiter.
Args:
Delay (NotRequired[int]): The amount of time in seconds to wait between attempts. Defaults to 6.
MaxAttempts (NotRequired[int]): The maximum number of attempts to be made. Defaults to 1000000
By default the waiter is configured to wait up to 70 days (waiter_delay*waiter_max_attempts).
See `Boto3 API Documentation <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs/waiter/TasksStopped.html>`_
"""

Delay: NotRequired[int]
MaxAttempts: NotRequired[int]


@experimental
class PipesECSClient(PipesClient, TreatAsResourceParam):
"""A pipes client for running AWS ECS tasks.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import TYPE_CHECKING, cast
from typing import TYPE_CHECKING, TypedDict, cast

from dagster._core.pipes.utils import PipesSession
from typing_extensions import NotRequired

if TYPE_CHECKING:
from mypy_boto3_emr.type_defs import ConfigurationUnionTypeDef
Expand Down Expand Up @@ -70,3 +71,17 @@ def emr_inject_pipes_env_vars(
)

return configurations


class WaiterConfig(TypedDict):
"""A WaiterConfig representing the configuration of the waiter.
Args:
Delay (NotRequired[int]): The amount of time in seconds to wait between attempts. Defaults to 6.
MaxAttempts (NotRequired[int]): The maximum number of attempts to be made. Defaults to 1000000
By default the waiter is configured to wait up to 70 days (waiter_delay*waiter_max_attempts).
See `Boto3 API Documentation <https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ecs/waiter/TasksStopped.html>`_
"""

Delay: NotRequired[int]
MaxAttempts: NotRequired[int]

0 comments on commit 59a7588

Please sign in to comment.