From 04ca2d6e967b8f7bbc545e396c606d1aef6abccf Mon Sep 17 00:00:00 2001 From: "ry.yamafuji" Date: Thu, 13 Nov 2025 23:16:25 +0900 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=8B=95=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 -- README.md | 22 ++++++++++++++++++++-- dags/hello_world_dag.py | 20 ++++++++++++++++++++ examples/dags/hello_world_dag.py | 20 ++++++++++++++++++++ logs/dag_processor/latest | 1 + requirements.txt | 11 ++++++----- 6 files changed, 67 insertions(+), 9 deletions(-) create mode 100644 dags/hello_world_dag.py create mode 100644 examples/dags/hello_world_dag.py create mode 120000 logs/dag_processor/latest diff --git a/.gitignore b/.gitignore index 48a4811..0dbf2f2 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,4 @@ # ---> Python -logs/ - # Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] diff --git a/README.md b/README.md index 26bd02b..b76a296 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,6 @@ Apach airflow * **前提・制限** *Airflowは「DAGどこまで実行した?」などの状態をデータベースで管理する仕組み です。そのため DBなしでは動きません。 - ## Develop ### Dockerで構築する @@ -41,4 +40,23 @@ systemd とか unix系コマンド前提の部分がけっこうあります。W ```sh curl -LfO 'https://airflow.apache.org/docs/apache-airflow/stable/docker-compose.yaml' -``` \ No newline at end of file +``` + +### 仮想環境 + +```sh +python -m venv venv +# Linux +source venv/bin/activate +# # Windows +# venv\Scripts\activate +pip install -r requirements.txt +``` + + +## How To Use + +チュートリアル +https://airflow.apache.org/docs/apache-airflow/stable/tutorial/fundamentals.html + +Airflowは、`dags/`フォルダ内に.pyファイルを置けば自動で読み込みます。 \ No newline at end of file diff --git a/dags/hello_world_dag.py b/dags/hello_world_dag.py new file mode 100644 index 0000000..68370b9 --- /dev/null +++ b/dags/hello_world_dag.py @@ -0,0 +1,20 @@ +from datetime import datetime +from airflow import DAG +from airflow.providers.standard.operators.python import PythonOperator + + +def say_hello(): + print("Hello, Airflow! 初めてDAGを動かします。") + + +with DAG( + dag_id="hello_world", + start_date=datetime(2024, 1, 1), + schedule=None, # 手動実行 + catchup=False, +) as dag: + + hello_task = PythonOperator( + task_id="hello_task", + python_callable=say_hello, + ) \ No newline at end of file diff --git a/examples/dags/hello_world_dag.py b/examples/dags/hello_world_dag.py new file mode 100644 index 0000000..68370b9 --- /dev/null +++ b/examples/dags/hello_world_dag.py @@ -0,0 +1,20 @@ +from datetime import datetime +from airflow import DAG +from airflow.providers.standard.operators.python import PythonOperator + + +def say_hello(): + print("Hello, Airflow! 初めてDAGを動かします。") + + +with DAG( + dag_id="hello_world", + start_date=datetime(2024, 1, 1), + schedule=None, # 手動実行 + catchup=False, +) as dag: + + hello_task = PythonOperator( + task_id="hello_task", + python_callable=say_hello, + ) \ No newline at end of file diff --git a/logs/dag_processor/latest b/logs/dag_processor/latest new file mode 120000 index 0000000..2700722 --- /dev/null +++ b/logs/dag_processor/latest @@ -0,0 +1 @@ +2025-11-13 \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 86e0c49..bd59adc 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,7 @@ -requests -python-dotenv apache-airflow==3.1.2 -pandas==2.3.2 -duckdb==1.3.2 -google-cloud-storage \ No newline at end of file + +# requests +# python-dotenv +# pandas==2.3.2 +# duckdb==1.3.2 +# google-cloud-storage \ No newline at end of file