Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enable removing networkConfiguration from AWS ECS Run Task API call (#…
…26893) ## Summary & Motivation When ECS Run Launcher is used it calculates ECS Task `networkConfiguration` [here](https://github.com/dagster-io/dagster/blob/0f2de9b6a006e45cd70f886cad0c8eebd7512036/python_modules/libraries/dagster-aws/dagster_aws/ecs/tasks.py#L375). This works well for AWS Tasks with `awsvpc` networkMode, but for other networkModes the configuration should not be passed to the run task API call ([documentation](https://docs.aws.amazon.com/cli/latest/reference/ecs/run-task.html)). The problem is that if you set `networkConfiguration` to null, example: ``` run_launcher: module: "dagster_aws.ecs" class: "EcsRunLauncher" config: task_definition: arn:aws:ecs:... container_name: ... run_task_kwargs: networkConfiguration: null ``` then the null value will be passed "as is" to the API call, causing a following error: ``` botocore.exceptions.ParamValidationError: Parameter validation failed: Invalid type for parameter networkConfiguration, value: None, type: <class 'NoneType'>, valid types: <class 'dict'> ``` This PR introduces a check: if `networkConfiguration` is set to None, it will be removed from the arguments of the API call. This change will enable dagster users to use `bridge` network mode in ECS Tasks which was requested in this [issue](#16420) issue (3 requests including us). ## How I Tested These Changes I ran dagster with this change and it successfully launched jobs as AWS Tasks with `bridge` network mode. --------- Co-authored-by: Levy Melnikov <[email protected]>
- Loading branch information