Add CatalogItem.provider_data + reserved GCP A4
#184
Merged
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.
Add a catalog item field for holding arbitrary
provider-specific data. As an example, use this
field for reserved GCP A4 instances.
Below is a comparison of different field types
that could be used for this field in both gpuhunt
and dstack. This commit suggests using typed
dicts.
JSON string (parsing into a Pydantic model on the provider/backend side)
Cons:
writing - unnecessary serialization and
deserialization when updating an attribute of an
already serialized object.
data).
dict/TypedDictCons:
occur at attribute access time rather than at
model loading time.
Pydantic models with a
typediscriminatorCons:
compatibility, as the models are passed from
gpuhunt to dstack server, from server to client,
and from client to server, all with validation.
backend-specific field and in other fields of
the offer or catalog (e.g.,
InstanceOffer.backendandInstanceOffer.backend_data.type).discriminator values, which in the future will
hinder the transition to a more modular
architecture with backend plugins.
discriminator value (a new backend) is
introduced.
Pydantic models + custom deserialization logic
(e.g., custom
InstanceOfferdeserializer thatdetermines the
InstanceOffer.backend_datamodelbased on InstanceOffer.backend)
Cons:
compatibility as the models are passed from
gpuhunt to dstack server, from server to client,
and from client to server, all with validation.
all model that hold the backend-specific field -
at least in RawCatalogItem and
InstanceOffer.