turbaszek opened a new pull request #12704:
URL: https://github.com/apache/airflow/pull/12704


   This commit unifies the mechanism of rendering output of tabular
   data. This gives users a possibility to eiter display a tabular
   representation of data or render it as valid json or yaml payload.
   
   Closes: #12699
   
   ## Example:
   Table:
   ```
   root@e794bcc2d698:/opt/airflow# airflow tasks states-for-dag-run 
tasks_are_awesome 2020-11-13T00:00:00+00:00
   dag_id            | execution_date            | task_id | state   | 
start_date                       | end_date
   
==================+===========================+=========+=========+==================================+=================================
   tasks_are_awesome | 2020-11-13T00:00:00+00:00 | numbers | success | 
2020-11-29T14:53:46.811030+00:00 | 2020-11-29T14:53:46.974545+00:00
   tasks_are_awesome | 2020-11-13T00:00:00+00:00 | show__2 | success | 
2020-11-29T14:53:56.926441+00:00 | 2020-11-29T14:53:57.118781+00:00
   tasks_are_awesome | 2020-11-13T00:00:00+00:00 | show    | success | 
2020-11-29T14:53:56.915802+00:00 | 2020-11-29T14:53:57.125230+00:00
   tasks_are_awesome | 2020-11-13T00:00:00+00:00 | show__1 | success | 
2020-11-29T14:53:56.922131+00:00 | 2020-11-29T14:53:57.129091+00:00
   tasks_are_awesome | 2020-11-13T00:00:00+00:00 | show__3 | success | 
2020-11-29T14:53:56.931243+00:00 | 2020-11-29T14:53:57.126306+00:00
   ```
   
   JSON:
   ```
   root@e794bcc2d698:/opt/airflow# airflow tasks states-for-dag-run 
tasks_are_awesome 2020-11-13T00:00:00+00:00 --outpu json
   [{"dag_id": "tasks_are_awesome", "execution_date": 
"2020-11-13T00:00:00+00:00", "task_id": "numbers", "state": "success", 
"start_date": "2020-11-29T14:53:46.811030+00:00", "end_date": 
"2020-11-29T14:53:46.974545+00:00"}, {"dag_id": "tasks_are_awesome", 
"execution_date": "2020-11-13T00:00:00+00:00", "task_id": "show__2", "state": 
"success", "start_date": "2020-11-29T14:53:56.926441+00:00", "end_date": 
"2020-11-29T14:53:57.118781+00:00"}, {"dag_id": "tasks_are_awesome", 
"execution_date": "2020-11-13T00:00:00+00:00", "task_id": "show", "state": 
"success", "start_date": "2020-11-29T14:53:56.915802+00:00", "end_date": 
"2020-11-29T14:53:57.125230+00:00"}, {"dag_id": "tasks_are_awesome", 
"execution_date": "2020-11-13T00:00:00+00:00", "task_id": "show__1", "state": 
"success", "start_date": "2020-11-29T14:53:56.922131+00:00", "end_date": 
"2020-11-29T14:53:57.129091+00:00"}, {"dag_id": "tasks_are_awesome", 
"execution_date": "2020-11-13T00:00:00+00:00", "task_id": "show__3", "state": 
"succes
 s", "start_date": "2020-11-29T14:53:56.931243+00:00", "end_date": 
"2020-11-29T14:53:57.126306+00:00"}]
   ```
   
   YAML:
   ```
   root@e794bcc2d698:/opt/airflow# airflow tasks states-for-dag-run 
tasks_are_awesome 2020-11-13T00:00:00+00:00 --output yaml
   - dag_id: tasks_are_awesome
     end_date: '2020-11-29T14:53:46.974545+00:00'
     execution_date: '2020-11-13T00:00:00+00:00'
     start_date: '2020-11-29T14:53:46.811030+00:00'
     state: success
     task_id: numbers
   - dag_id: tasks_are_awesome
     end_date: '2020-11-29T14:53:57.118781+00:00'
     execution_date: '2020-11-13T00:00:00+00:00'
     start_date: '2020-11-29T14:53:56.926441+00:00'
     state: success
     task_id: show__2
   - dag_id: tasks_are_awesome
     end_date: '2020-11-29T14:53:57.125230+00:00'
     execution_date: '2020-11-13T00:00:00+00:00'
     start_date: '2020-11-29T14:53:56.915802+00:00'
     state: success
     task_id: show
   - dag_id: tasks_are_awesome
     end_date: '2020-11-29T14:53:57.129091+00:00'
     execution_date: '2020-11-13T00:00:00+00:00'
     start_date: '2020-11-29T14:53:56.922131+00:00'
     state: success
     task_id: show__1
   - dag_id: tasks_are_awesome
     end_date: '2020-11-29T14:53:57.126306+00:00'
     execution_date: '2020-11-13T00:00:00+00:00'
     start_date: '2020-11-29T14:53:56.931243+00:00'
     state: success
     task_id: show__3
   ```
   
   <img width="1378" alt="Screenshot 2020-11-29 at 02 07 29" 
src="https://user-images.githubusercontent.com/9528307/100546142-f0e8c280-325f-11eb-9ec8-1d001faf7d63.png";>
   
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request 
Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)**
 for more information.
   In case of fundamental code change, Airflow Improvement Proposal 
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals))
 is needed.
   In case of a new dependency, check compliance with the [ASF 3rd Party 
License Policy](https://www.apache.org/legal/resolved.html#category-x).
   In case of backwards incompatible changes please leave a note in 
[UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
   


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


Reply via email to