Skip to content

Commit a6d1f15

Browse files
committed
Fix actor shutdown to await merges
1 parent 9383993 commit a6d1f15

File tree

21 files changed

+371
-152
lines changed

21 files changed

+371
-152
lines changed

distribution/lambda/Makefile

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ indexer-package-path:
5656
searcher-package-path:
5757
echo -n $(SEARCHER_PACKAGE_PATH)
5858

59-
bootstrap: package check-env
59+
bootstrap:
6060
cdk bootstrap aws://$$CDK_ACCOUNT/$$CDK_REGION
6161

6262
deploy-hdfs: package check-env
@@ -65,17 +65,20 @@ deploy-hdfs: package check-env
6565
deploy-mock-data: package check-env
6666
cdk deploy -a cdk/app.py MockDataStack
6767

68+
print-mock-data-metastore: check-env
69+
python -c 'from cdk import cli; cli.print_mock_data_metastore()'
70+
6871
# address https://github.com/aws/aws-cdk/issues/20060
6972
before-destroy:
7073
mkdir -p cdk.out
7174
touch $(INDEXER_PACKAGE_PATH)
7275
touch $(SEARCHER_PACKAGE_PATH)
7376

74-
destroy-hdfs: before-destroy
77+
destroy-hdfs: before-destroy check-env
7578
python -c 'from cdk import cli; cli.empty_hdfs_bucket()'
7679
cdk destroy --force -a cdk/app.py HdfsStack
7780

78-
destroy-mock-data: before-destroy
81+
destroy-mock-data: before-destroy check-env
7982
python -c 'from cdk import cli; cli.empty_mock_data_buckets()'
8083
cdk destroy --force -a cdk/app.py MockDataStack
8184

@@ -108,6 +111,7 @@ bench-index:
108111
done
109112

110113
bench-search-term:
114+
export QW_LAMBDA_LOG_SPAN_BOUNDARIES=true
111115
mem_sizes=( 1024 2048 4096 8192 )
112116
for mem_size in "$${mem_sizes[@]}"
113117
do
@@ -117,6 +121,7 @@ bench-search-term:
117121
done
118122

119123
bench-search-histogram:
124+
export QW_LAMBDA_LOG_SPAN_BOUNDARIES=true
120125
mem_sizes=( 1024 2048 4096 8192 )
121126
for mem_size in "$${mem_sizes[@]}"
122127
do

distribution/lambda/cdk/cli.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,15 @@ def empty_mock_data_buckets():
316316
_clean_s3_bucket(bucket_name)
317317

318318

319+
def print_mock_data_metastore():
320+
bucket_name = _get_cloudformation_output_value(
321+
app.MOCK_DATA_STACK_NAME, mock_data_stack.INDEX_STORE_BUCKET_NAME_EXPORT_NAME
322+
)
323+
s3 = session.client("s3")
324+
response = s3.get_object(Bucket=bucket_name, Key="index/mock-sales/metastore.json")
325+
print(response["Body"].read().decode())
326+
327+
319328
@cache
320329
def _git_commit():
321330
return subprocess.run(

distribution/lambda/cdk/stacks/examples/mock_data_stack.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from constructs import Construct
1313
import yaml
1414

15-
from ..services.quickwit_service import QuickwitService
15+
from ..services import quickwit_service
1616

1717
SEARCHER_FUNCTION_NAME_EXPORT_NAME = "mock-data-searcher-function-name"
1818
INDEX_STORE_BUCKET_NAME_EXPORT_NAME = "mock-data-index-store-bucket-name"
@@ -28,7 +28,7 @@ def __init__(
2828
scope: Construct,
2929
construct_id: str,
3030
index_id: str,
31-
qw_svc: QuickwitService,
31+
qw_svc: quickwit_service.QuickwitService,
3232
**kwargs,
3333
):
3434
super().__init__(scope, construct_id, **kwargs)
@@ -83,7 +83,7 @@ def __init__(
8383
scope: Construct,
8484
construct_id: str,
8585
index_id: str,
86-
qw_svc: QuickwitService,
86+
qw_svc: quickwit_service.QuickwitService,
8787
api_key: str,
8888
**kwargs,
8989
) -> None:
@@ -149,12 +149,15 @@ def __init__(
149149
"mock-data-index-config",
150150
path=index_config_local_path,
151151
)
152-
qw_svc = QuickwitService(
152+
lambda_env = quickwit_service.extract_local_env()
153+
qw_svc = quickwit_service.QuickwitService(
153154
self,
154155
"Quickwit",
155156
index_id=index_id,
156157
index_config_bucket=index_config.s3_bucket_name,
157158
index_config_key=index_config.s3_object_key,
159+
indexer_environment=lambda_env,
160+
searcher_environment=lambda_env,
158161
indexer_package_location=indexer_package_location,
159162
searcher_package_location=searcher_package_location,
160163
)

distribution/lambda/cdk/stacks/services/indexer_service.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def __init__(
3232
"QW_LAMBDA_INDEX_CONFIG_URI": f"s3://{index_config_bucket}/{index_config_key}",
3333
**environment,
3434
},
35-
timeout=aws_cdk.Duration.minutes(15),
35+
# use a strict timeout and retry policy to avoid unexpected costs
36+
timeout=aws_cdk.Duration.minutes(1),
37+
retry_attempts=0,
3638
reserved_concurrent_executions=1,
3739
memory_size=memory_size,
3840
ephemeral_storage_size=aws_cdk.Size.gibibytes(10),

distribution/lambda/cdk/stacks/services/quickwit_service.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,12 @@
1212

1313

1414
def extract_local_env() -> dict[str, str]:
15-
"""Extracts local environment variables that start with QW_LAMBDA_"""
16-
return {k: os.environ[k] for k in os.environ.keys() if k.startswith("QW_LAMBDA_")}
15+
"""Extracts local environment variables QW_LAMBDA_* and QW_DISABLE_TELEMETRY"""
16+
return {
17+
k: os.environ[k]
18+
for k in os.environ.keys()
19+
if (k.startswith("QW_LAMBDA_") or k == "QW_DISABLE_TELEMETRY")
20+
}
1721

1822

1923
class QuickwitService(Construct):

quickwit/Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quickwit/quickwit-codegen/example/src/codegen/hello.rs

Lines changed: 8 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quickwit/quickwit-ingest/src/codegen/ingest_service.rs

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

quickwit/quickwit-lambda/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ quickwit-doc-mapper = { workspace = true }
5151
quickwit-index-management = { workspace = true }
5252
quickwit-indexing = { workspace = true }
5353
quickwit-ingest = { workspace = true }
54+
quickwit-janitor = { workspace = true }
5455
quickwit-metastore = { workspace = true }
5556
quickwit-proto = { workspace = true }
5657
quickwit-rest-client = { workspace = true }

quickwit/quickwit-lambda/src/bin/indexer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use quickwit_lambda::logger;
2323

2424
#[tokio::main]
2525
async fn main() -> anyhow::Result<()> {
26-
logger::setup_lambda_tracer()?;
26+
logger::setup_lambda_tracer(tracing::Level::INFO)?;
2727
let func = service_fn(handler);
2828
lambda_runtime::run(func)
2929
.await

0 commit comments

Comments
 (0)