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/06 01:09:26 UTC

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

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