dagster-aws 0.28.0__py3-none-any.whl → 0.28.2__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.
@@ -5,7 +5,7 @@ import uuid
5
5
  import warnings
6
6
  from collections import namedtuple
7
7
  from collections.abc import Mapping, Sequence
8
- from typing import Any, Optional
8
+ from typing import TYPE_CHECKING, Any, Optional
9
9
 
10
10
  import boto3
11
11
  from botocore.exceptions import ClientError
@@ -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 (
@@ -81,6 +82,9 @@ TAGS_TO_EXCLUDE_FROM_PROPAGATION = {"dagster/op_selection", "dagster/solid_selec
81
82
  DEFAULT_REGISTER_TASK_DEFINITION_RETRIES = 5
82
83
  DEFAULT_RUN_TASK_RETRIES = 5
83
84
 
85
+ if TYPE_CHECKING:
86
+ from botocore.config import Config
87
+
84
88
 
85
89
  class EcsRunLauncher(RunLauncher[T_DagsterInstance], ConfigurableClass):
86
90
  """RunLauncher that starts a task in ECS for each Dagster job run.
@@ -119,10 +123,13 @@ class EcsRunLauncher(RunLauncher[T_DagsterInstance], ConfigurableClass):
119
123
  task_definition_prefix: str = "run",
120
124
  ):
121
125
  self._inst_data = inst_data
122
- self.ecs = boto3.client("ecs")
126
+
127
+ boto_client_config = self.get_boto_client_config()
128
+
129
+ self.ecs = boto3.client("ecs", config=boto_client_config)
123
130
  self.ec2 = boto3.resource("ec2")
124
- self.secrets_manager = boto3.client("secretsmanager")
125
- self.logs = boto3.client("logs")
131
+ self.secrets_manager = boto3.client("secretsmanager", config=boto_client_config)
132
+ self.logs = boto3.client("logs", config=boto_client_config)
126
133
 
127
134
  self._task_definition_prefix = task_definition_prefix
128
135
 
@@ -236,6 +243,9 @@ class EcsRunLauncher(RunLauncher[T_DagsterInstance], ConfigurableClass):
236
243
  self._current_task_metadata = None
237
244
  self._current_task = None
238
245
 
246
+ def get_boto_client_config(self) -> Optional["Config"]:
247
+ return None
248
+
239
249
  @property
240
250
  def inst_data(self):
241
251
  return self._inst_data
@@ -855,6 +865,28 @@ class EcsRunLauncher(RunLauncher[T_DagsterInstance], ConfigurableClass):
855
865
  task.get("stoppedReason", "")
856
866
  )
857
867
 
868
+ def _add_eni_id_tags(self, run: DagsterRun, task: dict[str, Any]):
869
+ attachments = task.get("attachments", [])
870
+ eni_ids = {}
871
+ eni_count = 0
872
+ for attachment in attachments:
873
+ if attachment.get("type") == "ElasticNetworkInterface":
874
+ details = {d["name"]: d["value"] for d in attachment.get("details", [])}
875
+
876
+ if "networkInterfaceId" in details:
877
+ if eni_count == 0:
878
+ eni_ids[f"{HIDDEN_TAG_PREFIX}eni_id"] = details["networkInterfaceId"]
879
+ else:
880
+ eni_ids[f"{HIDDEN_TAG_PREFIX}eni_id_{eni_count}"] = details[
881
+ "networkInterfaceId"
882
+ ]
883
+ eni_count += 1
884
+ self._instance.add_run_tags(run.run_id, eni_ids)
885
+ if eni_count > 0:
886
+ logging.info(f"Added {eni_count} ENI ID tags for run {run.run_id}: {eni_ids}")
887
+ else:
888
+ logging.warning(f"No ENI IDs found for run {run.run_id}")
889
+
858
890
  def check_run_worker_health(self, run: DagsterRun):
859
891
  run_worker_id = run.tags.get(RUN_WORKER_ID_TAG)
860
892
 
@@ -870,6 +902,14 @@ class EcsRunLauncher(RunLauncher[T_DagsterInstance], ConfigurableClass):
870
902
 
871
903
  t = tasks[0]
872
904
 
905
+ if get_boolean_tag_value(os.getenv("DAGSTER_AWS_ENI_TAGGING_ENABLED")) and not run.tags.get(
906
+ f"{HIDDEN_TAG_PREFIX}eni_id"
907
+ ):
908
+ try:
909
+ self._add_eni_id_tags(run, t)
910
+ except Exception:
911
+ logging.exception(f"Error adding ENI ID tags for run {run.run_id}")
912
+
873
913
  if t.get("lastStatus") in RUNNING_STATUSES:
874
914
  return CheckRunHealthResult(WorkerStatus.RUNNING, run_worker_id=run_worker_id)
875
915
  elif t.get("lastStatus") in STOPPED_STATUSES:
@@ -4,11 +4,11 @@ import os
4
4
  import random
5
5
  import string
6
6
  import sys
7
- from collections.abc import Generator, Iterator, Sequence
7
+ from collections.abc import Callable, Generator, Iterator, Sequence
8
8
  from contextlib import contextmanager
9
9
  from datetime import datetime
10
10
  from threading import Event, Thread
11
- from typing import IO, TYPE_CHECKING, Any, Callable, Optional, cast
11
+ from typing import IO, TYPE_CHECKING, Any, Optional, cast
12
12
 
13
13
  import boto3
14
14
  import dagster._check as check
dagster_aws/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.28.0"
1
+ __version__ = "0.28.2"
@@ -1,22 +1,21 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dagster-aws
3
- Version: 0.28.0
3
+ Version: 0.28.2
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
7
7
  Author-email: hello@dagsterlabs.com
8
8
  License: Apache-2.0
9
- Classifier: Programming Language :: Python :: 3.9
10
9
  Classifier: Programming Language :: Python :: 3.10
11
10
  Classifier: Programming Language :: Python :: 3.11
12
11
  Classifier: Programming Language :: Python :: 3.12
13
12
  Classifier: Programming Language :: Python :: 3.13
14
13
  Classifier: License :: OSI Approved :: Apache Software License
15
14
  Classifier: Operating System :: OS Independent
16
- Requires-Python: >=3.9,<3.14
15
+ Requires-Python: >=3.10,<3.14
17
16
  License-File: LICENSE
18
17
  Requires-Dist: boto3
19
- Requires-Dist: dagster==1.12.0
18
+ Requires-Dist: dagster==1.12.2
20
19
  Requires-Dist: packaging
21
20
  Requires-Dist: requests
22
21
  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=MRQGtOXBhcDKeeNOL0LiB-cllo6kfd8_KGJOvaDp0XQ,23
4
+ dagster_aws/version.py,sha256=K-TM2fq9AmH_Dk8Cadam72wILDZ_6qftLHvY9P1Fc3I,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=dqNXv2Qm1NqTESywoV5vdC6X2y99mV7_SX4HOLymv6E,37508
14
+ dagster_aws/ecs/launcher.py,sha256=FN5u1tFTwyRsHn1wwoqW7zrrej1JqoZKYBrUsWoG0jo,39234
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
@@ -26,7 +26,7 @@ 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
28
  dagster_aws/pipes/context_injectors.py,sha256=DV356jY7k53gB9G--iQjOxx5C7P-ZAxTySbeaMs9gv0,2282
29
- dagster_aws/pipes/message_readers.py,sha256=kMYdzDPdYxUqzo_Oms5iknA6ezGN-27oHYU6E3-yK1c,14690
29
+ dagster_aws/pipes/message_readers.py,sha256=1qp47TcXK0cERctRK9KFzIdZ3v-X_RSl9nUaR0Cmobo,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
32
32
  dagster_aws/pipes/clients/emr.py,sha256=KvJW70N9WLDEDIXjeLBlMzR29a79ZSmqBj55O8sAJfs,14101
@@ -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.28.0.dist-info/licenses/LICENSE,sha256=4lsMW-RCvfVD4_F57wrmpe3vX1xwUk_OAKKmV_XT7Z0,11348
63
- dagster_aws-0.28.0.dist-info/METADATA,sha256=923U7KzM7U-7Fa2pb3rCbwI__9JUUc5fHd2liuDc2zA,1695
64
- dagster_aws-0.28.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
65
- dagster_aws-0.28.0.dist-info/top_level.txt,sha256=-hOwIi00tt_K9eXRhiyjst45X-Ffu5_QCdbKcm8UpDg,12
66
- dagster_aws-0.28.0.dist-info/RECORD,,
62
+ dagster_aws-0.28.2.dist-info/licenses/LICENSE,sha256=4lsMW-RCvfVD4_F57wrmpe3vX1xwUk_OAKKmV_XT7Z0,11348
63
+ dagster_aws-0.28.2.dist-info/METADATA,sha256=H6hZQHJ7uzLx9QgVCj06pBzFeM8GmPkzE316ELaA50M,1646
64
+ dagster_aws-0.28.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
65
+ dagster_aws-0.28.2.dist-info/top_level.txt,sha256=-hOwIi00tt_K9eXRhiyjst45X-Ffu5_QCdbKcm8UpDg,12
66
+ dagster_aws-0.28.2.dist-info/RECORD,,