Skip to content

Commit

Permalink
Rename querier to searcher to align with existing terminology
Browse files Browse the repository at this point in the history
  • Loading branch information
rdettai committed Sep 29, 2023
1 parent 4370904 commit 8c21e1f
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 24 deletions.
14 changes: 5 additions & 9 deletions distribution/lambda/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ init: check-env
build: ../../quickwit/target/lambda/indexer/hdfs-logs-multitenants-10000.json
cargo lambda build --manifest-path=../../quickwit/Cargo.toml -p quickwit-lambda --release
cp resources/indexer-config.yaml ../../quickwit/target/lambda/indexer/config.yaml
cp resources/querier-config.yaml ../../quickwit/target/lambda/querier/config.yaml
cp resources/searcher-config.yaml ../../quickwit/target/lambda/searcher/config.yaml

deploy: build
deploy: build check-env
cdk deploy

invoke-indexer: check-env
Expand All @@ -30,10 +30,10 @@ invoke-indexer: check-env
echo "indexer function name: $$function_name"
aws lambda invoke --function-name $$function_name --log-type Tail /dev/null | jq -r '.LogResult' | base64 -d

invoke-querier: check-env
invoke-searcher: check-env
export AWS_REGION=$$CDK_REGION
function_name=$$(aws cloudformation describe-stacks --stack-name LambdaStack --query "Stacks[0].Outputs[?ExportName=='querier-function-name'].OutputValue" --output text)
echo "querier function name: $$function_name"
function_name=$$(aws cloudformation describe-stacks --stack-name LambdaStack --query "Stacks[0].Outputs[?ExportName=='searcher-function-name'].OutputValue" --output text)
echo "searcher function name: $$function_name"
aws lambda invoke --function-name $$function_name --log-type Tail /dev/null | jq -r '.LogResult' | base64 -d


Expand All @@ -55,7 +55,3 @@ index-creation-instruction: deploy
echo "quickwit run &"
echo "\n=> once the server has started, create the index"
echo "quickwit index create --index-config hdfs_logs_index_config.yaml"

## If we wanted to create the index from the Lambda
# cp ../../config/tutorials/hdfs-logs/index-config.yaml \
# ../../quickwit/target/lambda/quickwit-lambda/hdfs-index-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: 0.6
node_id: lambda-querier
node_id: lambda-searcher
metastore_uri: s3://${METASTORE_BUCKET}
default_index_root_uri: s3://${INDEX_BUCKET}
data_dir: /tmp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from aws_cdk import aws_lambda, aws_s3, Duration, CfnOutput


class IndexingService(Construct):
class IndexerService(Construct):
def __init__(
self, scope: Construct, construct_id: str, store_bucket: aws_s3.Bucket, **kwargs
) -> None:
Expand Down
6 changes: 3 additions & 3 deletions distribution/lambda/stacks/lambda_stack.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
from aws_cdk import Stack, aws_s3, CfnOutput
from constructs import Construct

from . import indexing_service, query_service
from . import indexer_service, searcher_service


class LambdaStack(Stack):
def __init__(self, scope: Construct, construct_id: str, **kwargs) -> None:
super().__init__(scope, construct_id, **kwargs)

bucket = aws_s3.Bucket(self, "index-store")
indexing_service.IndexingService(self, "IndexingService", store_bucket=bucket)
query_service.QueryService(self, "QueryService", store_bucket=bucket)
indexer_service.IndexerService(self, "IndexerService", store_bucket=bucket)
searcher_service.SearcherService(self, "SearcherService", store_bucket=bucket)

CfnOutput(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
from aws_cdk import aws_lambda, aws_s3, Duration, CfnOutput


class QueryService(Construct):
class SearcherService(Construct):
def __init__(
self, scope: Construct, construct_id: str, store_bucket: aws_s3.Bucket, **kwargs
) -> None:
super().__init__(scope, construct_id, **kwargs)

handler = aws_lambda.Function(
self,
id="quickwit-querier",
code=aws_lambda.Code.from_asset("../../quickwit/target/lambda/querier"),
id="quickwit-searcher",
code=aws_lambda.Code.from_asset("../../quickwit/target/lambda/searcher"),
runtime=aws_lambda.Runtime.PROVIDED_AL2,
handler="N/A",
environment={
Expand All @@ -25,7 +25,7 @@ def __init__(

CfnOutput(
self,
"querier-function-name",
"searcher-function-name",
value=handler.function_name,
export_name="querier-function-name",
export_name="searcher-function-name",
)
4 changes: 2 additions & 2 deletions quickwit/quickwit-lambda/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ name = "indexer"
path = "src/indexer.rs"

[[bin]]
name = "querier"
path = "src/querier.rs"
name = "searcher"
path = "src/searcher.rs"

[dependencies]
anyhow = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion quickwit/quickwit-lambda/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ pub async fn index_handler(_event: LambdaEvent<Value>) -> Result<Value, Error> {
}))
}

pub async fn query_handler(_event: LambdaEvent<Value>) -> Result<Value, Error> {
pub async fn search_handler(_event: LambdaEvent<Value>) -> Result<Value, Error> {
let ingest_res = local_search_cli(LocalSearchArgs {
config_uri: Uri::from_well_formed("file:///var/task/config.yaml"),
index_id: String::from("hdfs-logs"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.

use lambda_runtime::service_fn;
use quickwit_lambda::query_handler;
use quickwit_lambda::search_handler;

#[tokio::main]
async fn main() -> anyhow::Result<()> {
let func = service_fn(query_handler);
let func = service_fn(search_handler);
lambda_runtime::run(func)
.await
.map_err(|e| anyhow::anyhow!(e))
Expand Down

0 comments on commit 8c21e1f

Please sign in to comment.