dagster-aws 0.27.16__py3-none-any.whl → 0.28.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dagster_aws/ecs/launcher.py +32 -1
- dagster_aws/pipes/context_injectors.py +6 -5
- dagster_aws/version.py +1 -1
- {dagster_aws-0.27.16.dist-info → dagster_aws-0.28.1.dist-info}/METADATA +2 -2
- {dagster_aws-0.27.16.dist-info → dagster_aws-0.28.1.dist-info}/RECORD +8 -8
- {dagster_aws-0.27.16.dist-info → dagster_aws-0.28.1.dist-info}/WHEEL +0 -0
- {dagster_aws-0.27.16.dist-info → dagster_aws-0.28.1.dist-info}/licenses/LICENSE +0 -0
- {dagster_aws-0.27.16.dist-info → dagster_aws-0.28.1.dist-info}/top_level.txt +0 -0
dagster_aws/ecs/launcher.py
CHANGED
|
@@ -30,11 +30,12 @@ from dagster._core.launcher.base import (
|
|
|
30
30
|
WorkerStatus,
|
|
31
31
|
)
|
|
32
32
|
from dagster._core.storage.dagster_run import DagsterRun
|
|
33
|
-
from dagster._core.storage.tags import RUN_WORKER_ID_TAG
|
|
33
|
+
from dagster._core.storage.tags import HIDDEN_TAG_PREFIX, RUN_WORKER_ID_TAG
|
|
34
34
|
from dagster._grpc.types import ExecuteRunArgs
|
|
35
35
|
from dagster._serdes import ConfigurableClass
|
|
36
36
|
from dagster._serdes.config_class import ConfigurableClassData
|
|
37
37
|
from dagster._utils.backoff import backoff
|
|
38
|
+
from dagster._utils.tags import get_boolean_tag_value
|
|
38
39
|
from typing_extensions import Self
|
|
39
40
|
|
|
40
41
|
from dagster_aws.ecs.container_context import (
|
|
@@ -855,6 +856,28 @@ class EcsRunLauncher(RunLauncher[T_DagsterInstance], ConfigurableClass):
|
|
|
855
856
|
task.get("stoppedReason", "")
|
|
856
857
|
)
|
|
857
858
|
|
|
859
|
+
def _add_eni_id_tags(self, run: DagsterRun, task: dict[str, Any]):
|
|
860
|
+
attachments = task.get("attachments", [])
|
|
861
|
+
eni_ids = {}
|
|
862
|
+
eni_count = 0
|
|
863
|
+
for attachment in attachments:
|
|
864
|
+
if attachment.get("type") == "ElasticNetworkInterface":
|
|
865
|
+
details = {d["name"]: d["value"] for d in attachment.get("details", [])}
|
|
866
|
+
|
|
867
|
+
if "networkInterfaceId" in details:
|
|
868
|
+
if eni_count == 0:
|
|
869
|
+
eni_ids[f"{HIDDEN_TAG_PREFIX}eni_id"] = details["networkInterfaceId"]
|
|
870
|
+
else:
|
|
871
|
+
eni_ids[f"{HIDDEN_TAG_PREFIX}eni_id_{eni_count}"] = details[
|
|
872
|
+
"networkInterfaceId"
|
|
873
|
+
]
|
|
874
|
+
eni_count += 1
|
|
875
|
+
self._instance.add_run_tags(run.run_id, eni_ids)
|
|
876
|
+
if eni_count > 0:
|
|
877
|
+
logging.info(f"Added {eni_count} ENI ID tags for run {run.run_id}: {eni_ids}")
|
|
878
|
+
else:
|
|
879
|
+
logging.warning(f"No ENI IDs found for run {run.run_id}")
|
|
880
|
+
|
|
858
881
|
def check_run_worker_health(self, run: DagsterRun):
|
|
859
882
|
run_worker_id = run.tags.get(RUN_WORKER_ID_TAG)
|
|
860
883
|
|
|
@@ -870,6 +893,14 @@ class EcsRunLauncher(RunLauncher[T_DagsterInstance], ConfigurableClass):
|
|
|
870
893
|
|
|
871
894
|
t = tasks[0]
|
|
872
895
|
|
|
896
|
+
if get_boolean_tag_value(os.getenv("DAGSTER_AWS_ENI_TAGGING_ENABLED")) and not run.tags.get(
|
|
897
|
+
f"{HIDDEN_TAG_PREFIX}eni_id"
|
|
898
|
+
):
|
|
899
|
+
try:
|
|
900
|
+
self._add_eni_id_tags(run, t)
|
|
901
|
+
except Exception:
|
|
902
|
+
logging.exception(f"Error adding ENI ID tags for run {run.run_id}")
|
|
903
|
+
|
|
873
904
|
if t.get("lastStatus") in RUNNING_STATUSES:
|
|
874
905
|
return CheckRunHealthResult(WorkerStatus.RUNNING, run_worker_id=run_worker_id)
|
|
875
906
|
elif t.get("lastStatus") in STOPPED_STATUSES:
|
|
@@ -4,15 +4,15 @@ import random
|
|
|
4
4
|
import string
|
|
5
5
|
from collections.abc import Iterator
|
|
6
6
|
from contextlib import contextmanager
|
|
7
|
-
from typing import TYPE_CHECKING
|
|
7
|
+
from typing import TYPE_CHECKING, Optional
|
|
8
8
|
|
|
9
|
-
import boto3
|
|
10
9
|
import dagster._check as check
|
|
11
10
|
from dagster._core.pipes.client import PipesContextInjector, PipesParams
|
|
12
11
|
from dagster._core.pipes.utils import PipesEnvContextInjector
|
|
13
12
|
|
|
14
13
|
if TYPE_CHECKING:
|
|
15
14
|
from dagster_pipes import PipesContextData
|
|
15
|
+
from mypy_boto3_s3 import S3Client
|
|
16
16
|
|
|
17
17
|
_CONTEXT_FILENAME = "context.json"
|
|
18
18
|
|
|
@@ -22,20 +22,21 @@ class PipesS3ContextInjector(PipesContextInjector):
|
|
|
22
22
|
|
|
23
23
|
Args:
|
|
24
24
|
bucket (str): The S3 bucket to write to.
|
|
25
|
-
client (
|
|
25
|
+
client (S3Client): A boto3 client to use to write to S3.
|
|
26
26
|
key_prefix (Optional[str]): An optional prefix to use for the S3 key. Defaults to a random
|
|
27
27
|
string.
|
|
28
28
|
|
|
29
29
|
"""
|
|
30
30
|
|
|
31
|
-
def __init__(self, *, bucket: str, client:
|
|
31
|
+
def __init__(self, *, bucket: str, client: "S3Client", key_prefix: Optional[str] = None):
|
|
32
32
|
super().__init__()
|
|
33
33
|
self.bucket = check.str_param(bucket, "bucket")
|
|
34
34
|
self.client = client
|
|
35
|
+
self.key_prefix = key_prefix
|
|
35
36
|
|
|
36
37
|
@contextmanager
|
|
37
38
|
def inject_context(self, context: "PipesContextData") -> Iterator[PipesParams]: # pyright: ignore[reportIncompatibleMethodOverride]
|
|
38
|
-
key_prefix = "
|
|
39
|
+
key_prefix = f"{self.key_prefix or ''}{''.join(random.choices(string.ascii_letters, k=30))}"
|
|
39
40
|
key = os.path.join(key_prefix, _CONTEXT_FILENAME)
|
|
40
41
|
self.client.put_object(
|
|
41
42
|
Body=json.dumps(context).encode("utf-8"), Bucket=self.bucket, Key=key
|
dagster_aws/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "0.
|
|
1
|
+
__version__ = "0.28.1"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dagster-aws
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.28.1
|
|
4
4
|
Summary: Package for AWS-specific Dagster framework solid and resource components.
|
|
5
5
|
Home-page: https://github.com/dagster-io/dagster/tree/master/python_modules/libraries/dagster-aws
|
|
6
6
|
Author: Dagster Labs
|
|
@@ -16,7 +16,7 @@ Classifier: Operating System :: OS Independent
|
|
|
16
16
|
Requires-Python: >=3.9,<3.14
|
|
17
17
|
License-File: LICENSE
|
|
18
18
|
Requires-Dist: boto3
|
|
19
|
-
Requires-Dist: dagster==1.
|
|
19
|
+
Requires-Dist: dagster==1.12.1
|
|
20
20
|
Requires-Dist: packaging
|
|
21
21
|
Requires-Dist: requests
|
|
22
22
|
Provides-Extra: redshift
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
dagster_aws/__init__.py,sha256=n5d1NvkQvkVnjWetqKFOLCZUkymTJ0v2WMxLGsbA2Hk,166
|
|
2
2
|
dagster_aws/_stubs.py,sha256=3C6ve6WLtuT2HtCn50hBAMIz-eEAwcZo4fCVnNxGBQw,1112
|
|
3
3
|
dagster_aws/py.typed,sha256=la67KBlbjXN-_-DfGNcdOcjYumVpKG_Tkw-8n5dnGB4,8
|
|
4
|
-
dagster_aws/version.py,sha256=
|
|
4
|
+
dagster_aws/version.py,sha256=ZRQKbgDaGz_yuLk-cUKuk6ZBKCSRKZC8nQd041NRNXk,23
|
|
5
5
|
dagster_aws/athena/__init__.py,sha256=J0-QydhSP3pUQk7CawztpaTm3Q1NFEpbubTM1eULbGo,413
|
|
6
6
|
dagster_aws/athena/resources.py,sha256=h7Md_KQXHvtBHA019WZFzAFTClzEUDItDZNdhR2RrPY,11907
|
|
7
7
|
dagster_aws/cloudwatch/__init__.py,sha256=iiyLEyTfNMThU4_SNM_Ns7IGXKR7wTKIvOUz9v_RQBA,82
|
|
@@ -11,7 +11,7 @@ dagster_aws/ecr/resources.py,sha256=3SiatAFl9vvkXFmxZjB6e2L20bM6gsKfaveiyTWSRdM,
|
|
|
11
11
|
dagster_aws/ecs/__init__.py,sha256=E6SAG_YKJcdUIw57amZf3AqzqVUN-GLjrLCpPxSemMg,233
|
|
12
12
|
dagster_aws/ecs/container_context.py,sha256=vB8C4d04iIhd0Gu9vRdYAfua9ib95N25uohEoev9yIY,18154
|
|
13
13
|
dagster_aws/ecs/executor.py,sha256=Fv9pbtJyE0D1DZ2e2uguYS8JHinZFjvcIfwqguYhYDM,16969
|
|
14
|
-
dagster_aws/ecs/launcher.py,sha256=
|
|
14
|
+
dagster_aws/ecs/launcher.py,sha256=EWkJdWd2e7yDWfT1whZY1n9FqWzTmvAYIM12R03MuhM,38938
|
|
15
15
|
dagster_aws/ecs/tasks.py,sha256=n5zigCqVhTsFQJS9g09eVHVCerZYJjhN_Hd-EEZJS7c,18443
|
|
16
16
|
dagster_aws/ecs/test_utils.py,sha256=VqzOIws-fLoDxGrOMzE9ZuAbOF4t9AURIwjyM2Jid-E,2041
|
|
17
17
|
dagster_aws/ecs/utils.py,sha256=CGgMjdoprtS9golz-H3yIDkSXPHxvOTmy5LJc43VVSo,5389
|
|
@@ -25,7 +25,7 @@ dagster_aws/emr/pyspark_step_launcher.py,sha256=wjhxww4ECfWHs-znbcn56eTgNqdBIJ9I
|
|
|
25
25
|
dagster_aws/emr/types.py,sha256=-JQH3H2niodJuwiyrGW0HqgkV75bD-SRNeXdXuqYY9I,3698
|
|
26
26
|
dagster_aws/emr/utils.py,sha256=AgxJ8L-uprSyjeJcxFgbMMGLsgqtjcuW11X7mIWi1tI,580
|
|
27
27
|
dagster_aws/pipes/__init__.py,sha256=FEqfChhBYzJRVxqAV1jfaXecRUgxJaLq4xgy8AKjNkI,895
|
|
28
|
-
dagster_aws/pipes/context_injectors.py,sha256=
|
|
28
|
+
dagster_aws/pipes/context_injectors.py,sha256=DV356jY7k53gB9G--iQjOxx5C7P-ZAxTySbeaMs9gv0,2282
|
|
29
29
|
dagster_aws/pipes/message_readers.py,sha256=kMYdzDPdYxUqzo_Oms5iknA6ezGN-27oHYU6E3-yK1c,14690
|
|
30
30
|
dagster_aws/pipes/clients/__init__.py,sha256=p9jEkLonG7gaI0vS6LA_dlZBSk_YSRfH-svT8eU7Myg,564
|
|
31
31
|
dagster_aws/pipes/clients/ecs.py,sha256=eiEXUbB51cFbnQ5llL6fLjCJ8pFPA0UfuWIghBwnf1g,15482
|
|
@@ -59,8 +59,8 @@ dagster_aws/utils/mrjob/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG
|
|
|
59
59
|
dagster_aws/utils/mrjob/log4j.py,sha256=Gj2D5USX8swfBXlWf3-NiqeFvrs3h1SGJkOPbP3mke8,4392
|
|
60
60
|
dagster_aws/utils/mrjob/retry.py,sha256=o8Y1Sgu8ABNnsm9jMCfagJpXmgpjcwDw6ufQmDV_Dus,4805
|
|
61
61
|
dagster_aws/utils/mrjob/utils.py,sha256=pFKobTkgwPxQoQNlzGzD3jFxwIP-flQOspQxNKGg2dc,3684
|
|
62
|
-
dagster_aws-0.
|
|
63
|
-
dagster_aws-0.
|
|
64
|
-
dagster_aws-0.
|
|
65
|
-
dagster_aws-0.
|
|
66
|
-
dagster_aws-0.
|
|
62
|
+
dagster_aws-0.28.1.dist-info/licenses/LICENSE,sha256=4lsMW-RCvfVD4_F57wrmpe3vX1xwUk_OAKKmV_XT7Z0,11348
|
|
63
|
+
dagster_aws-0.28.1.dist-info/METADATA,sha256=vIv_d9Ts-CJqoyTEgp0XQb4UZLwlbv3E_oLtP1hhE6E,1695
|
|
64
|
+
dagster_aws-0.28.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
65
|
+
dagster_aws-0.28.1.dist-info/top_level.txt,sha256=-hOwIi00tt_K9eXRhiyjst45X-Ffu5_QCdbKcm8UpDg,12
|
|
66
|
+
dagster_aws-0.28.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|