Skip to content

Commit

Permalink
Don't carry forward all container definitions (#6850)
Browse files Browse the repository at this point in the history
When we create a task definition for the job run, we inherit a bunch of
information from the container running running the current process. The
original implementation assumed that this was the lone container running
in the task (or at the very least, that the other containers had no
meaningful side effects).

But if somebody chooses to run a task with both a daemon and a dagit
container (or even a handful of sidecar containers), this behavior would
cause the dagit container to also stand up in the job run task.

This change constrains that behavior to only launch a single container
in the job run task.
  • Loading branch information
jmsanders committed Mar 2, 2022
1 parent fe4a530 commit 8f29bf9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 2 additions & 3 deletions python_modules/libraries/dagster-aws/dagster_aws/ecs/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,7 @@ def default_ecs_task_definition(
# and the command will fail
# https://aws.amazon.com/blogs/opensource/demystifying-entrypoint-cmd-docker/
container_definitions = task_definition["containerDefinitions"]
container_definitions.remove(metadata.container_definition)
container_definitions.append(
container_definitions = [
merge_dicts(
{
**metadata.container_definition,
Expand All @@ -87,7 +86,7 @@ def default_ecs_task_definition(
environment_dict,
secrets_dict,
)
)
]
task_definition = {
**task_definition,
"family": "dagster-run",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import boto3
import pytest

from dagster import ExperimentalWarning
from dagster.core.definitions.reconstructable import ReconstructableRepository
from dagster.core.test_utils import in_process_test_workspace, instance_for_test
Expand Down Expand Up @@ -34,7 +33,8 @@ def task_definition(ecs, image, environment):
return ecs.register_task_definition(
family="dagster",
containerDefinitions=[
{"name": "dagster", "image": image, "environment": environment, "entryPoint": ["ls"]}
{"name": "dagster", "image": image, "environment": environment, "entryPoint": ["ls"]},
{"name": "other", "image": image, "entryPoint": ["ls"]}
],
networkMode="awsvpc",
memory="512",
Expand Down

0 comments on commit 8f29bf9

Please sign in to comment.