scottypate opened a new pull request #16050:
URL: https://github.com/apache/airflow/pull/16050
This PR corrects two errors that can occur when utilizing the parameter
`reattach=True`. These two errors are detailed below.
1. The `describe_task_definition()` function requires a named keyword
argument instead of a positional argument. The current error generated is...
```
[2021-05-25 14:33:24,145] {{taskinstance.py:1455}} ERROR -
describe_task_definition() only accepts keyword arguments.
Traceback (most recent call last):
File
"/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py",
line 1112, in _run_raw_task
self._prepare_and_execute_task_with_callbacks(context, task)
File
"/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py",
line 1285, in _prepare_and_execute_task_with_callbacks
result = self._execute_task(context, task_copy)
File
"/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py",
line 1310, in _execute_task
result = task_copy.execute(context=context)
File
"/home/airflow/.local/lib/python3.8/site-packages/airflow/providers/amazon/aws/operators/ecs.py",
line 193, in execute
self._try_reattach_task()
File
"/home/airflow/.local/lib/python3.8/site-packages/airflow/providers/amazon/aws/operators/ecs.py",
line 244, in _try_reattach_task
task_def_resp =
self.client.describe_task_definition(self.task_definition)
File
"/home/airflow/.local/lib/python3.8/site-packages/botocore/client.py", line
354, in _api_call
raise TypeError(
TypeError: describe_task_definition() only accepts keyword arguments.
```
2. The `list_tasks()` function cannot provide both `launch_type` and
`family` as a filter criteria. The current error generated is...
```
[2021-05-25 12:32:18,441] {{taskinstance.py:1455}} ERROR - An error occurred
(InvalidParameterException) when calling the ListTasks operation: cannot
specify filters 'launchType' and 'family' at the same time
Traceback (most recent call last):
File
"/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py",
line 1112, in _run_raw_task
self._prepare_and_execute_task_with_callbacks(context, task)
File
"/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py",
line 1285, in _prepare_and_execute_task_with_callbacks
result = self._execute_task(context, task_copy)
File
"/home/airflow/.local/lib/python3.8/site-packages/airflow/models/taskinstance.py",
line 1310, in _execute_task
result = task_copy.execute(context=context)
File
"/home/airflow/.local/lib/python3.8/site-packages/airflow/providers/amazon/aws/operators/ecs.py",
line 193, in execute
self._try_reattach_task()
File
"/home/airflow/.local/lib/python3.8/site-packages/airflow/providers/amazon/aws/operators/ecs.py",
line 247, in _try_reattach_task
list_tasks_resp = self.client.list_tasks(
File
"/home/airflow/.local/lib/python3.8/site-packages/botocore/client.py", line
357, in _api_call
return self._make_api_call(operation_name, kwargs)
File
"/home/airflow/.local/lib/python3.8/site-packages/botocore/client.py", line
676, in _make_api_call
raise error_class(parsed_response, operation_name)
```
When creating a task definition with the same family name but changing the
`launch_type`, then it creates a new revision of the task with the same family
name. I removed this `launch_type` parameter from this function. The ECS task
will be running the latest version of the task definition and I don't think it
would be possible to be running the same family of task definition on multiple
`launch_type` strategies.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]