diff --git a/airflow/contrib/operators/awsbatch_operator.py b/airflow/contrib/operators/awsbatch_operator.py index 22508d17c56a2..a90f57ddd47d1 100644 --- a/airflow/contrib/operators/awsbatch_operator.py +++ b/airflow/contrib/operators/awsbatch_operator.py @@ -93,7 +93,7 @@ def __init__(self, job_name, job_definition, job_queue, overrides, array_propert self.job_definition = job_definition self.job_queue = job_queue self.overrides = overrides - self.array_properties = array_properties + self.array_properties = array_properties or {} self.max_retries = max_retries self.jobId = None # pylint: disable=invalid-name diff --git a/tests/contrib/operators/test_awsbatch_operator.py b/tests/contrib/operators/test_awsbatch_operator.py index 8814857c14736..64bcbf2f68add 100644 --- a/tests/contrib/operators/test_awsbatch_operator.py +++ b/tests/contrib/operators/test_awsbatch_operator.py @@ -53,7 +53,7 @@ def test_init(self): self.assertEqual(self.batch.job_definition, 'hello-world') self.assertEqual(self.batch.max_retries, 5) self.assertEqual(self.batch.overrides, {}) - self.assertEqual(self.batch.array_properties, None) + self.assertEqual(self.batch.array_properties, {}) self.assertEqual(self.batch.region_name, 'eu-west-1') self.assertEqual(self.batch.aws_conn_id, None) self.assertEqual(self.batch.hook, self.aws_hook_mock.return_value) @@ -78,7 +78,7 @@ def test_execute_without_failures(self, check_mock, wait_mock): jobName='51455483-c62c-48ac-9b88-53a6a725baa3', containerOverrides={}, jobDefinition='hello-world', - arrayProperties=None + arrayProperties={} ) wait_mock.assert_called_once_with() @@ -99,7 +99,7 @@ def test_execute_with_failures(self): jobName='51455483-c62c-48ac-9b88-53a6a725baa3', containerOverrides={}, jobDefinition='hello-world', - arrayProperties=None + arrayProperties={} ) def test_wait_end_tasks(self):