Skip to content

Commit

Permalink
Merge pull request #22 from yby654/main
Browse files Browse the repository at this point in the history
README.md update
  • Loading branch information
ish-hcc authored Nov 25, 2024
2 parents 34e0d46 + 41b3ddc commit d46865c
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 1 deletion.
69 changes: 69 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,75 @@ The Task Component automatically generated from the above JSON is as follows:

</details>

## SMTP

### 1. Add SMTP info
file path : /_airflow/docker-compose.yml

modify docker-compose.yml file and enter your smtp info.

gmail example : https://support.google.com/a/answer/176600?hl=en


```
...
airflow-server:
environment:
AIRFLOW__SMTP__SMTP_HOST: 'smtp.gmail.com'
AIRFLOW__SMTP__SMTP_USER: '[email protected]'
AIRFLOW__SMTP__SMTP_PASSWORD: 'wtknvaprkkwyaurd'
AIRFLOW__SMTP__SMTP_PORT: 587
AIRFLOW__SMTP__SMTP_MAIL_FROM: '[email protected]'
...
```
### 2. Modify mail.py
file path : /_airflow/airflow-home/dags/mail.py

Modify the recipient's email address in the email_task.

```
...
email_task = EmailOperator(
task_id='send_email',
to='Your [email protected]',
subject='DAG 상태 보고서',
...
)
...
```

### 3. Add taskComponent
Add trigger_email task component at the bottom of the workflow to receive email alarms.

```
...
{
"name": "trigger_email",
"task_component": "trigger_email",
"request_body": "",
"path_params": {},
"dependencies": [
"{$Pre_taskName}"
]
}
...
```

## GET task log
### 1. GET workflow RunId
[GET] /workflow/{wfId}/runs
![image](https://github.com/user-attachments/assets/27fbaf5f-c52d-4d04-b599-ef2eac9e76de)

### 2. GET taskId and task_Try_Num
[GET] /workflow/{wfId}/workflowRun/{wfRunId}/taskInstances
![image](https://github.com/user-attachments/assets/d893cc1a-2cbd-417c-a19d-a650aaca7f6e)

### 3. GET execution task log
[GET] /workflow/{wfId}/workflowRun/{wfRunId}/task/{taskId}/taskTryNum/{taskTyNum}/logs
![image](https://github.com/user-attachments/assets/347babf5-df32-4fe0-82e0-f0e111c333d1)


## Health-check

Check if CM-Cicada is running
Expand Down
2 changes: 1 addition & 1 deletion _airflow/airflow-home/dags/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def _inner(session=None):
email_task = EmailOperator(
task_id='send_email',
to='[email protected]',
subject='DAG 상태 보고서',
subject='Workflow 상태 보고서',
html_content="""<h3>Workflow Execution Complete</h3>
<p><strong>Workflow ID:</strong> {{ ti.xcom_pull(task_ids='collect_failed_tasks').get('dag_id') }}</p>
<p><strong>Workflow Run ID:</strong> {{ ti.xcom_pull(task_ids='collect_failed_tasks').get('dag_run_id') }}</p>
Expand Down

0 comments on commit d46865c

Please sign in to comment.