Skip to content

Commit 48ab8b2

Browse files
committed
Merge remote-tracking branch 'upstream/main' into remove-needs-flags
2 parents 3808fe2 + b3abc50 commit 48ab8b2

File tree

244 files changed

+24862
-11419
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

244 files changed

+24862
-11419
lines changed

.github/workflows/clp-core-build-macos.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ jobs:
4545
strategy:
4646
matrix:
4747
os:
48+
- "macos-14"
4849
- "macos-15"
4950
use_shared_libs:
5051
- true
@@ -66,6 +67,12 @@ jobs:
6667
rm -f /usr/local/bin/pydoc3*
6768
rm -f /usr/local/bin/python3*
6869
70+
- name: "Remove preinstalled programs which will conflict with the pipx-installed packages"
71+
run: |
72+
if brew list --formula cmake >/dev/null 2>&1; then
73+
brew uninstall --force cmake
74+
fi
75+
6976
- name: "Install dependencies"
7077
run: "./components/core/tools/scripts/lib_install/macos/install-all.sh"
7178

.github/workflows/clp-s-generated-code-checks.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ jobs:
4040

4141
- name: "Generate parsers"
4242
shell: "bash"
43-
run: "task clp-s-generate-parsers"
43+
run: "task codegen:clp-s-generate-parsers"
4444

4545
- name: "Check if the generated parsers are the latest"
4646
shell: "bash"

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
__pycache__/
12
.clang-format
23
.clang-tidy
34
.lint-venv/

NOTICE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
`components/webui/client/sql-parser/SqlBase.g4` was originally authored by the contributors of
2+
https://github.com/prestodb/presto

components/clp-package-utils/clp_package_utils/scripts/compress.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,12 @@ def main(argv):
202202
except Exception as e:
203203
logger.error(e)
204204
return -1
205+
206+
if parsed_args.timestamp_key is None:
207+
logger.warning(
208+
"`--timestamp-key` not specified. Events will not have assigned timestamps and can "
209+
"only be searched from the command line without a timestamp filter."
210+
)
205211
elif dataset is not None:
206212
logger.error(f"Dataset selection is not supported for storage engine: {storage_engine}.")
207213
return -1

components/clp-package-utils/clp_package_utils/scripts/native/search.py

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import sys
1010

1111
import msgpack
12+
import psutil
1213
import pymongo
1314
from clp_py_utils.clp_config import (
1415
Database,
@@ -128,16 +129,11 @@ async def do_search_without_aggregation(
128129
path_filter: str | None,
129130
raw_output: bool,
130131
):
131-
ip_list = socket.gethostbyname_ex(socket.gethostname())[2]
132-
if len(ip_list) == 0:
133-
logger.error("Couldn't determine the current host's IP.")
132+
host = _get_ipv4_address()
133+
if host is None:
134+
logger.error("Couldn't find an IPv4 address for receiving search results.")
134135
return
135-
136-
host = ip_list[0]
137-
for ip in ip_list:
138-
if ipaddress.ip_address(ip) not in ipaddress.IPv4Network("127.0.0.0/8"):
139-
host = ip
140-
break
136+
logger.debug(f"Listening on {host} for search results.")
141137

142138
server = await asyncio.start_server(
143139
client_connected_cb=get_worker_connection_handler(raw_output),
@@ -342,5 +338,30 @@ def main(argv):
342338
return 0
343339

344340

341+
def _get_ipv4_address() -> str | None:
342+
"""
343+
Retrieves an IPv4 address of the host for network communication.
344+
345+
:returns: The first non-loopback IPv4 address it finds.
346+
If no non-loopback address is available, returns the first loopback IPv4 address.
347+
If no IPv4 address is found, returns None.
348+
"""
349+
fallback_ip = None
350+
351+
for addresses in psutil.net_if_addrs().values():
352+
for addr in addresses:
353+
if addr.family != socket.AF_INET:
354+
continue
355+
ip = addr.address
356+
if not ipaddress.ip_address(ip).is_loopback:
357+
return ip
358+
if fallback_ip is None:
359+
fallback_ip = ip
360+
361+
if fallback_ip is not None:
362+
logger.warning("Couldn't find a non-loopback IP address for receiving search results.")
363+
return fallback_ip
364+
365+
345366
if "__main__" == __name__:
346367
sys.exit(main(sys.argv))

components/clp-package-utils/clp_package_utils/scripts/start_clp.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
QUERY_JOBS_TABLE_NAME,
2727
QUERY_SCHEDULER_COMPONENT_NAME,
2828
QUERY_WORKER_COMPONENT_NAME,
29+
QueryEngine,
2930
QUEUE_COMPONENT_NAME,
3031
REDIS_COMPONENT_NAME,
3132
REDUCER_COMPONENT_NAME,
@@ -887,6 +888,7 @@ def start_webui(
887888
"ClientDir": str(container_webui_dir / "client"),
888889
"LogViewerDir": str(container_webui_dir / "yscope-log-viewer"),
889890
"StreamTargetUncompressedSize": container_clp_config.stream_output.target_uncompressed_size,
891+
"ClpQueryEngine": clp_config.package.query_engine,
890892
}
891893

892894
container_cmd_extra_opts = []
@@ -912,6 +914,14 @@ def start_webui(
912914
server_settings_json_updates["StreamFilesS3PathPrefix"] = None
913915
server_settings_json_updates["StreamFilesS3Profile"] = None
914916

917+
query_engine = clp_config.package.query_engine
918+
if QueryEngine.PRESTO == query_engine:
919+
server_settings_json_updates["PrestoHost"] = clp_config.presto.host
920+
server_settings_json_updates["PrestoPort"] = clp_config.presto.port
921+
else:
922+
server_settings_json_updates["PrestoHost"] = None
923+
server_settings_json_updates["PrestoPort"] = None
924+
915925
server_settings_json = read_and_update_settings_json(
916926
server_settings_json_path, server_settings_json_updates
917927
)

components/clp-package-utils/clp_package_utils/scripts/stop_clp.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,12 @@
3434
logger = logging.getLogger(__file__)
3535

3636

37-
def stop_running_container(container_name: str, already_exited_containers: List[str], force: bool):
37+
def stop_running_container(
38+
container_name: str, already_exited_containers: List[str], force: bool, timeout: int = 10
39+
):
3840
if is_container_running(container_name):
3941
logger.info(f"Stopping {container_name}...")
40-
cmd = ["docker", "stop", container_name]
42+
cmd = ["docker", "stop", "-t", str(timeout), container_name]
4143
subprocess.run(cmd, stdout=subprocess.DEVNULL, check=True)
4244

4345
logger.info(f"Removing {container_name}...")
@@ -148,9 +150,6 @@ def main(argv):
148150
if target in (ALL_TARGET_NAME, QUERY_WORKER_COMPONENT_NAME):
149151
container_name = f"clp-{QUERY_WORKER_COMPONENT_NAME}-{instance_id}"
150152
stop_running_container(container_name, already_exited_containers, force)
151-
if target in (ALL_TARGET_NAME, COMPRESSION_WORKER_COMPONENT_NAME):
152-
container_name = f"clp-{COMPRESSION_WORKER_COMPONENT_NAME}-{instance_id}"
153-
stop_running_container(container_name, already_exited_containers, force)
154153
if target in (ALL_TARGET_NAME, CONTROLLER_TARGET_NAME, QUERY_SCHEDULER_COMPONENT_NAME):
155154
container_name = f"clp-{QUERY_SCHEDULER_COMPONENT_NAME}-{instance_id}"
156155
stop_running_container(container_name, already_exited_containers, force)
@@ -164,11 +163,14 @@ def main(argv):
164163
COMPRESSION_SCHEDULER_COMPONENT_NAME,
165164
):
166165
container_name = f"clp-{COMPRESSION_SCHEDULER_COMPONENT_NAME}-{instance_id}"
167-
stop_running_container(container_name, already_exited_containers, force)
166+
stop_running_container(container_name, already_exited_containers, force, timeout=300)
168167

169168
container_config_file_path = logs_dir / f"{container_name}.yml"
170169
if container_config_file_path.exists():
171170
container_config_file_path.unlink()
171+
if target in (ALL_TARGET_NAME, COMPRESSION_WORKER_COMPONENT_NAME):
172+
container_name = f"clp-{COMPRESSION_WORKER_COMPONENT_NAME}-{instance_id}"
173+
stop_running_container(container_name, already_exited_containers, force, timeout=60)
172174
if target in (ALL_TARGET_NAME, CONTROLLER_TARGET_NAME, REDIS_COMPONENT_NAME):
173175
container_name = f"clp-{REDIS_COMPONENT_NAME}-{instance_id}"
174176
stop_running_container(container_name, already_exited_containers, force)

0 commit comments

Comments
 (0)