-
Notifications
You must be signed in to change notification settings - Fork 80
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
update rename ~/.benchmark to ~/.osb and add symlink #721
base: main
Are you sure you want to change the base?
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
~/.osb
instead of~/.benchmark
. Also adds a symlink if the old path exists but the new one does not. 'benchmark' is an overloaded term, while using~/.osb
reduces 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.