初動作

This commit is contained in:
ry.yamafuji 2025-11-13 23:16:25 +09:00
parent d5027a5e02
commit 04ca2d6e96
6 changed files with 67 additions and 9 deletions

2
.gitignore vendored
View File

@ -1,6 +1,4 @@
# ---> Python
logs/
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]

View File

@ -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'
```
```
### 仮想環境
```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ファイルを置けば自動で読み込みます。

20
dags/hello_world_dag.py Normal file
View File

@ -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,
)

View File

@ -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,
)

1
logs/dag_processor/latest Symbolic link
View File

@ -0,0 +1 @@
2025-11-13

View File

@ -1,6 +1,7 @@
requests
python-dotenv
apache-airflow==3.1.2
pandas==2.3.2
duckdb==1.3.2
google-cloud-storage
# requests
# python-dotenv
# pandas==2.3.2
# duckdb==1.3.2
# google-cloud-storage