-
Notifications
You must be signed in to change notification settings - Fork 83
feat(clp-package): Replace package execution container with clp-package; Change default taskfile task to docker-images:package.
#1357
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
Changes from all commits
fdc113f
2959d60
a1c2cb1
99c919c
b3a6b3e
16741ed
1789641
68dbc59
27e133e
572de87
e6fddbc
b4a8976
f0767a2
9fb998e
876f925
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,14 +83,13 @@ | |
| COMPRESSION_JOBS_TABLE_NAME = "compression_jobs" | ||
| COMPRESSION_TASKS_TABLE_NAME = "compression_tasks" | ||
|
|
||
| OS_RELEASE_FILE_PATH = pathlib.Path("etc") / "os-release" | ||
|
|
||
| CLP_DEFAULT_CREDENTIALS_FILE_PATH = pathlib.Path("etc") / "credentials.yml" | ||
| CLP_DEFAULT_DATA_DIRECTORY_PATH = pathlib.Path("var") / "data" | ||
| CLP_DEFAULT_DATASET_NAME = "default" | ||
| CLP_METADATA_TABLE_PREFIX = "clp_" | ||
| CLP_PACKAGE_CONTAINER_IMAGE_ID_PATH = pathlib.Path("clp-package-image.id") | ||
| CLP_SHARED_CONFIG_FILENAME = ".clp-config.yml" | ||
|
|
||
| CLP_VERSION_FILE_PATH = pathlib.Path("VERSION") | ||
|
|
||
| # Environment variable names | ||
| CLP_DB_USER_ENV_VAR_NAME = "CLP_DB_USER" | ||
|
|
@@ -876,7 +875,7 @@ def _get_env_var(name: str) -> str: | |
|
|
||
|
|
||
| class CLPConfig(BaseModel): | ||
| execution_container: Optional[str] = None | ||
| container_image_ref: Optional[str] = None | ||
|
|
||
| logs_input: Union[FsIngestionConfig, S3IngestionConfig] = FsIngestionConfig() | ||
|
|
||
|
|
@@ -902,7 +901,10 @@ class CLPConfig(BaseModel): | |
| logs_directory: pathlib.Path = pathlib.Path("var") / "log" | ||
| aws_config_directory: Optional[pathlib.Path] = None | ||
|
|
||
| _os_release_file_path: pathlib.Path = PrivateAttr(default=OS_RELEASE_FILE_PATH) | ||
| _container_image_id_path: pathlib.Path = PrivateAttr( | ||
| default=CLP_PACKAGE_CONTAINER_IMAGE_ID_PATH | ||
| ) | ||
| _version_file_path: pathlib.Path = PrivateAttr(default=CLP_VERSION_FILE_PATH) | ||
|
|
||
| @field_validator("aws_config_directory") | ||
| @classmethod | ||
|
|
@@ -919,7 +921,10 @@ def make_config_paths_absolute(self, clp_home: pathlib.Path): | |
| self.stream_output.storage.make_config_paths_absolute(clp_home) | ||
| self.data_directory = make_config_path_absolute(clp_home, self.data_directory) | ||
| self.logs_directory = make_config_path_absolute(clp_home, self.logs_directory) | ||
| self._os_release_file_path = make_config_path_absolute(clp_home, self._os_release_file_path) | ||
| self._container_image_id_path = make_config_path_absolute( | ||
| clp_home, self._container_image_id_path | ||
| ) | ||
| self._version_file_path = make_config_path_absolute(clp_home, self._version_file_path) | ||
|
|
||
| def validate_logs_input_config(self): | ||
| logs_input_type = self.logs_input.type | ||
|
|
@@ -1007,22 +1012,18 @@ def validate_aws_config_dir(self): | |
| "aws_config_directory should not be set when profile authentication is not used" | ||
| ) | ||
|
|
||
| def load_execution_container_name(self): | ||
| if self.execution_container is not None: | ||
| def load_container_image_ref(self): | ||
| if self.container_image_ref is not None: | ||
| # Accept configured value for debug purposes | ||
| return | ||
|
|
||
| os_release = dotenv_values(self._os_release_file_path) | ||
|
Member
Author
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. we should have removed the
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. 🧩 Analysis chain🏁 Script executed: Length of output: 1741 🏁 Script executed: Length of output: 85 🏁 Script executed: Length of output: 42 @junhaoliao, I've filed issue #1443 to track the removal of the unused Summary:
The issue has been assigned to you with the tasks and context needed for the cleanup. 🧬 Code Graph Analysis Resultscomponents/clp-py-utils/clp_py_utils/clp_config.py [Snippet 1]
|
||
| if "ubuntu" == os_release["ID"]: | ||
| self.execution_container = ( | ||
| f"clp-execution-x86-{os_release['ID']}-{os_release['VERSION_CODENAME']}:main" | ||
| ) | ||
| if self._container_image_id_path.exists(): | ||
| with open(self._container_image_id_path) as image_id_file: | ||
| self.container_image_ref = image_id_file.read().strip() | ||
| else: | ||
| raise NotImplementedError( | ||
| f"Unsupported OS {os_release['ID']} in {OS_RELEASE_FILE_PATH}" | ||
| ) | ||
|
|
||
| self.execution_container = "ghcr.io/y-scope/clp/" + self.execution_container | ||
| with open(self._version_file_path) as version_file: | ||
| clp_package_version = version_file.read().strip() | ||
| self.container_image_ref = f"ghcr.io/y-scope/clp/clp-package:{clp_package_version}" | ||
|
|
||
| def get_shared_config_file_path(self) -> pathlib.Path: | ||
| return self.logs_directory / CLP_SHARED_CONFIG_FILENAME | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -52,7 +52,7 @@ vars: | |
|
|
||
| tasks: | ||
| default: | ||
| deps: ["package"] | ||
| deps: ["docker-images:package"] | ||
|
|
||
| clean: | ||
| cmds: | ||
|
|
@@ -113,7 +113,6 @@ tasks: | |
| - "{{.G_CORE_COMPONENT_BUILD_DIR}}/indexer" | ||
| - "{{.G_CORE_COMPONENT_BUILD_DIR}}/reducer-server" | ||
| - "{{.TASKFILE}}" | ||
| - "/etc/os-release" | ||
|
Member
Author
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. A different distro might cause the output of |
||
| - "components/clp-package-utils/dist/*.whl" | ||
| - "components/clp-py-utils/dist/*.whl" | ||
| - "components/job-orchestration/dist/*.whl" | ||
|
|
@@ -135,7 +134,6 @@ tasks: | |
| cmds: | ||
| - "rm -rf '{{.OUTPUT_DIR}}'" | ||
| - "rsync -a components/package-template/src/ '{{.OUTPUT_DIR}}'" | ||
| - "rsync --copy-links /etc/os-release '{{.OUTPUT_DIR}}/etc/os-release'" | ||
| - "mkdir -p '{{.OUTPUT_DIR}}/lib/python3/site-packages'" | ||
| - |- | ||
| . "{{.G_PACKAGE_VENV_DIR}}/bin/activate" | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
LGTM! Central configuration loading updated to new container image reference mechanism.
The change from
load_execution_container_name()toload_container_image_ref()centralizes the container image reference loading. Based on the related code snippet, this method reads from eitherclp-package-image.idor falls back to theVERSIONfile to construct the image reference.Verify that
load_container_image_ref()handles missing files appropriately:🏁 Script executed:
Length of output: 2391
Add error handling for missing VERSION file in
load_container_image_refThe method guards against a missing container-image ID file but unconditionally opens the version file, which will raise a
FileNotFoundErrorif theVERSIONfile is absent. Add an existence check or wrap the version-file open in exception handling to provide a clear error message or fallback.components/clp-py-utils/clp_py_utils/clp_config.py Lines 1019–1025
🤖 Prompt for AI Agents