初動作
This commit is contained in:
parent
d5027a5e02
commit
04ca2d6e96
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,6 +1,4 @@
|
|||||||
# ---> Python
|
# ---> Python
|
||||||
logs/
|
|
||||||
|
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
*.py[cod]
|
*.py[cod]
|
||||||
|
|||||||
20
README.md
20
README.md
@ -23,7 +23,6 @@ Apach airflow
|
|||||||
* **前提・制限**
|
* **前提・制限**
|
||||||
*Airflowは「DAGどこまで実行した?」などの状態をデータベースで管理する仕組み です。そのため DBなしでは動きません。
|
*Airflowは「DAGどこまで実行した?」などの状態をデータベースで管理する仕組み です。そのため DBなしでは動きません。
|
||||||
|
|
||||||
|
|
||||||
## Develop
|
## Develop
|
||||||
|
|
||||||
### Dockerで構築する
|
### Dockerで構築する
|
||||||
@ -42,3 +41,22 @@ systemd とか unix系コマンド前提の部分がけっこうあります。W
|
|||||||
```sh
|
```sh
|
||||||
curl -LfO 'https://airflow.apache.org/docs/apache-airflow/stable/docker-compose.yaml'
|
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
20
dags/hello_world_dag.py
Normal 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,
|
||||||
|
)
|
||||||
20
examples/dags/hello_world_dag.py
Normal file
20
examples/dags/hello_world_dag.py
Normal 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
1
logs/dag_processor/latest
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
2025-11-13
|
||||||
@ -1,6 +1,7 @@
|
|||||||
requests
|
|
||||||
python-dotenv
|
|
||||||
apache-airflow==3.1.2
|
apache-airflow==3.1.2
|
||||||
pandas==2.3.2
|
|
||||||
duckdb==1.3.2
|
# requests
|
||||||
google-cloud-storage
|
# python-dotenv
|
||||||
|
# pandas==2.3.2
|
||||||
|
# duckdb==1.3.2
|
||||||
|
# google-cloud-storage
|
||||||
Loading…
x
Reference in New Issue
Block a user