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 2022/04/05 22:01:27 UTC

[GitHub] [airflow] bbovenzi opened a new pull request, #22766: Add summary of runs to dag details

bbovenzi opened a new pull request, #22766:
URL: https://github.com/apache/airflow/pull/22766

   The default details panel of DAG details was fairly basic. This PR adds a summary of the dag runs currently displayed by the Grid view to the DAG details.
   
   
   <img width="1102" alt="Screen Shot 2022-04-05 at 5 59 03 PM" src="https://user-images.githubusercontent.com/4600967/161857001-5871e6b1-44f9-4b0b-9fd3-0185304eed61.png">
   
   ---
   **^ Add meaningful description above**
   
   Read the **[Pull Request Guidelines](https://github.com/apache/airflow/blob/main/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/main/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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] github-actions[bot] commented on pull request #22766: Add summary of runs to dag details

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #22766:
URL: https://github.com/apache/airflow/pull/22766#issuecomment-1090278093

   The PR is likely OK to be merged with just subset of tests for default Python and Database versions without running the full matrix of tests, because it does not modify the core of Airflow. If the committers decide that the full tests matrix is needed, they will add the label 'full tests needed'. Then you should rebase to the latest main or amend the last commit of the PR, and push it with --force-with-lease.


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] ryanahamilton commented on a diff in pull request #22766: Add summary of runs to dag details

Posted by GitBox <gi...@apache.org>.
ryanahamilton commented on code in PR #22766:
URL: https://github.com/apache/airflow/pull/22766#discussion_r843379215


##########
airflow/www/static/js/tree/details/content/Dag.jsx:
##########
@@ -60,11 +62,90 @@ const Dag = () => {
     }
   });
 
+  const numMap = finalStatesMap();
+  const durations = [];
+  dagRuns.forEach((dagRun) => {
+    durations.push(getDuration(dagRun.startDate, dagRun.endDate));
+    const stateKey = dagRun.state == null ? 'no_status' : dagRun.state;
+    if (numMap.has(stateKey)) numMap.set(stateKey, numMap.get(stateKey) + 1);
+  });
+
+  const stateSummary = [];
+  numMap.forEach((key, val) => {
+    if (key > 0) {
+      stateSummary.push(
+        // eslint-disable-next-line react/no-array-index-key
+        <Tr key={val}>
+          <Td>
+            Total
+            {' '}
+            {val}
+          </Td>
+          <Td>
+            {key}
+          </Td>
+        </Tr>,
+      );
+    }
+  });
+
+  // calculate dag run bar heights relative to max
+  const max = Math.max.apply(null, durations);
+  const min = Math.min.apply(null, durations);
+  const avg = mean(durations);
+
   return (
     <>
-      <Button as={Link} mb={2} variant="ghost" colorScheme="blue" href={dagDetailsUrl}>
+      <Button as={Link} variant="ghost" colorScheme="blue" href={dagDetailsUrl}>
         DAG Details
       </Button>
+      {durations.length > 0 && (
+        <>
+          <Text mt={4} mb={2}>DAG Runs Summary</Text>

Review Comment:
   Wonder if these should be bolded to stand out a bit more? Additionally, `Heading` might be a better semantic choice than `Text`?



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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] bbovenzi commented on a diff in pull request #22766: Add summary of runs to dag details

Posted by GitBox <gi...@apache.org>.
bbovenzi commented on code in PR #22766:
URL: https://github.com/apache/airflow/pull/22766#discussion_r843441820


##########
airflow/www/static/js/tree/details/content/Dag.jsx:
##########
@@ -60,11 +62,90 @@ const Dag = () => {
     }
   });
 
+  const numMap = finalStatesMap();
+  const durations = [];
+  dagRuns.forEach((dagRun) => {
+    durations.push(getDuration(dagRun.startDate, dagRun.endDate));
+    const stateKey = dagRun.state == null ? 'no_status' : dagRun.state;
+    if (numMap.has(stateKey)) numMap.set(stateKey, numMap.get(stateKey) + 1);
+  });
+
+  const stateSummary = [];
+  numMap.forEach((key, val) => {
+    if (key > 0) {
+      stateSummary.push(
+        // eslint-disable-next-line react/no-array-index-key
+        <Tr key={val}>
+          <Td>
+            Total
+            {' '}
+            {val}
+          </Td>
+          <Td>
+            {key}
+          </Td>
+        </Tr>,
+      );
+    }
+  });
+
+  // calculate dag run bar heights relative to max
+  const max = Math.max.apply(null, durations);
+  const min = Math.min.apply(null, durations);
+  const avg = mean(durations);
+
   return (
     <>
-      <Button as={Link} mb={2} variant="ghost" colorScheme="blue" href={dagDetailsUrl}>
+      <Button as={Link} variant="ghost" colorScheme="blue" href={dagDetailsUrl}>
         DAG Details
       </Button>
+      {durations.length > 0 && (
+        <>
+          <Text mt={4} mb={2}>DAG Runs Summary</Text>

Review Comment:
   Updated.



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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [airflow] bbovenzi merged pull request #22766: Add summary of runs to dag details

Posted by GitBox <gi...@apache.org>.
bbovenzi merged PR #22766:
URL: https://github.com/apache/airflow/pull/22766


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

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org