Skip to content

Improve compliance of FastAPIJobFiles with the HTTP spec (files endpoint) #20351

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

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
274 changes: 274 additions & 0 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2997,6 +2997,44 @@ export interface paths {
patch?: never;
trace?: never;
};
"/api/jobs/{job_id}/files": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
/**
* Get a file required to staging a job.
* @description Get a file required to staging a job (proper datasets, extra inputs, task-split inputs, working directory
* files).
*
* This API method is intended only for consumption by job runners, not end users.
*/
get: operations["index_api_jobs__job_id__files_get"];
put?: never;
/**
* Populate an output file.
* @description Populate an output file (formal dataset, task split part, working directory file (such as those related to
* metadata). This should be a multipart POST with a 'file' parameter containing the contents of the actual file to
* create.
*
* This API method is intended only for consumption by job runners, not end users.
*/
post: operations["create_api_jobs__job_id__files_post"];
delete?: never;
options?: never;
/**
* Get a file required to staging a job.
* @description Get a file required to staging a job (proper datasets, extra inputs, task-split inputs, working directory
* files).
*
* This API method is intended only for consumption by job runners, not end users.
*/
head: operations["index_api_jobs__job_id__files_head"];
patch?: never;
trace?: never;
};
"/api/jobs/{job_id}/inputs": {
parameters: {
query?: never;
Expand Down Expand Up @@ -6628,6 +6666,34 @@ export interface components {
/** Name */
name?: unknown;
};
/** Body_create_api_jobs__job_id__files_post */
Body_create_api_jobs__job_id__files_post: {
/**
* File
* Format: binary
*/
__file?: string;
/** File Path */
__file_path?: string;
/**
* File
* Format: binary
* @description Contents of the file to create.
*/
file?: string;
/**
* Job Key
* @description A key used to authenticate this request as acting on behalf or a job runner for the specified job.
*/
job_key?: string | null;
/**
* Path
* @description Path to file to create.
*/
path?: string | null;
/** Session Id */
session_id?: string;
};
/** Body_create_form_api_libraries__library_id__contents_post */
Body_create_form_api_libraries__library_id__contents_post: {
/** Create Type */
Expand Down Expand Up @@ -31164,6 +31230,214 @@ export interface operations {
};
};
};
index_api_jobs__job_id__files_get: {
parameters: {
query: {
/** @description Path to file. */
path: string;
/** @description A key used to authenticate this request as acting on behalf or a job runner for the specified job. */
job_key: string;
};
header?: {
/** @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. */
"run-as"?: string | null;
};
path: {
/** @description Encoded id string of the job. */
job_id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Contents of file. */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/octet-stream": unknown;
};
};
/** @description Path does not refer to a file, or input dataset(s) for job have been purged. */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": unknown;
};
};
/** @description File not found. */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": unknown;
};
};
/** @description Input dataset(s) for job have been purged. */
500: {
headers: {
[name: string]: unknown;
};
content?: never;
};
/** @description Request Error */
"4XX": {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["MessageExceptionModel"];
};
};
/** @description Server Error */
"5XX": {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["MessageExceptionModel"];
};
};
};
};
create_api_jobs__job_id__files_post: {
parameters: {
query?: {
/** @description Path to file to create. */
path?: string | null;
/** @description A key used to authenticate this request as acting on behalf or a job runner for the specified job. */
job_key?: string | null;
};
header?: {
/** @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. */
"run-as"?: string | null;
};
path: {
/** @description Encoded id string of the job. */
job_id: string;
};
cookie?: never;
};
requestBody?: {
content: {
"multipart/form-data": components["schemas"]["Body_create_api_jobs__job_id__files_post"];
};
};
responses: {
/** @description An okay message. */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": unknown;
};
};
/** @description Bad request (including no file provided). */
400: {
headers: {
[name: string]: unknown;
};
content?: never;
};
/** @description Request Error */
"4XX": {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["MessageExceptionModel"];
};
};
/** @description Server Error */
"5XX": {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["MessageExceptionModel"];
};
};
};
};
index_api_jobs__job_id__files_head: {
parameters: {
query: {
/** @description Path to file. */
path: string;
/** @description A key used to authenticate this request as acting on behalf or a job runner for the specified job. */
job_key: string;
};
header?: {
/** @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. */
"run-as"?: string | null;
};
path: {
/** @description Encoded id string of the job. */
job_id: string;
};
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Contents of file. */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/octet-stream": unknown;
};
};
/** @description Path does not refer to a file, or input dataset(s) for job have been purged. */
400: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": unknown;
};
};
/** @description File not found. */
404: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": unknown;
};
};
/** @description Input dataset(s) for job have been purged. */
500: {
headers: {
[name: string]: unknown;
};
content?: never;
};
/** @description Request Error */
"4XX": {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["MessageExceptionModel"];
};
};
/** @description Server Error */
"5XX": {
headers: {
[name: string]: unknown;
};
content: {
"application/json": components["schemas"]["MessageExceptionModel"];
};
};
};
};
get_inputs_api_jobs__job_id__inputs_get: {
parameters: {
query?: never;
Expand Down
4 changes: 4 additions & 0 deletions lib/galaxy/webapps/galaxy/api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,10 @@ def environ(self) -> Environ:
self.__environ = build_environ(self.__request.scope, None) # type: ignore[arg-type]
return self.__environ

@property
def method(self):
return self.__request.method

@property
def headers(self):
return self.__request.headers
Expand Down
Loading
Loading