-
Notifications
You must be signed in to change notification settings - Fork 92
feat(clp-tdl-package): Implement the query::clp_s_search task.
#2512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
LinZhihao-723
wants to merge
39
commits into
y-scope:main
Choose a base branch
from
LinZhihao-723:tdl-task-impl
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
39 commits
Select commit
Hold shift + click to select a range
0b03851
Init
Bill-hbrhbr dbc1986
Change search to query; Add msgpack tests
Bill-hbrhbr d8f992e
Merge branch 'main' into query-coordinator-tdl
Bill-hbrhbr 0ba6fe5
docs(clp-tdl-package): Clarify package task scope
Bill-hbrhbr 1198719
Merge branch 'main' into query-coordinator-tdl
Bill-hbrhbr 6298f54
polish
Bill-hbrhbr ff5bc49
Update components/clp-rust-utils/src/task_io/query.rs
Bill-hbrhbr 37396cd
Update components/clp-rust-utils/src/task_io/query.rs
Bill-hbrhbr da02988
Change to milliseconds
Bill-hbrhbr bf2ebc0
Update components/clp-tdl-package/src/task/query/mod.rs
Bill-hbrhbr ba425f5
Merge branch 'main' into query-coordinator-tdl
Bill-hbrhbr 3cb68c5
feat(clp-tdl-package): Add the `clp-s` query task that writes archive…
LinZhihao-723 2ce8882
refactor(clp-tdl-package): Move `clp_binary_path` and `s3_credential_…
LinZhihao-723 344281d
Merge branch 'tdl-task-utils-mod' into tdl-task-impl
LinZhihao-723 0c9157c
refactor(clp-tdl-package): Polish the `clp-s` search task:
LinZhihao-723 df784e1
refactor(clp-tdl-package): Use singular "result cache" naming in the …
LinZhihao-723 1df4e42
Done with the search task implementation.
LinZhihao-723 0296f0c
Remove task redundant description
Bill-hbrhbr 2096e9b
Add query job ID type
Bill-hbrhbr cb87c6e
Make query task dataset optional
Bill-hbrhbr f8a68a6
Require non-empty query task strings
Bill-hbrhbr d5c0450
Use shared default for query result limit
Bill-hbrhbr ca2ebe2
Lint fix remove unused
Bill-hbrhbr 9429396
Remove unused query task output
Bill-hbrhbr 323acfc
Rename task
Bill-hbrhbr 8f509ef
Add query task output handle
Bill-hbrhbr b67cb70
Fix todo uppercase
Bill-hbrhbr 61fd27e
Merge branch 'main' into query-coordinator-tdl
Bill-hbrhbr 3bee52b
Document Python mirror for query result limit default
Bill-hbrhbr c39b086
Name query task output handle parameter after its type
Bill-hbrhbr 3cee914
Fix symbol ordering
Bill-hbrhbr 789f671
Use clp-s default query result limit
Bill-hbrhbr 184d940
Apply batched suggestions from code review
Bill-hbrhbr c479fad
Propagate rename
Bill-hbrhbr 3b6bc31
Merge PR #2503 into tdl-task-impl
LinZhihao-723 672af8b
Done.
LinZhihao-723 e40fcbb
Apply review comments.
LinZhihao-723 e724c84
Update components/clp-tdl-package/README.md
LinZhihao-723 6d1dfde
Merge branch 'main' into tdl-task-impl
LinZhihao-723 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,2 @@ | ||
| pub mod compression; | ||
| pub mod query; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,128 @@ | ||
| //! Protocol types exchanged with the Spider (Huntsman) tasks that run CLP query jobs. | ||
|
|
||
| use std::num::NonZeroU32; | ||
|
|
||
| use non_empty_string::NonEmptyString; | ||
| use serde::Deserialize; | ||
| use serde::Serialize; | ||
|
|
||
| /// `clp-s` options for a query job. | ||
| #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] | ||
| #[serde(deny_unknown_fields)] | ||
| pub struct ClpSQueryOption { | ||
| /// The query string passed positionally to `clp-s`. | ||
| pub query_string: NonEmptyString, | ||
|
|
||
| /// The per-archive result limit. When absent, the task omits `--max-num-results` and uses the | ||
| /// `clp-s` default. | ||
| pub max_num_results: Option<NonZeroU32>, | ||
|
|
||
| /// Inclusive `--tge` bound in Unix epoch milliseconds. | ||
| pub begin_timestamp_millisecs: Option<i64>, | ||
|
|
||
| /// Inclusive `--tle` bound in Unix epoch milliseconds. | ||
| pub end_timestamp_millisecs: Option<i64>, | ||
|
|
||
| /// Whether `clp-s` performs a case-insensitive search. | ||
| pub ignore_case: bool, | ||
| } | ||
|
|
||
| /// The output handler that `clp-s` writes a query task's results to. | ||
| #[derive(Clone, Debug, Deserialize, Eq, PartialEq, Serialize)] | ||
| #[serde(deny_unknown_fields, tag = "type")] | ||
| pub enum OutputHandle { | ||
| /// The results cache, addressed by a MongoDB URI whose path names the database. The collection | ||
| /// is the query job's ID. | ||
| #[serde(rename = "results_cache")] | ||
| ResultsCache { uri: NonEmptyString }, | ||
|
|
||
| /// A file per archive. Not yet supported by the Spider query flow. | ||
| #[serde(rename = "file")] | ||
| File, | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use std::num::NonZeroU32; | ||
|
|
||
| use non_empty_string::NonEmptyString; | ||
|
|
||
| use super::ClpSQueryOption; | ||
| use super::OutputHandle; | ||
| use crate::types::non_empty_string::ExpectedNonEmpty; | ||
|
|
||
| #[test] | ||
| fn clp_s_query_option_with_timestamp_bounds_round_trips_through_msgpack() { | ||
| let expected = ClpSQueryOption { | ||
| query_string: NonEmptyString::from_static_str("level:error"), | ||
| max_num_results: Some(NonZeroU32::new(1_000).expect("1,000 is nonzero")), | ||
| begin_timestamp_millisecs: Some(1_700_000_000_001), | ||
| end_timestamp_millisecs: Some(1_700_000_000_999), | ||
| ignore_case: true, | ||
| }; | ||
|
|
||
| let serialized = rmp_serde::to_vec(&expected).expect("query options should serialize"); | ||
| let actual: ClpSQueryOption = | ||
| rmp_serde::from_slice(&serialized).expect("query options should deserialize"); | ||
|
|
||
| assert_eq!(expected, actual); | ||
| } | ||
|
|
||
| #[test] | ||
| fn clp_s_query_option_without_timestamp_bounds_round_trips_through_msgpack() { | ||
| let expected = ClpSQueryOption { | ||
| query_string: NonEmptyString::from_static_str("*"), | ||
| max_num_results: Some(NonZeroU32::new(1).expect("1 is nonzero")), | ||
| begin_timestamp_millisecs: None, | ||
| end_timestamp_millisecs: None, | ||
| ignore_case: false, | ||
| }; | ||
|
|
||
| let serialized = rmp_serde::to_vec(&expected).expect("query options should serialize"); | ||
| let actual: ClpSQueryOption = | ||
| rmp_serde::from_slice(&serialized).expect("query options should deserialize"); | ||
|
|
||
| assert_eq!(expected, actual); | ||
| } | ||
|
|
||
| #[test] | ||
| fn clp_s_query_option_without_max_num_results_round_trips_through_msgpack() { | ||
| let expected = ClpSQueryOption { | ||
| query_string: NonEmptyString::from_static_str("*"), | ||
| max_num_results: None, | ||
| begin_timestamp_millisecs: None, | ||
| end_timestamp_millisecs: None, | ||
| ignore_case: false, | ||
| }; | ||
|
|
||
| let serialized = rmp_serde::to_vec(&expected).expect("query options should serialize"); | ||
| let actual: ClpSQueryOption = | ||
| rmp_serde::from_slice(&serialized).expect("query options should deserialize"); | ||
|
|
||
| assert_eq!(expected, actual); | ||
| } | ||
|
|
||
| #[test] | ||
| fn output_handle_results_cache_round_trips_through_msgpack() { | ||
| let expected = OutputHandle::ResultsCache { | ||
| uri: NonEmptyString::from_static_str("mongodb://results-cache:27017/clp-query-results"), | ||
| }; | ||
|
|
||
| let serialized = rmp_serde::to_vec(&expected).expect("output handle should serialize"); | ||
| let actual: OutputHandle = | ||
| rmp_serde::from_slice(&serialized).expect("output handle should deserialize"); | ||
|
|
||
| assert_eq!(expected, actual); | ||
| } | ||
|
|
||
| #[test] | ||
| fn output_handle_file_round_trips_through_msgpack() { | ||
| let expected = OutputHandle::File; | ||
|
|
||
| let serialized = rmp_serde::to_vec(&expected).expect("output handle should serialize"); | ||
| let actual: OutputHandle = | ||
| rmp_serde::from_slice(&serialized).expect("output handle should deserialize"); | ||
|
|
||
| assert_eq!(expected, actual); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.