You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore(sbti): optimize calculation skipping redundant system calls
Introduction
This PR introduces an optimization to the tool's file-handling logic. Specifically, it modifies the behavior around the output.write() call and the request to the dashboard to prevent unnecessary file writes. This change also avoids requesting the server if the file is already on the disk.
This change checks if the required file is already present locally. If so, it skips the write operation, speeding up the overall calculation. (avoiding the hops)
Additionally, this modification makes the tool compatible with environments that usually have an NFTS/FAT file storage as read-only.
This change also makes integrating the library into a serverless AWS Lambda Container possible.
to avoid the creation or request of files while we have it on disk
Compatibility
It won't change the previous behavior of the library, and if those configurations are not set, it works just as before
Integration
I'm integrating these modifications into a container using the modified library, and it works so far, bringing down responses from 4 seconds to ~1.5 for a remote serverless call.
Trade-off
Must take into account the user's ability to always download the file and keep track of updates if there are any.
Warkanlock
changed the title
chore(sbti): optimize calculation skipping redundant system calls
optimize calculation skipping redundant system calls
Nov 22, 2023
Thank you for this PR. I think it looks good. There is one thing that maybe we should consider and which relates to your Trade-off above. Perhaps the code should check if the CTA file is more than one week old, and if it is, the user should be warned and allowed to manually or automatically fetch a new CTA file. The SBTi currently updates the CTA file on a weekly basis. (Maybe in the future we will see a JSON api instead of the excel-based solution).
Thank you for this PR. I think it looks good. There is one thing that maybe we should consider and which relates to your Trade-off above. Perhaps the code should check if the CTA file is more than one week old, and if it is, the user should be warned and allowed to manually or automatically fetch a new CTA file. The SBTi currently updates the CTA file on a weekly basis. (Maybe in the future we will see a JSON api instead of the excel-based solution).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
chore(sbti): optimize calculation skipping redundant system calls
Introduction
This PR introduces an optimization to the tool's file-handling logic. Specifically, it modifies the behavior around the
output.write()call and the request to the dashboard to prevent unnecessary file writes. This change also avoids requesting the server if the file is already on the disk.Changes
Introduces two new variables inside
config.pyAlso individually, we can use
to avoid the creation or request of files while we have it on disk
Compatibility
It won't change the previous behavior of the library, and if those configurations are not set, it works just as before
Integration
I'm integrating these modifications into a container using the modified library, and it works so far, bringing down responses from 4 seconds to ~1.5 for a remote serverless call.
Trade-off
Must take into account the user's ability to always download the file and keep track of updates if there are any.