Skip to content

Commit

Permalink
Update Boto3 API calls in ECSOperator (apache#16050)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottypate authored and Jorricks committed Jun 24, 2021
1 parent 09d9171 commit 362a16e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions airflow/providers/amazon/aws/operators/ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,11 @@ def _start_task(self):
self.arn = response['tasks'][0]['taskArn']

def _try_reattach_task(self):
task_def_resp = self.client.describe_task_definition(self.task_definition)
task_def_resp = self.client.describe_task_definition(taskDefinition=self.task_definition)
ecs_task_family = task_def_resp['taskDefinition']['family']

list_tasks_resp = self.client.list_tasks(
cluster=self.cluster, launchType=self.launch_type, desiredStatus='RUNNING', family=ecs_task_family
cluster=self.cluster, desiredStatus='RUNNING', family=ecs_task_family
)
running_tasks = list_tasks_resp['taskArns']

Expand Down
6 changes: 2 additions & 4 deletions tests/providers/amazon/aws/operators/test_ecs.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,11 +340,9 @@ def test_reattach_successful(self, launch_type, tags, start_mock, check_mock, wa
if tags:
extend_args['tags'] = [{'key': k, 'value': v} for (k, v) in tags.items()]

client_mock.describe_task_definition.assert_called_once_with('t')
client_mock.describe_task_definition.assert_called_once_with(taskDefinition='t')

client_mock.list_tasks.assert_called_once_with(
cluster='c', launchType=launch_type, desiredStatus='RUNNING', family='f'
)
client_mock.list_tasks.assert_called_once_with(cluster='c', desiredStatus='RUNNING', family='f')

start_mock.assert_not_called()
wait_mock.assert_called_once_with()
Expand Down

0 comments on commit 362a16e

Please sign in to comment.