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 2021/02/25 18:02:57 UTC

[GitHub] [airflow] xinbinhuang commented on pull request #14418: Fix #14417 : Failing to submit Druid ingestion task

xinbinhuang commented on pull request #14418:
URL: https://github.com/apache/airflow/pull/14418#issuecomment-786093693


   This is caused by #7127. It would be nice if you can also add a test case in [test_druid.py](https://github.com/apache/airflow/blob/master/tests/providers/apache/druid/operators/test_druid.py) to read `inde_spec` from a JSON file. You can do it roughly like this 
   
   ```python
   def test_read_spec_from_file(self):
           with NamedTemporaryFile("w") as f:
               index_json_str = '''
               {
                   "type": "{{ params.index_type }}",
                   "datasource": "{{ params.datasource }}",
                   "spec": {
                       "dataSchema": {
                           "granularitySpec": {
                               "intervals": ["{{ ds }}/{{ macros.ds_add(ds, 1) }}"]
                           }
                       }
                   }
               }
           '''
               f.write(cloud_build_config)
               f.flush()
               operator = DruidOperator(
                   task_id='spark_submit_job',
                   json_index_file=f.name,
                   params={
                       'index_type': 'index_hadoop',
                       'datasource': 'datasource_prd'
                   },
                   dag=self.dag
               )
               ti = TaskInstance(operator, DEFAULT_DATE)
               ti.render_templates()
               expected = ...
   ```


----------------------------------------------------------------
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