-
Notifications
You must be signed in to change notification settings - Fork 24
Refactor find cached script logic in script automation #750
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
base: dev
Are you sure you want to change the base?
Conversation
|
MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅ |
automation/script/module.py
Outdated
| if cache: | ||
| # TBD - need to reuse and prune cache_list instead of a new CM | ||
| # search inside find_cached_script | ||
| ctx = SimpleNamespace( |
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.
Why we use a namespace here?
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.
As we need to pass on multiple parameters to find_cached_script function and its sub function call, thatswhy used namespace to obtain a lightweight temporary structure to bundle these arguments into a single ctx object, so that it can be passed on to each sub function calls easily and to avoid using a long dictionary or creating a separate new class just for this purpose.
automation/script/script_utils.py
Outdated
| c for c in cache_list | ||
| if c.meta.get("associated_script_item_uid") == selected_uid | ||
| ] | ||
|
|
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.
should we put these functions under a new file cache_utils.py?
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.
I think we can, and we can move _fix_cache_paths there as well
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.
yes, I think everything related to cache can be moved to make the code base better.
🧾 PR Checklist
dev📌 Note: PRs must be raised against
dev. Do not commit directly tomain.📁 File Hygiene & Output Handling
📝 Comments & Communication
Fixes #,Related to #, etc.)🛡️ Safety & Security
Modularized
find_cached_scriptfunction and have moved few additional helper functions toscript_utils.pyLogs: