This is an automated email from the ASF dual-hosted git repository.

pierrejeambrun pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/main by this push:
     new c055e1da0b Hide Irrelevant Dag Processor from Cluster Activity Page 
(#33611)
c055e1da0b is described below

commit c055e1da0b50e98820ffff8f8d10d0882f753384
Author: Rafael Carrasco <[email protected]>
AuthorDate: Sat Sep 2 08:56:11 2023 -0500

    Hide Irrelevant Dag Processor from Cluster Activity Page (#33611)
    
    * first commit
    
    * refactoring
    
    * adding undefined default
    
    * added logic to check if defined
    
    * refactored component
    
    * refactored not equal sign
    
    * refactored code for boolean type instead of string
    
    * refactored global variable. refactored conditional
    
    * pre-commit and linting fixes
    
    * updated jest-setup
    
    * updated jest-setup
    
    * precommit fix
    
    * Update Health.tsx
    
    replacing bottom margin with a top margin
    
    * Update Health.tsx
    
    removed bottom margin from triggerer
---
 airflow/www/jest-setup.js                               |  2 ++
 .../static/js/cluster-activity/live-metrics/Health.tsx  | 17 ++++++++++-------
 airflow/www/static/js/index.d.ts                        |  1 +
 airflow/www/templates/airflow/cluster_activity.html     |  1 +
 airflow/www/views.py                                    |  2 ++
 5 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/airflow/www/jest-setup.js b/airflow/www/jest-setup.js
index b4ce3218c3..48b4e19069 100644
--- a/airflow/www/jest-setup.js
+++ b/airflow/www/jest-setup.js
@@ -59,3 +59,5 @@ global.stateColors = {
 global.defaultDagRunDisplayNumber = 245;
 
 global.moment = moment;
+
+global.standaloneDagProcessor = true;
diff --git a/airflow/www/static/js/cluster-activity/live-metrics/Health.tsx 
b/airflow/www/static/js/cluster-activity/live-metrics/Health.tsx
index 438ce24c21..b311f1a57a 100644
--- a/airflow/www/static/js/cluster-activity/live-metrics/Health.tsx
+++ b/airflow/www/static/js/cluster-activity/live-metrics/Health.tsx
@@ -81,7 +81,6 @@ const HealthSection = ({
 
 const Health = (props: CenterProps) => {
   const { data, isError } = useHealth();
-
   return (
     <Center {...props}>
       <LoadingWrapper hasData={!!data} isError={isError}>
@@ -105,13 +104,17 @@ const Health = (props: CenterProps) => {
               title="Triggerer"
               status={data?.triggerer?.status}
               latestHeartbeat={data?.triggerer?.latestTriggererHeartbeat}
-              mb={3}
-            />
-            <HealthSection
-              title="Dag Processor"
-              status={data?.dagProcessor?.status}
-              latestHeartbeat={data?.dagProcessor?.latestDagProcessorHeartbeat}
             />
+            {!!standaloneDagProcessor && (
+              <HealthSection
+                title="Dag Processor"
+                status={data?.dagProcessor?.status}
+                latestHeartbeat={
+                  data?.dagProcessor?.latestDagProcessorHeartbeat
+                }
+                mt={3}
+              />
+            )}
           </CardBody>
         </Card>
       </LoadingWrapper>
diff --git a/airflow/www/static/js/index.d.ts b/airflow/www/static/js/index.d.ts
index fbe96f7a72..b19840526b 100644
--- a/airflow/www/static/js/index.d.ts
+++ b/airflow/www/static/js/index.d.ts
@@ -22,6 +22,7 @@ import type { DepEdge, DepNode } from "./types";
 // define global variables that come from FAB
 declare global {
   const autoRefreshInterval: number | undefined;
+  const standaloneDagProcessor: boolean | undefined;
   const stateColors: {
     [key: string]: string;
   };
diff --git a/airflow/www/templates/airflow/cluster_activity.html 
b/airflow/www/templates/airflow/cluster_activity.html
index 03ba1fe34f..7d12287e66 100644
--- a/airflow/www/templates/airflow/cluster_activity.html
+++ b/airflow/www/templates/airflow/cluster_activity.html
@@ -43,6 +43,7 @@
   <script>
     const stateColors = {{ state_color_mapping|tojson }};
     const autoRefreshInterval = {{ auto_refresh_interval }};
+    const standaloneDagProcessor = {{ standalone_dag_processor }} === 'True' ;
   </script>
   <script src="{{ url_for_asset('clusterActivity.js') }}"></script>
 {% endblock %}
diff --git a/airflow/www/views.py b/airflow/www/views.py
index 7224b079be..4c2d3d99aa 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -1060,10 +1060,12 @@ class Airflow(AirflowBaseView):
         """Cluster Activity view."""
         state_color_mapping = State.state_color.copy()
         state_color_mapping["no_status"] = state_color_mapping.pop(None)
+        standalone_dag_processor = conf.getboolean("scheduler", 
"standalone_dag_processor")
         return self.render_template(
             "airflow/cluster_activity.html",
             auto_refresh_interval=conf.getint("webserver", 
"auto_refresh_interval"),
             state_color_mapping=state_color_mapping,
+            standalone_dag_processor=standalone_dag_processor,
         )
 
     @expose("/next_run_datasets_summary", methods=["POST"])

Reply via email to