-
Notifications
You must be signed in to change notification settings - Fork 206
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
refact: make collections in apiserver models lazy #343
Conversation
return SessionCollection.instance( | ||
make_sync=self._instance_is_sync, | ||
client=self.client, | ||
deployment_id=self.id, | ||
items=items, | ||
items={}, |
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.
Does a SessionCollection (or other collections) even need an items
kwarg/attribute on the instance now?
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.
Correct, collections don't need it anymore (unless we want to introduce some sort of caching but at this stage I'd rather not)
id=session_def.session_id, | ||
) | ||
for session_def in r.json() | ||
} | ||
return SessionCollection.instance( |
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.
This makes sense to me
Conceptually, this is returning a client, and from there, you interact with it
Adjust
client.apiserver.deployments
andclient.apiserver.sessions
so that they don't actually load the items in a collection, deferring that tolist
. This waysessions
anddeployments
can be regular properties, accessible withoutawait
.This was originally implemented for the
core
client, this PR makes it consistent with the rest of the models.Part of #337