Skip to content
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

clp-package: Deduplicate and clean up code in CLI job-launcher scripts. #473

Merged
merged 14 commits into from
Jul 6, 2024

Conversation

haiqi96
Copy link
Contributor

@haiqi96 haiqi96 commented Jul 5, 2024

Description

This PR factors out the common code used in job submission scripts in clp_package_utils. It also move some query job related functions into a separate util file to prepare an upcoming change that supports ir extraction job in the decompression script.

Validation performed

Launched the package, verified that compression, decompression and search still work from command line

@haiqi96 haiqi96 marked this pull request as ready for review July 5, 2024 17:51
Copy link
Member

@kirkrodrigues kirkrodrigues left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this refactoring. Added some suggestions.

@@ -241,6 +257,43 @@ def generate_container_config(clp_config: CLPConfig, clp_home: pathlib.Path):
return container_clp_config, docker_mounts


def dump_container_config(
clp_config: CLPConfig, container_clp_config: CLPConfig, container_name: str
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we swap container_clp_config and clp_config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

technically, we don't need the clp_config. the only thing needed by this function is clp_config.logs_directory which can be an argument called host_log_directory.
I didn't write in this way because then clp_config.logs_directory need to be duplicated in all callers.
me know what you think

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since clp_config.logs_directory and container_clp_config.logs_directory are linked, I figure it's safer to pass in container_clp_config and clp_config to lessen the risk that the caller passes in two random paths.

components/clp-package-utils/clp_package_utils/general.py Outdated Show resolved Hide resolved
@@ -249,9 +322,29 @@ def validate_config_key_existence(config, key):
return value


def validate_and_load_config_file(
def validate_and_load_config_for_job_submission_script(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can't think of a good name for this method. I don't want to call it validate_and_load_config because the usage of this method is only limited to the caller script under package_utils/scripts. I also feel it's ok to revert this change.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe it's better to revert cause I'm also noticing that the different instances of this code validate different directories.

@haiqi96 haiqi96 requested a review from kirkrodrigues July 5, 2024 21:56
Copy link
Member

@kirkrodrigues kirkrodrigues left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the PR title, how about:

clp-package: Deduplicate and clean up code in CLI job-launcher scripts.

@haiqi96 haiqi96 changed the title clp-package: Refactor job launcher scripts in clp_package_utils clp-package: Deduplicate and clean up code in CLI job-launcher scripts. Jul 6, 2024
@haiqi96 haiqi96 merged commit 986a957 into y-scope:main Jul 6, 2024
4 checks passed
jackluo923 pushed a commit to jackluo923/clp that referenced this pull request Dec 4, 2024
@haiqi96 haiqi96 deleted the script_refactor branch December 6, 2024 20:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants