55import argparse
66import os
77import sys
8+ from typing import Optional
89from jinja2 import Template
910
1011
@@ -19,6 +20,8 @@ def generate_compose_file(
1920 streaming_engine : str ,
2021 punting : bool ,
2122 prometheus_url : str ,
23+ query_language : str ,
24+ data_ingestion_interval : Optional [int ],
2225):
2326 """Generate docker-compose.yml from template with provided variables."""
2427
@@ -43,6 +46,8 @@ def generate_compose_file(
4346 "streaming_engine" : streaming_engine ,
4447 "punting" : punting ,
4548 "prometheus_url" : prometheus_url ,
49+ "query_language" : query_language ,
50+ "data_ingestion_interval" : data_ingestion_interval ,
4651 }
4752
4853 # Render the template
@@ -124,9 +129,26 @@ def main():
124129 required = True ,
125130 help = "Base URL of the Prometheus instance for metric label inference (e.g. http://localhost:9090)" ,
126131 )
132+ parser .add_argument (
133+ "--query-language" ,
134+ required = True ,
135+ choices = ["promql" , "sql" ],
136+ help = "Query language for the controller" ,
137+ )
138+ parser .add_argument (
139+ "--data-ingestion-interval" ,
140+ type = int ,
141+ default = None ,
142+ help = "Data ingestion interval in seconds (SQL mode only)" ,
143+ )
127144
128145 args = parser .parse_args ()
129146
147+ if args .data_ingestion_interval is not None and args .query_language != "sql" :
148+ parser .error (
149+ "--data-ingestion-interval is only valid when --query-language is 'sql'"
150+ )
151+
130152 generate_compose_file (
131153 template_path = args .template_path ,
132154 output_path = args .compose_output_path ,
@@ -138,6 +160,8 @@ def main():
138160 streaming_engine = args .streaming_engine ,
139161 punting = args .punting ,
140162 prometheus_url = args .prometheus_url ,
163+ query_language = args .query_language ,
164+ data_ingestion_interval = args .data_ingestion_interval ,
141165 )
142166
143167
0 commit comments