You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/10/15 19:34:27 UTC

[GitHub] [airflow] potix2 commented on a change in pull request #11531: Add type hints to aws provider

potix2 commented on a change in pull request #11531:
URL: https://github.com/apache/airflow/pull/11531#discussion_r505790657



##########
File path: tests/providers/amazon/aws/operators/test_batch.py
##########
@@ -86,7 +86,7 @@ def test_init(self):
         self.assertEqual(self.batch.waiters, None)
         self.assertEqual(self.batch.hook.max_retries, self.MAX_RETRIES)
         self.assertEqual(self.batch.hook.status_retries, self.STATUS_RETRIES)
-        self.assertEqual(self.batch.parameters, None)

Review comment:
       We cannot pass `None` as the argument `parameters`. The API document is [here](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/batch.html#Batch.Client.submit_job). 
   
   I checked the behavior of `submit_job` with the following code.
   ```python
   #!/usr/bin/env python
   
   import boto3
   import json
   
   cl = boto3.client('batch')
   ap=None
   params=None
   overrides=None
   resp = cl.submit_job(
           jobName='myjob-1',
           jobQueue='test-batch-job-queue',
           jobDefinition='test',
           arrayProperties=ap,
           parameters=params,
           containerOverrides=overrides,
           )
   print(json.dumps(resp, indent=4, sort_keys=True))
   ```
   
   Result:
   ```
   Traceback (most recent call last):
     File "main.py", line 17, in <module>
       containerOverrides=overrides,
     File "/Users/potix2/.pyenv/versions/3.7.5/lib/python3.7/site-packages/botocore/client.py", line 357, in _api_call
       return self._make_api_call(operation_name, kwargs)
     File "/Users/potix2/.pyenv/versions/3.7.5/lib/python3.7/site-packages/botocore/client.py", line 649, in _make_api_call
       api_params, operation_model, context=request_context)
     File "/Users/potix2/.pyenv/versions/3.7.5/lib/python3.7/site-packages/botocore/client.py", line 697, in _convert_to_request_dict
       api_params, operation_model)
     File "/Users/potix2/.pyenv/versions/3.7.5/lib/python3.7/site-packages/botocore/validate.py", line 297, in serialize_to_request
       raise ParamValidationError(report=report.generate_report())
   botocore.exceptions.ParamValidationError: Parameter validation failed:
   Invalid type for parameter arrayProperties, value: None, type: <class 'NoneType'>, valid types: <class 'dict'>
   Invalid type for parameter parameters, value: None, type: <class 'NoneType'>, valid types: <class 'dict'>
   Invalid type for parameter containerOverrides, value: None, type: <class 'NoneType'>, valid types: <class 'dict'>




----------------------------------------------------------------
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:
users@infra.apache.org