-
Notifications
You must be signed in to change notification settings - Fork 81
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
Change OSB Config directory from ~/.benchmark
to ~/.osb
#732
Changes from 5 commits
1453090
4d7b8d4
9113af3
19e4f6e
cb4198d
4d9e324
5ce1700
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,12 +22,39 @@ | |
# specific language governing permissions and limitations | ||
# under the License. | ||
import os | ||
|
||
import sys | ||
from osbenchmark.utils.io import ensure_dir, ensure_symlink | ||
|
||
def benchmark_confdir(): | ||
default_home = os.path.expanduser("~") | ||
return os.path.join(os.getenv("BENCHMARK_HOME", default_home), ".benchmark") | ||
old_path = os.path.join(default_home, ".benchmark") | ||
new_path = os.path.join(default_home, ".osb") | ||
|
||
try: | ||
# Ensure .benchmark directory exists | ||
ensure_dir(old_path) | ||
|
||
# Ensure symlink from .osb to .benchmark | ||
ensure_symlink(old_path, new_path) | ||
|
||
final_path = os.path.join(os.getenv("BENCHMARK_HOME", default_home), ".osb") | ||
|
||
return final_path | ||
|
||
except Exception as e: | ||
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. Do you recall what the exact exception was? Let's try to use that one instead of a general Exception. 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. It ended up being a 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. Even if the Also, it's best to not use the base |
||
error_message = ( | ||
f"Error in benchmark_confdir:\n" | ||
f"Error type: {type(e).__name__}\n" | ||
f"Error message: {str(e)}\n" | ||
f"Current user: {os.getlogin()}\n" | ||
f"Current working directory: {os.getcwd()}\n" | ||
f"Python version: {sys.version}\n" | ||
f"Operating system: {sys.platform}\n" | ||
f"Permissions of {old_path}: {oct(os.stat(old_path).st_mode) if os.path.exists(old_path) else 'N/A'}\n" | ||
f"Permissions of parent of {new_path}: {oct(os.stat(os.path.dirname(new_path)).st_mode)}" | ||
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. Since these were primarily used for debugging integ tests, we can remove them |
||
) | ||
print(error_message) | ||
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. Let's use console.print from utils? |
||
raise | ||
|
||
def benchmark_root(): | ||
return os.path.dirname(os.path.realpath(__file__)) | ||
|
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.
Nit: could be more descriptive with the variable name, would rename
final_path
tobenchmark_confdir_path
.