You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "dheerajturaga (via GitHub)" <gi...@apache.org> on 2025/09/11 15:36:57 UTC

[PR] feat: Add shutdown button for edge workers with confirmation dialog [airflow]

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

     - Add shutdown API endpoint at /edge_worker/ui/worker/{worker_name}/shutdown
     - Create WorkerShutdownButton component with FaPowerOff icon in red
     - Implement confirmation dialog warning about worker termination
     - Integrate with existing request_shutdown function from edge_worker models
     - Add shutdown button to WorkerOperations for idle/running/maintenance workers
     - Update OpenAPI spec and regenerate TypeScript client code
     - Position shutdown button after maintenance operations for better UX
   
   <img width="1911" height="687" alt="shutdown edge 1" src="https://github.com/user-attachments/assets/c2fb092b-f371-4762-80f2-4bd10997b5ac" />
   
   <img width="1918" height="686" alt="shutdown edge 2" src="https://github.com/user-attachments/assets/802fd862-3466-4fbd-a7e4-b99619055416" />
   
   <img width="1918" height="640" alt="shutdown edge 3" src="https://github.com/user-attachments/assets/79045e6b-e961-4e64-8a03-f4ec9ba11919" />
   
   <img width="1573" height="258" alt="shutdown edge 4" src="https://github.com/user-attachments/assets/78254bc9-f13a-4ed6-88a0-4d9ea3c0ecc5" />
   
   


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


Re: [PR] feat: Add shutdown button for edge workers with confirmation dialog [airflow]

Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl commented on code in PR #55513:
URL: https://github.com/apache/airflow/pull/55513#discussion_r2341712652


##########
providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/WorkerShutdownButton.tsx:
##########
@@ -0,0 +1,102 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Button, CloseButton, Dialog, IconButton, Portal, Text, useDisclosure } from "@chakra-ui/react";
+import { useUiServiceRequestWorkerShutdown } from "openapi/queries";
+import { FaPowerOff } from "react-icons/fa";
+
+interface WorkerShutdownButtonProps {
+  onShutdown: (toast: Record<string, string>) => void;
+  workerName: string;
+}
+
+export const WorkerShutdownButton = ({ onShutdown, workerName }: WorkerShutdownButtonProps) => {
+  const { onClose, onOpen, open } = useDisclosure();
+
+  const shutdownMutation = useUiServiceRequestWorkerShutdown({
+    onError: (error) => {
+      onShutdown({
+        description: `Unable to request shutdown for worker ${workerName}: ${error}`,
+        title: "Shutdown Request Failed",
+        type: "error",
+      });
+    },
+    onSuccess: () => {
+      onShutdown({
+        description: `Worker ${workerName} was requested to shutdown.`,
+        title: "Shutdown Request Sent",
+        type: "success",
+      });
+      onClose();
+    },
+  });
+
+  const handleShutdown = () => {
+    shutdownMutation.mutate({ workerName });
+  };
+
+  return (
+    <>
+      <IconButton
+        size="sm"
+        variant="ghost"
+        onClick={onOpen}
+        aria-label="Shutdown Worker"
+        title="Shutdown Worker"
+        color="red.500"
+      >
+        <FaPowerOff />
+      </IconButton>
+
+      <Dialog.Root onOpenChange={onClose} open={open} size="md">
+        <Portal>
+          <Dialog.Backdrop />
+          <Dialog.Positioner>
+            <Dialog.Content>
+              <Dialog.Header>
+                <Dialog.Title>Shutdown worker {workerName}</Dialog.Title>
+              </Dialog.Header>
+              <Dialog.Body>
+                <Text>Are you sure you want to request shutdown for worker {workerName}?</Text>
+                <Text fontSize="sm" color="red.500" mt={2}>
+                  This will terminate the worker process on the remote edge site.

Review Comment:
   Can you add a bit more text to make the impact clear?
   ```suggestion
                     This will terminate the worker process on the remote edge site. You can not start the worker from the UI here but maybe need to start from your remote.
   ```



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


Re: [PR] feat: Add shutdown button for edge workers with confirmation dialog [airflow]

Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl merged PR #55513:
URL: https://github.com/apache/airflow/pull/55513


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


Re: [PR] feat: Add shutdown button for edge workers with confirmation dialog [airflow]

Posted by "jscheffl (via GitHub)" <gi...@apache.org>.
jscheffl commented on code in PR #55513:
URL: https://github.com/apache/airflow/pull/55513#discussion_r2341743474


##########
providers/edge3/src/airflow/providers/edge3/plugins/www/src/components/WorkerShutdownButton.tsx:
##########
@@ -0,0 +1,102 @@
+/*!
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+import { Button, CloseButton, Dialog, IconButton, Portal, Text, useDisclosure } from "@chakra-ui/react";
+import { useUiServiceRequestWorkerShutdown } from "openapi/queries";
+import { FaPowerOff } from "react-icons/fa";
+
+interface WorkerShutdownButtonProps {
+  onShutdown: (toast: Record<string, string>) => void;
+  workerName: string;
+}
+
+export const WorkerShutdownButton = ({ onShutdown, workerName }: WorkerShutdownButtonProps) => {
+  const { onClose, onOpen, open } = useDisclosure();
+
+  const shutdownMutation = useUiServiceRequestWorkerShutdown({
+    onError: (error) => {
+      onShutdown({
+        description: `Unable to request shutdown for worker ${workerName}: ${error}`,
+        title: "Shutdown Request Failed",
+        type: "error",
+      });
+    },
+    onSuccess: () => {
+      onShutdown({
+        description: `Worker ${workerName} was requested to shutdown.`,
+        title: "Shutdown Request Sent",
+        type: "success",
+      });
+      onClose();
+    },
+  });
+
+  const handleShutdown = () => {
+    shutdownMutation.mutate({ workerName });
+  };
+
+  return (
+    <>
+      <IconButton
+        size="sm"
+        variant="ghost"
+        onClick={onOpen}
+        aria-label="Shutdown Worker"
+        title="Shutdown Worker"
+        color="red.500"
+      >
+        <FaPowerOff />
+      </IconButton>
+
+      <Dialog.Root onOpenChange={onClose} open={open} size="md">
+        <Portal>
+          <Dialog.Backdrop />
+          <Dialog.Positioner>
+            <Dialog.Content>
+              <Dialog.Header>
+                <Dialog.Title>Shutdown worker {workerName}</Dialog.Title>
+              </Dialog.Header>
+              <Dialog.Body>
+                <Text>Are you sure you want to request shutdown for worker {workerName}?</Text>
+                <Text fontSize="sm" color="red.500" mt={2}>
+                  This will terminate the worker process on the remote edge site.

Review Comment:
   As discussed in a 1:1 slack: will be fixed in the nex PR / feature that is "already on the truck"...



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