update rename ~/.benchmark to ~/.osb and add symlink#721
update rename ~/.benchmark to ~/.osb and add symlink#721OVI3D0 wants to merge 4 commits intoopensearch-project:mainfrom
Conversation
Signed-off-by: Michael Oviedo <mikeovi@amazon.com>
osbenchmark/paths.py
Outdated
| new_path = os.path.join(default_home, ".osb") | ||
| if os.path.exists(old_path) and not os.path.exists(new_path): | ||
| os.symlink(old_path, new_path) | ||
| return os.path.join(os.getenv("BENCHMARK_HOME", default_home), ".osb") |
There was a problem hiding this comment.
If the .benchmark directory does not exist, you will need to create it, so both are present in all cases.
Signed-off-by: Michael Oviedo <mikeovi@amazon.com>
|
@gkamat could there be a permissions issue when creating the symlink in the integ tests? |
|
We'll need to change the direction of this PR so that it merges into a separate branch as this is somewhat a breaking change (despite the symlink, documentation has not been updated)? |
osbenchmark/paths.py
Outdated
|
|
||
| # Create .benchmark directory if it doesn't exist | ||
| if not os.path.exists(old_path): | ||
| os.makedirs(old_path, exist_ok=True) |
There was a problem hiding this comment.
We can reuse the ensure_dir() from utils.
def ensure_dir(directory, mode=0o777):
"""
Ensure that the provided directory and all of its parent directories exist.
This function is safe to execute on existing directories (no op).
:param directory: The directory to create (if it does not exist).
:param mode: The permission flags to use (if it does not exist).
"""
if directory:
os.makedirs(directory, mode, exist_ok=True)
osbenchmark/paths.py
Outdated
| try: | ||
| os.symlink(old_path, new_path, target_is_directory=True) | ||
| except OSError: | ||
| print(f"Warning: Failed to create symlink from {new_path} to {old_path}") |
There was a problem hiding this comment.
Could we also output the exact error?
@OVI3D0 can we modify the exception clause to see what the exact error is from OSError? |
…r message Signed-off-by: Michael Oviedo <mikeovi@amazon.com>
|
@OVI3D0 FileExistsError is showing up when |
I added a function that should hopefully stop these errors, called ensure_symlink in the utils file |
be4ff74 to
44bf1d8
Compare
Signed-off-by: Michael Oviedo <mikeovi@amazon.com>
Description
Updates OSB's config directory to
~/.osbinstead of~/.benchmark. Also adds a symlink if the old path exists but the new one does not. 'benchmark' is an overloaded term, while using~/.osbreduces ambiguity and is more consistent with the project's name.Issues Resolved
[List any issues this PR will resolve]
Testing
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.