Repository navigation
feat(clp-package)!: Refactor S3 log-ingestion configuration to use S3 URL as compression script argument (fixes #842). #852
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
Merged
Merged
Changes from 19 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
40edccb
Rework S3 logs_input config to move bucket details to compress script…
Eden-D-Zhang 0217d9d
Fix typo
Eden-D-Zhang 7bee632
Update components/clp-package-utils/clp_package_utils/scripts/compres…
Eden-D-Zhang 6efc499
Update components/clp-py-utils/clp_py_utils/s3_utils.py
Eden-D-Zhang d435bf0
Update components/clp-py-utils/clp_py_utils/s3_utils.py
Eden-D-Zhang 10761c4
Update components/clp-py-utils/clp_py_utils/s3_utils.py
Eden-D-Zhang 8c53605
Update docs/src/user-guide/guides-using-object-storage/clp-usage.md
Eden-D-Zhang 16d8fa7
Lint
Eden-D-Zhang 5b66f4c
Apply suggestions from code review
haiqi96 7c19855
Update docs/src/user-guide/guides-using-object-storage/clp-usage.md
haiqi96 d43c0de
Update docs/src/user-guide/guides-using-object-storage/clp-usage.md
haiqi96 80dc43a
Merge branch 'main' into s3-input-change
haiqi96 32116d8
Edit docs.
kirkrodrigues 9767601
Update components/clp-py-utils/clp_py_utils/s3_utils.py
haiqi96 97c5579
Remove obsolete links.
kirkrodrigues fbcf646
Apply suggestions from code review
haiqi96 f38a6cd
Fix missed change identified by the Rabbit.
kirkrodrigues 2e0e23d
Fixes
haiqi96 3eabef2
Apply suggestions from code review
haiqi96 73957fc
Apply suggestions from code review
haiqi96 e8a456b
Add missing validations
haiqi96 1bd7aa4
Merge branch 's3-input-change' of github.com:Eden-D-Zhang/clp into pr…
haiqi96 a4206e5
linter
haiqi96 e4f6b21
Merge branch 'main' into s3-input-change
haiqi96 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| import msgpack | ||
| from clp_py_utils.clp_config import CLPConfig, COMPRESSION_JOBS_TABLE_NAME | ||
| from clp_py_utils.pretty_size import pretty_size | ||
| from clp_py_utils.s3_utils import parse_s3_url | ||
| from clp_py_utils.sql_adapter import SQL_Adapter | ||
| from job_orchestration.scheduler.constants import ( | ||
| CompressionJobCompletionStatus, | ||
|
|
@@ -136,31 +137,34 @@ def _generate_clp_io_config( | |
| input_type = clp_config.logs_input.type | ||
|
|
||
| if InputType.FS == input_type: | ||
| if len(logs_to_compress) == 0: | ||
| raise ValueError(f"No input logs found.") | ||
| return FsInputConfig( | ||
| paths_to_compress=logs_to_compress, | ||
| timestamp_key=parsed_args.timestamp_key, | ||
| path_prefix_to_remove=str(CONTAINER_INPUT_LOGS_ROOT_DIR), | ||
| ) | ||
| elif InputType.S3 == input_type: | ||
| if len(logs_to_compress) != 1: | ||
| raise ValueError(f"Too many key prefixes: {len(logs_to_compress)} > 1") | ||
|
|
||
| s3_config = clp_config.logs_input.s3_config | ||
| if len(logs_to_compress) == 0: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is this case possible for InputType.FS as well?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. technically yes, added check for FS flow |
||
| raise ValueError(f"No URLs found.") | ||
|
haiqi96 marked this conversation as resolved.
Resolved
|
||
| elif len(logs_to_compress) != 1: | ||
| raise ValueError(f"Too many URLs: {len(logs_to_compress)} > 1") | ||
|
|
||
| s3_url = logs_to_compress[0] | ||
| region_code, bucket_name, key_prefix = parse_s3_url(s3_url) | ||
| aws_authentication = clp_config.logs_input.aws_authentication | ||
| return S3InputConfig( | ||
| region_code=s3_config.region_code, | ||
| bucket=s3_config.bucket, | ||
| key_prefix=s3_config.key_prefix + logs_to_compress[0], | ||
| aws_authentication=s3_config.aws_authentication, | ||
| region_code=region_code, | ||
| bucket=bucket_name, | ||
| key_prefix=key_prefix, | ||
| aws_authentication=aws_authentication, | ||
| timestamp_key=parsed_args.timestamp_key, | ||
| ) | ||
|
haiqi96 marked this conversation as resolved.
Resolved
|
||
| else: | ||
| raise ValueError(f"Unsupported input type: {input_type}") | ||
|
|
||
|
|
||
| def _get_logs_to_compress(logs_list_path: pathlib.Path) -> List[str]: | ||
| # Define the path processing function based on the input type | ||
| process_path_func: typing.Callable[[str], str] | ||
|
|
||
| # Read logs from the input file | ||
| logs_to_compress = [] | ||
| with open(logs_list_path, "r") as f: | ||
|
|
||
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
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
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.