File tree Expand file tree Collapse file tree 4 files changed +43
-2
lines changed
dags/utils/posts_insights Expand file tree Collapse file tree 4 files changed +43
-2
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,9 @@ auth_manager = airflow.providers.fab.auth_manager.fab_auth_manager.FabAuthManage
23
23
[dag_processor]
24
24
# How long before timing out a DagFileProcessor, which processes a dag file
25
25
dag_file_processor_timeout = 600
26
+ # We don't really need it based on how we deploy dags.
27
+ # But set it to a large enough 60 * 24 (1 day) to avoid high CPU usage
28
+ min_file_process_interval = 1440
26
29
27
30
[database]
28
31
# The SqlAlchemy connection string to the metadata database.
@@ -34,7 +37,8 @@ external_db_managers = airflow.providers.fab.auth_manager.models.db.FABDBManager
34
37
35
38
[api]
36
39
# Number of workers to run the Gunicorn web server
37
- workers = 2
40
+ # WARNING:: DO NOT increase this number. Due to our limited resources, increasing it to 2 breaks API server
41
+ workers = 1
38
42
39
43
# Number of seconds the gunicorn webserver waits before timing out on a worker
40
44
worker_timeout = 600
Original file line number Diff line number Diff line change @@ -126,14 +126,21 @@ def _dump_to_bigquery(
126
126
logger .info (f"No { dump_type } to dump!" )
127
127
return
128
128
129
+ if dump_type == "posts" :
130
+ target_table = self .POST_TABLE_NAME
131
+ elif dump_type == "posts insights" :
132
+ target_table = self .INSIGHT_TABLE_NAME
133
+ else :
134
+ raise ValueError (f"Unexpected dump_type { dump_type } " )
135
+
129
136
job_config = bigquery .LoadJobConfig (
130
137
schema = bq_schema_fields ,
131
138
write_disposition = "WRITE_APPEND" ,
132
139
)
133
140
try :
134
141
job = self .bq_client .load_table_from_json (
135
142
posts ,
136
- f"pycontw-225217.ods.{ self . INSIGHT_TABLE_NAME } " ,
143
+ f"pycontw-225217.ods.{ target_table } " ,
137
144
job_config = job_config ,
138
145
)
139
146
job .result ()
Original file line number Diff line number Diff line change @@ -63,6 +63,21 @@ services:
63
63
airflow-init :
64
64
condition : service_completed_successfully
65
65
66
+ airflow-triggerer :
67
+ << : *docker-common
68
+ container_name : airflow-triggerer
69
+ command : triggerer
70
+ healthcheck :
71
+ test : ["CMD-SHELL", 'airflow jobs check --job-type TriggererJob --hostname "$${HOSTNAME}"']
72
+ interval : 30s
73
+ timeout : 10s
74
+ retries : 5
75
+ start_period : 30s
76
+ restart : always
77
+ depends_on :
78
+ airflow-init :
79
+ condition : service_completed_successfully
80
+
66
81
airflow-init :
67
82
<< : *docker-common
68
83
entrypoint : /bin/bash
Original file line number Diff line number Diff line change @@ -58,6 +58,21 @@ services:
58
58
airflow-init :
59
59
condition : service_completed_successfully
60
60
61
+ airflow-triggerer :
62
+ << : *docker-common
63
+ container_name : airflow-triggerer
64
+ command : triggerer
65
+ healthcheck :
66
+ test : ["CMD-SHELL", 'airflow jobs check --job-type TriggererJob --hostname "$${HOSTNAME}"']
67
+ interval : 30s
68
+ timeout : 10s
69
+ retries : 5
70
+ start_period : 30s
71
+ restart : always
72
+ depends_on :
73
+ airflow-init :
74
+ condition : service_completed_successfully
75
+
61
76
airflow-init :
62
77
<< : *docker-common
63
78
entrypoint : /bin/bash
You can’t perform that action at this time.
0 commit comments