Skip to content
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

Refactor local client fs operations to new interface #115

Closed
wants to merge 8 commits into from

Conversation

fryz
Copy link
Collaborator

@fryz fryz commented Apr 4, 2024

Before this MR

The local bench client interweaved the data loading operations with the client code which exposed the Bench data objects to the higher-level business logic.

After this MR

There is a new local filesystem (fs) client which abstracts the data loading operations from the business logic. This allows for us to swap in separate data loading client implementation (eg: an S3 client, maybe in the future a dynamo or some other nosql client).

@fryz
Copy link
Collaborator Author

fryz commented Apr 4, 2024

Note for reviewers:

  1. Start with the abc_fs_client - this is the interface for loading data (eg: from a file, but in the future from anywhere)
  2. The changes in (what is now called) local_client are mostly refactors to move the data loading operations to the local_fs_client. For the most part this should just be a copy/paste.

I'm not completely sure about the Configuration object I'm using to pass into the specific implementations of the fs clients. Open to suggestions here.

Comment on lines +226 to +228
# TODO(zfry): think about how to do this better
conf = LocalFSClientConfig(root_dir=args.directory)
client = LocalBenchClient(conf)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this (and the same thing im doing in the tests) are what I'm not sure about

open to ideas/suggestions

Comment on lines +158 to +162
def __init__(self, config, use_s3=False):
if not use_s3:
self.fs_client = LocalFSClient(config)
else:
raise NotImplementedError("S3 Client not implemented yet")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably should think about a better name here than use_s3 - the intention for now is to write an s3 fs client so we can store results in s3, but I think in the future we'll probably also want to add a client for a nosql db (eg: dynamo)

@@ -176,4 +176,4 @@ def user_login(

auth_token = login_cookies.get("Authorization")

return auth_token
return auth_token # type: ignore
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needed this to get mypy working - this wasn't related to my change at all.

@fryz fryz closed this May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant