Skip to content

Commit

Permalink
Modernize the dataset storage API a bit.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Feb 7, 2024
1 parent c743c58 commit d1c57e3
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 12 deletions.
24 changes: 17 additions & 7 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2918,6 +2918,19 @@ export interface components {
private: boolean;
quota: components["schemas"]["QuotaModel"];
};
/** ConcreteObjectStoreQuotaSourceDetails */
ConcreteObjectStoreQuotaSourceDetails: {
/**
* Enabled
* @description Whether the object store tracks quota on the data (independent of Galaxy's configuration)
*/
enabled: boolean;
/**
* Source
* @description The quota source label corresponding to the object store the dataset is stored in (or would be stored in)
*/
source: string | null;
};
/** ContentsObject */
ContentsObject: {
/**
Expand Down Expand Up @@ -3768,9 +3781,9 @@ export interface components {
DatasetStorageDetails: {
/**
* Badges
* @description A mapping of object store labels to badges describing object store properties.
* @description A list of badges describing object store properties for concrete object store dataset is stored in.
*/
badges: Record<string, never>[];
badges: components["schemas"]["BadgeDict"][];
/**
* Dataset State
* @description The model state of the supplied dataset instance.
Expand Down Expand Up @@ -3801,11 +3814,8 @@ export interface components {
* @description The percentage indicating how full the store is.
*/
percent_used: number | null;
/**
* Quota
* @description Information about quota sources around dataset storage.
*/
quota: Record<string, never>;
/** @description Information about quota sources around dataset storage. */
quota: components["schemas"]["ConcreteObjectStoreQuotaSourceDetails"];
/**
* Shareable
* @description Is this dataset shareable.
Expand Down
12 changes: 7 additions & 5 deletions lib/galaxy/webapps/galaxy/services/datasets.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
)
from galaxy.managers.lddas import LDDAManager
from galaxy.model.base import transaction
from galaxy.objectstore.badges import BadgeDict
from galaxy.schema import (
FilterQueryParams,
SerializationParams,
Expand Down Expand Up @@ -142,9 +143,11 @@ class DatasetStorageDetails(Model):
shareable: bool = Field(
description="Is this dataset shareable.",
)
quota: dict = Field(description="Information about quota sources around dataset storage.")
badges: List[Dict[str, Any]] = Field(
description="A mapping of object store labels to badges describing object store properties."
quota: ConcreteObjectStoreQuotaSourceDetails = Field(
description="Information about quota sources around dataset storage."
)
badges: List[BadgeDict] = Field(
description="A list of badges describing object store properties for concrete object store dataset is stored in."
)


Expand Down Expand Up @@ -413,8 +416,7 @@ def show_storage(
quota = ConcreteObjectStoreQuotaSourceDetails(
source=quota_source.label,
enabled=quota_source.use,
).model_dump() # TODO: could we bypass the dump?

)
dataset_state = dataset.state
hashes = [h.to_dict() for h in dataset.hashes]
sources = [s.to_dict() for s in dataset.sources]
Expand Down

0 comments on commit d1c57e3

Please sign in to comment.