BasPH commented on code in PR #36035:
URL: https://github.com/apache/airflow/pull/36035#discussion_r1413194319
##########
dev/diagrams/pyproject.toml:
##########
@@ -0,0 +1,25 @@
+[build-system]
+requires = [
+ "setuptools",
+ "wheel",
+]
+
+[project]
+name = "generate-airflow-architecture"
+version = "0.1.0"
+description = "Generate airflow architecture"
+authors = [{ name = "Apache Airflow PMC", email = "[email protected]" }]
+requires-python = ">=3.8"
+classifiers = [
+ "Programming Language :: Python :: 3 :: Only",
+ "Programming Language :: Python :: 3.8",
+ "Programming Language :: Python :: 3.9",
+ "Programming Language :: Python :: 3.10",
+ "Programming Language :: Python :: 3.11",
+ "Programming Language :: Python :: 3.12",
+]
+dependencies = [
+ "diagrams",
+ "rich"
+]
+scripts.generate_airflow_architecture = "generate_airflow_architectire:cli"
Review Comment:
```suggestion
scripts.generate_airflow_architecture = "generate_airflow_architecture:cli"
```
##########
dev/diagrams/generate_airflow_architecture_diagram.py:
##########
@@ -0,0 +1,83 @@
+# 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.
+from __future__ import annotations
+
+from pathlib import Path
+
+from diagrams import Cluster, Diagram, Edge
+from diagrams.custom import Custom
+from diagrams.onprem.client import User
+from diagrams.onprem.database import PostgreSQL
+from diagrams.programming.flowchart import MultipleDocuments
+from rich.console import Console
+
+console = Console(width=400, color_system="standard")
+
+IMAGE_NAME = "basic_airflow_architecture_diagram.png"
+
+LOCAL_DIR = Path(__file__).parent
+AIRFLOW_SOURCES_ROOT = Path(__file__).parent.parent.parent
+DOCS_IMAGES_DIR = AIRFLOW_SOURCES_ROOT / "docs" / "apache-airflow" / "img"
+
+PYTHON_MULTI_PROCESS_LOGO = AIRFLOW_SOURCES_ROOT / "dev" / "images" /
"python_multiprocess_logo.png"
+
+
+def generate_basic_airflow_diagram():
+ with Diagram(name="Basic Airflow Architecture Diagram", show=False,
direction="TB", curvestyle="curved"):
+ operations_user = User("Operations User")
+ with Cluster("UI"):
+ with Cluster("Webserver"):
+ webservers = Custom("Webservers",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
Review Comment:
```suggestion
webservers = Custom("Webserver(s)",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
```
Would write `(s)` to indicate it can be one or more
##########
dev/diagrams/README.md:
##########
@@ -0,0 +1,26 @@
+<!--
+ 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.
+ -->
+
+In order to regenerate the diagrams you need to:
+
+* Have [Graphviz](https://graphviz.org/) installed on your system
+* Create and activate a virtual environment of yours
Review Comment:
We have docs for setting up a virtualenv right? Let's link to those
##########
dev/diagrams/generate_airflow_architecture_diagram.py:
##########
@@ -0,0 +1,83 @@
+# 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.
+from __future__ import annotations
+
+from pathlib import Path
+
+from diagrams import Cluster, Diagram, Edge
+from diagrams.custom import Custom
+from diagrams.onprem.client import User
+from diagrams.onprem.database import PostgreSQL
+from diagrams.programming.flowchart import MultipleDocuments
+from rich.console import Console
+
+console = Console(width=400, color_system="standard")
+
+IMAGE_NAME = "basic_airflow_architecture_diagram.png"
+
+LOCAL_DIR = Path(__file__).parent
+AIRFLOW_SOURCES_ROOT = Path(__file__).parent.parent.parent
+DOCS_IMAGES_DIR = AIRFLOW_SOURCES_ROOT / "docs" / "apache-airflow" / "img"
+
+PYTHON_MULTI_PROCESS_LOGO = AIRFLOW_SOURCES_ROOT / "dev" / "images" /
"python_multiprocess_logo.png"
+
+
+def generate_basic_airflow_diagram():
+ with Diagram(name="Basic Airflow Architecture Diagram", show=False,
direction="TB", curvestyle="curved"):
+ operations_user = User("Operations User")
+ with Cluster("UI"):
+ with Cluster("Webserver"):
+ webservers = Custom("Webservers",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
+
+ operations_user >> Edge(color="brown", style="dotted", reverse=True)
>> webservers
+
+ with Cluster("Scheduling"):
+ with Cluster("Scheduler"):
+ scheduler = Custom("Scheduler",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
+
+ metadata_db = PostgreSQL("Metadata DB")
+
+ dag_author = User("DAG Author")
+ dag_files = MultipleDocuments("DAG files")
+
+ dag_author >> Edge(color="black", style="solid", reverse=False) >>
dag_files
+
+ with Cluster("Execution"):
+ with Cluster("Workers"):
+ workers = Custom("Workers",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
Review Comment:
```suggestion
workers = Custom("Worker(s)",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
```
##########
dev/diagrams/generate_airflow_architecture_diagram.py:
##########
@@ -0,0 +1,83 @@
+# 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.
+from __future__ import annotations
+
+from pathlib import Path
+
+from diagrams import Cluster, Diagram, Edge
+from diagrams.custom import Custom
+from diagrams.onprem.client import User
+from diagrams.onprem.database import PostgreSQL
+from diagrams.programming.flowchart import MultipleDocuments
+from rich.console import Console
+
+console = Console(width=400, color_system="standard")
+
+IMAGE_NAME = "basic_airflow_architecture_diagram.png"
+
+LOCAL_DIR = Path(__file__).parent
+AIRFLOW_SOURCES_ROOT = Path(__file__).parent.parent.parent
+DOCS_IMAGES_DIR = AIRFLOW_SOURCES_ROOT / "docs" / "apache-airflow" / "img"
+
+PYTHON_MULTI_PROCESS_LOGO = AIRFLOW_SOURCES_ROOT / "dev" / "images" /
"python_multiprocess_logo.png"
+
+
+def generate_basic_airflow_diagram():
+ with Diagram(name="Basic Airflow Architecture Diagram", show=False,
direction="TB", curvestyle="curved"):
+ operations_user = User("Operations User")
+ with Cluster("UI"):
+ with Cluster("Webserver"):
+ webservers = Custom("Webservers",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
+
+ operations_user >> Edge(color="brown", style="dotted", reverse=True)
>> webservers
+
+ with Cluster("Scheduling"):
+ with Cluster("Scheduler"):
+ scheduler = Custom("Scheduler",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
+
+ metadata_db = PostgreSQL("Metadata DB")
+
+ dag_author = User("DAG Author")
+ dag_files = MultipleDocuments("DAG files")
+
+ dag_author >> Edge(color="black", style="solid", reverse=False) >>
dag_files
+
+ with Cluster("Execution"):
+ with Cluster("Workers"):
+ workers = Custom("Workers",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
+ with Cluster("Triggerers"):
+ triggerer = Custom("Triggerers",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
Review Comment:
```suggestion
triggerer = Custom("Triggerer(s)",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
```
##########
dev/diagrams/generate_airflow_architecture_diagram.py:
##########
@@ -0,0 +1,83 @@
+# 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.
+from __future__ import annotations
+
+from pathlib import Path
+
+from diagrams import Cluster, Diagram, Edge
+from diagrams.custom import Custom
+from diagrams.onprem.client import User
+from diagrams.onprem.database import PostgreSQL
+from diagrams.programming.flowchart import MultipleDocuments
+from rich.console import Console
+
+console = Console(width=400, color_system="standard")
+
+IMAGE_NAME = "basic_airflow_architecture_diagram.png"
+
+LOCAL_DIR = Path(__file__).parent
+AIRFLOW_SOURCES_ROOT = Path(__file__).parent.parent.parent
+DOCS_IMAGES_DIR = AIRFLOW_SOURCES_ROOT / "docs" / "apache-airflow" / "img"
+
+PYTHON_MULTI_PROCESS_LOGO = AIRFLOW_SOURCES_ROOT / "dev" / "images" /
"python_multiprocess_logo.png"
+
+
+def generate_basic_airflow_diagram():
+ with Diagram(name="Basic Airflow Architecture Diagram", show=False,
direction="TB", curvestyle="curved"):
+ operations_user = User("Operations User")
+ with Cluster("UI"):
+ with Cluster("Webserver"):
+ webservers = Custom("Webservers",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
+
+ operations_user >> Edge(color="brown", style="dotted", reverse=True)
>> webservers
+
+ with Cluster("Scheduling"):
+ with Cluster("Scheduler"):
+ scheduler = Custom("Scheduler",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
Review Comment:
```suggestion
scheduler = Custom("Scheduler(s)",
PYTHON_MULTI_PROCESS_LOGO.as_posix())
```
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]