Skip to content

Commit

Permalink
Add a dagster/job_name tag to ECS run launcher tasks (#23364)
Browse files Browse the repository at this point in the history
Summary:
Resolves #14939.

## Summary & Motivation

## How I Tested These Changes
  • Loading branch information
gibsondan committed Aug 1, 2024
1 parent 07a2d6e commit 8572ea9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,11 @@ def build_ecs_tags_for_run_task(self, run, container_context: EcsContainerContex
if any(tag["key"] == "dagster/run_id" for tag in container_context.run_ecs_tags):
raise Exception("Cannot override system ECS tag: dagster/run_id")

return [{"key": "dagster/run_id", "value": run.run_id}, *container_context.run_ecs_tags]
return [
{"key": "dagster/run_id", "value": run.run_id},
{"key": "dagster/job_name", "value": run.job_name},
*container_context.run_ecs_tags,
]

def _get_run_tags(self, run_id):
run = self._instance.get_run_by_id(run_id)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ def test_default_launcher(
)
assert ecs.list_tags_for_resource(resourceArn=task_arn)["tags"][0]["value"] == run.run_id

assert (
ecs.list_tags_for_resource(resourceArn=task_arn)["tags"][1]["key"] == "dagster/job_name"
)
assert ecs.list_tags_for_resource(resourceArn=task_arn)["tags"][1]["value"] == run.job_name

# We set job-specific overides
overrides = task["overrides"]["containerOverrides"]
assert len(overrides) == 1
Expand Down

0 comments on commit 8572ea9

Please sign in to comment.