Skip to content

Commit ba446cb

Browse files
authored
Merge pull request #21107 from mvdbeek/landing_request_api_tweaks
[25.1] Use workflow-style payload in data landing request
2 parents 88b12a4 + 5752c17 commit ba446cb

File tree

12 files changed

+665
-20
lines changed

12 files changed

+665
-20
lines changed

client-api/src/api-types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export type DatasetStorageDetails = components["schemas"]["DatasetStorageDetails
2626
export type DatasetCollectionAttributes = components["schemas"]["DatasetCollectionAttributesResult"];
2727
export type ConcreteObjectStoreModel = components["schemas"]["ConcreteObjectStoreModel"];
2828
export type MessageException = components["schemas"]["MessageExceptionModel"];
29-
export type DatasetHash = components["schemas"]["DatasetHash"];
29+
export type DatasetHash = components["schemas"]["DatasetHash-Output"];
3030
export type DatasetSource = components["schemas"]["DatasetSource"];
3131
export type DatasetTransform = components["schemas"]["DatasetSourceTransform"];
3232
export type StoreExportPayload = components["schemas"]["StoreExportPayload"];

client/src/api/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export function canMutateHistory(history: AnyHistory): boolean {
308308
return !history.purged && !history.archived;
309309
}
310310

311-
export type DatasetHash = components["schemas"]["DatasetHash"];
311+
export type DatasetHash = components["schemas"]["DatasetHash-Output"];
312312

313313
export type DatasetSource = components["schemas"]["DatasetSource"];
314314
export type DatasetTransform = components["schemas"]["DatasetSourceTransform"];

client/src/api/schema/schema.ts

Lines changed: 229 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1090,6 +1090,23 @@ export interface paths {
10901090
patch?: never;
10911091
trace?: never;
10921092
};
1093+
"/api/file_landings": {
1094+
parameters: {
1095+
query?: never;
1096+
header?: never;
1097+
path?: never;
1098+
cookie?: never;
1099+
};
1100+
get?: never;
1101+
put?: never;
1102+
/** Create File Landing */
1103+
post: operations["create_file_landing_api_file_landings_post"];
1104+
delete?: never;
1105+
options?: never;
1106+
head?: never;
1107+
patch?: never;
1108+
trace?: never;
1109+
};
10931110
"/api/file_source_instances": {
10941111
parameters: {
10951112
query?: never;
@@ -7400,6 +7417,75 @@ export interface components {
74007417
/** Item Ids */
74017418
item_ids: string[];
74027419
};
7420+
/** CollectionElementCollectionRequestUri */
7421+
CollectionElementCollectionRequestUri: {
7422+
/**
7423+
* Class
7424+
* @constant
7425+
*/
7426+
class: "Collection";
7427+
/** Collection Type */
7428+
collection_type: string;
7429+
/** Elements */
7430+
elements: (
7431+
| components["schemas"]["CollectionElementCollectionRequestUri"]
7432+
| components["schemas"]["CollectionElementDataRequestUri"]
7433+
)[];
7434+
/**
7435+
* Identifier
7436+
* @description A unique identifier for this element within the collection.
7437+
*/
7438+
identifier: string;
7439+
};
7440+
/** CollectionElementDataRequestUri */
7441+
CollectionElementDataRequestUri: {
7442+
/**
7443+
* Class
7444+
* @constant
7445+
*/
7446+
class: "File";
7447+
/** Created From Basename */
7448+
created_from_basename?: string | null;
7449+
/**
7450+
* Dbkey
7451+
* @default ?
7452+
*/
7453+
dbkey: string;
7454+
/**
7455+
* Deferred
7456+
* @default false
7457+
*/
7458+
deferred: boolean;
7459+
/** Ext */
7460+
ext: string;
7461+
/** Hashes */
7462+
hashes?: components["schemas"]["DatasetHash-Input"][] | null;
7463+
/**
7464+
* Identifier
7465+
* @description A unique identifier for this element within the collection.
7466+
*/
7467+
identifier: string;
7468+
/** Info */
7469+
info?: string | null;
7470+
/** Location */
7471+
location: string;
7472+
/** Name */
7473+
name?: string | null;
7474+
/**
7475+
* Space To Tab
7476+
* @default false
7477+
*/
7478+
space_to_tab: boolean;
7479+
/** Src */
7480+
src?: null;
7481+
/** Tags */
7482+
tags?: string[] | null;
7483+
/**
7484+
* To Posix Lines
7485+
* @default false
7486+
*/
7487+
to_posix_lines: boolean;
7488+
};
74037489
/** CollectionElementIdentifier */
74047490
CollectionElementIdentifier: {
74057491
/**
@@ -7991,6 +8077,23 @@ export interface components {
79918077
*/
79928078
target: string;
79938079
};
8080+
/** CreateFileLandingPayload */
8081+
CreateFileLandingPayload: {
8082+
/** Client Secret */
8083+
client_secret?: string | null;
8084+
/** Origin */
8085+
origin?: string | null;
8086+
/**
8087+
* Public
8088+
* @default false
8089+
*/
8090+
public: boolean;
8091+
/** Request State */
8092+
request_state: (
8093+
| components["schemas"]["FileRequestUri"]
8094+
| components["schemas"]["DataRequestCollectionUri"]
8095+
)[];
8096+
};
79948097
/** CreateHistoryContentFromStore */
79958098
CreateHistoryContentFromStore: {
79968099
model_store_format?: components["schemas"]["ModelStoreFormat"] | null;
@@ -9589,6 +9692,30 @@ export interface components {
95899692
*/
95909693
type: "data";
95919694
};
9695+
/** DataRequestCollectionUri */
9696+
DataRequestCollectionUri: {
9697+
/**
9698+
* @description discriminator enum property added by openapi-typescript
9699+
* @enum {string}
9700+
*/
9701+
class: "Collection";
9702+
/** Collection Type */
9703+
collection_type: string;
9704+
/**
9705+
* Deferred
9706+
* @default false
9707+
*/
9708+
deferred: boolean;
9709+
/** Elements */
9710+
elements: (
9711+
| components["schemas"]["CollectionElementCollectionRequestUri"]
9712+
| components["schemas"]["CollectionElementDataRequestUri"]
9713+
)[];
9714+
/** Name */
9715+
name?: string | null;
9716+
/** Src */
9717+
src?: null;
9718+
};
95929719
/** DatasetAssociationRoles */
95939720
DatasetAssociationRoles: {
95949721
/**
@@ -9666,7 +9793,17 @@ export interface components {
96669793
*/
96679794
DatasetExtraFiles: components["schemas"]["ExtraFileEntry"][];
96689795
/** DatasetHash */
9669-
DatasetHash: {
9796+
"DatasetHash-Input": {
9797+
/**
9798+
* Hash Function
9799+
* @enum {string}
9800+
*/
9801+
hash_function: "MD5" | "SHA-1" | "SHA-256" | "SHA-512";
9802+
/** Hash Value */
9803+
hash_value: string;
9804+
};
9805+
/** DatasetHash */
9806+
"DatasetHash-Output": {
96709807
/**
96719808
* Extra Files Path
96729809
* @description The path to the extra files used to generate the hash.
@@ -11378,6 +11515,50 @@ export interface components {
1137811515
/** visible */
1137911516
visible: boolean;
1138011517
};
11518+
/** FileRequestUri */
11519+
FileRequestUri: {
11520+
/**
11521+
* @description discriminator enum property added by openapi-typescript
11522+
* @enum {string}
11523+
*/
11524+
class: "File";
11525+
/** Created From Basename */
11526+
created_from_basename?: string | null;
11527+
/**
11528+
* Dbkey
11529+
* @default ?
11530+
*/
11531+
dbkey: string;
11532+
/**
11533+
* Deferred
11534+
* @default false
11535+
*/
11536+
deferred: boolean;
11537+
/** Ext */
11538+
ext: string;
11539+
/** Hashes */
11540+
hashes?: components["schemas"]["DatasetHash-Input"][] | null;
11541+
/** Info */
11542+
info?: string | null;
11543+
/** Location */
11544+
location: string;
11545+
/** Name */
11546+
name?: string | null;
11547+
/**
11548+
* Space To Tab
11549+
* @default false
11550+
*/
11551+
space_to_tab: boolean;
11552+
/** Src */
11553+
src?: null;
11554+
/** Tags */
11555+
tags?: string[] | null;
11556+
/**
11557+
* To Posix Lines
11558+
* @default false
11559+
*/
11560+
to_posix_lines: boolean;
11561+
};
1138111562
/** FileSourceTemplateSummaries */
1138211563
FileSourceTemplateSummaries: components["schemas"]["FileSourceTemplateSummary"][];
1138311564
/** FileSourceTemplateSummary */
@@ -12218,7 +12399,7 @@ export interface components {
1221812399
* Hashes
1221912400
* @description The list of hashes associated with this dataset.
1222012401
*/
12221-
hashes?: components["schemas"]["DatasetHash"][] | null;
12402+
hashes?: components["schemas"]["DatasetHash-Output"][] | null;
1222212403
/**
1222312404
* HDA or LDDA
1222412405
* @description Whether this dataset belongs to a history (HDA) or a library (LDDA).
@@ -12479,7 +12660,7 @@ export interface components {
1247912660
* Hashes
1248012661
* @description The list of hashes associated with this dataset.
1248112662
*/
12482-
hashes: components["schemas"]["DatasetHash"][];
12663+
hashes: components["schemas"]["DatasetHash-Output"][];
1248312664
/**
1248412665
* HDA or LDDA
1248512666
* @description Whether this dataset belongs to a history (HDA) or a library (LDDA).
@@ -26641,6 +26822,51 @@ export interface operations {
2664126822
};
2664226823
};
2664326824
};
26825+
create_file_landing_api_file_landings_post: {
26826+
parameters: {
26827+
query?: never;
26828+
header?: {
26829+
/** @description The user ID that will be used to effectively make this API call. Only admins and designated users can make API calls on behalf of other users. */
26830+
"run-as"?: string | null;
26831+
};
26832+
path?: never;
26833+
cookie?: never;
26834+
};
26835+
requestBody: {
26836+
content: {
26837+
"application/json": components["schemas"]["CreateFileLandingPayload"];
26838+
};
26839+
};
26840+
responses: {
26841+
/** @description Successful Response */
26842+
200: {
26843+
headers: {
26844+
[name: string]: unknown;
26845+
};
26846+
content: {
26847+
"application/json": components["schemas"]["ToolLandingRequest"];
26848+
};
26849+
};
26850+
/** @description Request Error */
26851+
"4XX": {
26852+
headers: {
26853+
[name: string]: unknown;
26854+
};
26855+
content: {
26856+
"application/json": components["schemas"]["MessageExceptionModel"];
26857+
};
26858+
};
26859+
/** @description Server Error */
26860+
"5XX": {
26861+
headers: {
26862+
[name: string]: unknown;
26863+
};
26864+
content: {
26865+
"application/json": components["schemas"]["MessageExceptionModel"];
26866+
};
26867+
};
26868+
};
26869+
};
2664426870
file_sources__instances_index: {
2664526871
parameters: {
2664626872
query?: never;

lib/galaxy/schema/fetch_data.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
)
2828
from galaxy.schema.terms import HelpTerms
2929
from galaxy.schema.types import CoercedStringType
30+
from galaxy.tool_util_models.parameters import FileOrCollectionRequest
3031
from galaxy.util.hash_util import HashFunctionNames
3132

3233
HELP_TERMS = HelpTerms()
@@ -307,6 +308,11 @@ class DataLandingRequestState(Model):
307308
targets: Targets
308309

309310

311+
FileOrCollectionRequests = list[FileOrCollectionRequest]
312+
313+
FileOrCollectionRequestsAdapter = TypeAdapter(FileOrCollectionRequests)
314+
315+
310316
# Vaguely matches the schema.schema.ToolLandingState but we don't allow data_fetch to be called directly
311317
# via the tool API so we have a more specific model here.
312318
class CreateDataLandingPayload(Model):
@@ -316,3 +322,12 @@ class CreateDataLandingPayload(Model):
316322
origin: Optional[HttpUrl] = None
317323

318324
model_config = ConfigDict(extra="forbid")
325+
326+
327+
class CreateFileLandingPayload(Model):
328+
request_state: FileOrCollectionRequests
329+
client_secret: Optional[str] = None
330+
public: bool = False
331+
origin: Optional[HttpUrl] = None
332+
333+
model_config = ConfigDict(extra="forbid")

lib/galaxy/tool_util/client/landing.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ def generate_claim_url(request: Request) -> Response:
6464
template_type = "tool"
6565
elif "workflow_id" in template:
6666
template_type = "workflow"
67+
elif isinstance(template["request_state"], list):
68+
template_type = "file"
6769
else:
6870
template_type = "data"
6971
if client_secret:
@@ -79,7 +81,7 @@ def generate_claim_url(request: Request) -> Response:
7981
try:
8082
raw_response.raise_for_status()
8183
except Exception:
82-
raise Exception("Request failed: %s", raw_response.text)
84+
raise Exception("Request failed: %s", raw_response.json())
8385
response = raw_response.json()
8486
response_type = "workflow" if template_type == "workflow" else "tool"
8587
url = f"{galaxy_url}/{response_type}_landings/{response['uuid']}"

0 commit comments

Comments
 (0)