Skip to content

Commit

Permalink
Merge pull request galaxyproject#16645 from martenson/remove-bco
Browse files Browse the repository at this point in the history
remove deprecated bco export endpoint
  • Loading branch information
davelopez authored Apr 23, 2024
2 parents edc2302 + bf14bcd commit d02ac22
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 257 deletions.
140 changes: 0 additions & 140 deletions client/src/api/schema/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -956,52 +956,6 @@ export interface paths {
/** Cancel the specified workflow invocation. */
delete: operations["cancel_invocation_api_invocations__invocation_id__delete"];
};
"/api/invocations/{invocation_id}/biocompute": {
/**
* Return a BioCompute Object for the workflow invocation.
* @deprecated
* @description The BioCompute Object endpoints are in beta - important details such
* as how inputs and outputs are represented, how the workflow is encoded,
* and how author and version information is encoded, and how URLs are
* generated will very likely change in important ways over time.
*
* **Deprecation Notice**: please use the asynchronous short_term_storage export system instead.
*
* 1. call POST `api/invocations/{id}/prepare_store_download` with payload:
* ```
* {
* model_store_format: bco.json
* }
* ```
* 2. Get `storageRequestId` from response and poll GET `api/short_term_storage/${storageRequestId}/ready` until `SUCCESS`
*
* 3. Get the resulting file with `api/short_term_storage/${storageRequestId}`
*/
get: operations["export_invocation_bco_api_invocations__invocation_id__biocompute_get"];
};
"/api/invocations/{invocation_id}/biocompute/download": {
/**
* Return a BioCompute Object for the workflow invocation as a file for download.
* @deprecated
* @description The BioCompute Object endpoints are in beta - important details such
* as how inputs and outputs are represented, how the workflow is encoded,
* and how author and version information is encoded, and how URLs are
* generated will very likely change in important ways over time.
*
* **Deprecation Notice**: please use the asynchronous short_term_storage export system instead.
*
* 1. call POST `api/invocations/{id}/prepare_store_download` with payload:
* ```
* {
* model_store_format: bco.json
* }
* ```
* 2. Get `storageRequestId` from response and poll GET `api/short_term_storage/${storageRequestId}/ready` until `SUCCESS`
*
* 3. Get the resulting file with `api/short_term_storage/${storageRequestId}`
*/
get: operations["download_invocation_bco_api_invocations__invocation_id__biocompute_download_get"];
};
"/api/invocations/{invocation_id}/jobs_summary": {
/**
* Get job state summary info aggregated across all current jobs of the workflow invocation.
Expand Down Expand Up @@ -18784,100 +18738,6 @@ export interface operations {
};
};
};
export_invocation_bco_api_invocations__invocation_id__biocompute_get: {
/**
* Return a BioCompute Object for the workflow invocation.
* @deprecated
* @description The BioCompute Object endpoints are in beta - important details such
* as how inputs and outputs are represented, how the workflow is encoded,
* and how author and version information is encoded, and how URLs are
* generated will very likely change in important ways over time.
*
* **Deprecation Notice**: please use the asynchronous short_term_storage export system instead.
*
* 1. call POST `api/invocations/{id}/prepare_store_download` with payload:
* ```
* {
* model_store_format: bco.json
* }
* ```
* 2. Get `storageRequestId` from response and poll GET `api/short_term_storage/${storageRequestId}/ready` until `SUCCESS`
*
* 3. Get the resulting file with `api/short_term_storage/${storageRequestId}`
*/
parameters: {
query?: {
merge_history_metadata?: boolean | null;
};
/** @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. */
header?: {
"run-as"?: string | null;
};
/** @description The encoded database identifier of the Invocation. */
path: {
invocation_id: string;
};
};
responses: {
/** @description Successful Response */
200: {
content: {
"application/json": Record<string, never>;
};
};
/** @description Validation Error */
422: {
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
download_invocation_bco_api_invocations__invocation_id__biocompute_download_get: {
/**
* Return a BioCompute Object for the workflow invocation as a file for download.
* @deprecated
* @description The BioCompute Object endpoints are in beta - important details such
* as how inputs and outputs are represented, how the workflow is encoded,
* and how author and version information is encoded, and how URLs are
* generated will very likely change in important ways over time.
*
* **Deprecation Notice**: please use the asynchronous short_term_storage export system instead.
*
* 1. call POST `api/invocations/{id}/prepare_store_download` with payload:
* ```
* {
* model_store_format: bco.json
* }
* ```
* 2. Get `storageRequestId` from response and poll GET `api/short_term_storage/${storageRequestId}/ready` until `SUCCESS`
*
* 3. Get the resulting file with `api/short_term_storage/${storageRequestId}`
*/
parameters: {
query?: {
merge_history_metadata?: boolean | null;
};
/** @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. */
header?: {
"run-as"?: string | null;
};
/** @description The encoded database identifier of the Invocation. */
path: {
invocation_id: string;
};
};
responses: {
/** @description Successful Response */
200: never;
/** @description Validation Error */
422: {
content: {
"application/json": components["schemas"]["HTTPValidationError"];
};
};
};
};
invocation_jobs_summary_api_invocations__invocation_id__jobs_summary_get: {
/**
* Get job state summary info aggregated across all current jobs of the workflow invocation.
Expand Down
87 changes: 0 additions & 87 deletions lib/galaxy/webapps/galaxy/api/workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
)
from galaxy.model.base import transaction
from galaxy.model.item_attrs import UsesAnnotations
from galaxy.model.store import BcoExportOptions
from galaxy.schema.fields import DecodedDatabaseIdField
from galaxy.schema.invocation import (
CreateInvocationFromStore,
Expand Down Expand Up @@ -88,7 +87,6 @@
from galaxy.tools.parameters import populate_state
from galaxy.tools.parameters.workflow_utils import workflow_building_modes
from galaxy.util.sanitize_html import sanitize_html
from galaxy.version import VERSION
from galaxy.web import (
expose_api,
expose_api_raw_anonymous_and_sessionless,
Expand Down Expand Up @@ -1712,88 +1710,3 @@ def workflow_invocation_jobs_summary(
) -> InvocationJobsResponse:
"""An alias for `GET /api/invocations/{invocation_id}/jobs_summary`. `workflow_id` is ignored."""
return self.invocation_jobs_summary(trans=trans, invocation_id=invocation_id)

# TODO: remove this endpoint after 23.1 release
@router.get(
"/api/invocations/{invocation_id}/biocompute",
summary="Return a BioCompute Object for the workflow invocation.",
deprecated=True,
)
def export_invocation_bco(
self,
invocation_id: InvocationIDPathParam,
trans: ProvidesUserContext = DependsOnTrans,
merge_history_metadata: Optional[bool] = Query(default=False),
):
"""
The BioCompute Object endpoints are in beta - important details such
as how inputs and outputs are represented, how the workflow is encoded,
and how author and version information is encoded, and how URLs are
generated will very likely change in important ways over time.
**Deprecation Notice**: please use the asynchronous short_term_storage export system instead.
1. call POST `api/invocations/{id}/prepare_store_download` with payload:
```
{
model_store_format: bco.json
}
```
2. Get `storageRequestId` from response and poll GET `api/short_term_storage/${storageRequestId}/ready` until `SUCCESS`
3. Get the resulting file with `api/short_term_storage/${storageRequestId}`
"""
bco = self._deprecated_generate_bco(trans, invocation_id, merge_history_metadata)
return json.loads(bco)

# TODO: remove this endpoint after 23.1 release
@router.get(
"/api/invocations/{invocation_id}/biocompute/download",
summary="Return a BioCompute Object for the workflow invocation as a file for download.",
response_class=StreamingResponse,
deprecated=True,
)
def download_invocation_bco(
self,
invocation_id: InvocationIDPathParam,
trans: ProvidesUserContext = DependsOnTrans,
merge_history_metadata: Optional[bool] = Query(default=False),
):
"""
The BioCompute Object endpoints are in beta - important details such
as how inputs and outputs are represented, how the workflow is encoded,
and how author and version information is encoded, and how URLs are
generated will very likely change in important ways over time.
**Deprecation Notice**: please use the asynchronous short_term_storage export system instead.
1. call POST `api/invocations/{id}/prepare_store_download` with payload:
```
{
model_store_format: bco.json
}
```
2. Get `storageRequestId` from response and poll GET `api/short_term_storage/${storageRequestId}/ready` until `SUCCESS`
3. Get the resulting file with `api/short_term_storage/${storageRequestId}`
"""
bco = self._deprecated_generate_bco(trans, invocation_id, merge_history_metadata)
return StreamingResponse(
content=BytesIO(bco),
media_type="application/json",
headers={
"Content-Disposition": f'attachment; filename="bco_{trans.security.encode_id(invocation_id)}.json"',
"Access-Control-Expose-Headers": "Content-Disposition",
},
)

# TODO: remove this after 23.1 release
def _deprecated_generate_bco(
self, trans, invocation_id: DecodedDatabaseIdField, merge_history_metadata: Optional[bool]
):
export_options = BcoExportOptions(
galaxy_url=trans.request.url_path,
galaxy_version=VERSION,
merge_history_metadata=merge_history_metadata or False,
)
return self.invocations_service.deprecated_generate_invocation_bco(trans, invocation_id, export_options)
24 changes: 0 additions & 24 deletions lib/galaxy/webapps/galaxy/services/invocations.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import logging
from tempfile import NamedTemporaryFile
from typing import (
Any,
Dict,
Expand Down Expand Up @@ -28,10 +27,6 @@
WorkflowInvocation,
WorkflowInvocationStep,
)
from galaxy.model.store import (
BcoExportOptions,
get_export_store_factory,
)
from galaxy.schema.fields import DecodedDatabaseIdField
from galaxy.schema.invocation import (
CreateInvocationFromStore,
Expand Down Expand Up @@ -235,25 +230,6 @@ def serialize_workflow_invocation_step(
):
return invocation_step.to_dict("element")

# TODO: remove this after 23.1 release
def deprecated_generate_invocation_bco(
self,
trans,
invocation_id: DecodedDatabaseIdField,
export_options: BcoExportOptions,
):
workflow_invocation = self._workflows_manager.get_invocation(trans, invocation_id, eager=True)
if not workflow_invocation:
raise ObjectNotFound()

with NamedTemporaryFile() as export_target:
with get_export_store_factory(trans.app, "bco.json", bco_export_options=export_options)(
export_target.name
) as export_store:
export_store.export_workflow_invocation(workflow_invocation)
export_target.seek(0)
return export_target.read()

def create_from_store(
self,
trans: ProvidesHistoryContext,
Expand Down
4 changes: 3 additions & 1 deletion lib/galaxy_test/api/test_workflows.py
Original file line number Diff line number Diff line change
Expand Up @@ -3087,7 +3087,9 @@ def test_export_invocation_bco(self):
with self.dataset_populator.test_history() as history_id:
summary = self._run_workflow(WORKFLOW_SIMPLE, test_data={"input1": "hello world"}, history_id=history_id)
invocation_id = summary.invocation_id
bco = self.workflow_populator.get_biocompute_object(invocation_id)
bco_path = self.workflow_populator.download_invocation_to_store(invocation_id, extension="bco.json")
with open(bco_path) as f:
bco = json.load(f)
self.workflow_populator.validate_biocompute_object(bco)
assert bco["provenance_domain"]["name"] == "Simple Workflow"

Expand Down
5 changes: 0 additions & 5 deletions lib/galaxy_test/base/populators.py
Original file line number Diff line number Diff line change
Expand Up @@ -1829,11 +1829,6 @@ def create_invocation_from_store(
api_asserts.assert_status_code_is_ok(create_response)
return create_response.json()

def get_biocompute_object(self, invocation_id):
bco_response = self._get(f"invocations/{invocation_id}/biocompute")
bco_response.raise_for_status()
return bco_response.json()

def validate_biocompute_object(
self, bco, expected_schema_version="https://w3id.org/ieee/ieee-2791-schema/2791object.json"
):
Expand Down

0 comments on commit d02ac22

Please sign in to comment.