Warning

This document is for an old release of Galaxy. You can alternatively view this page in the latest release if it exists or view the top of the latest release's documentation.

galaxy.webapps.galaxy.services package

Submodules

galaxy.webapps.galaxy.services.authenticate module

class galaxy.webapps.galaxy.services.authenticate.APIKeyResponse(*, api_key: str)[source]

Bases: BaseModel

api_key: str
class galaxy.webapps.galaxy.services.authenticate.AuthenticationService(user_manager: UserManager, auth_manager: AuthManager, api_keys_manager: ApiKeyManager)[source]

Bases: object

__init__(user_manager: UserManager, auth_manager: AuthManager, api_keys_manager: ApiKeyManager)[source]
get_api_key(environ: Dict[str, Any], request: Union[Request, Request]) APIKeyResponse[source]

galaxy.webapps.galaxy.services.base module

galaxy.webapps.galaxy.services.base.ensure_celery_tasks_enabled(config)[source]
exception galaxy.webapps.galaxy.services.base.SecurityNotProvidedError[source]

Bases: Exception

class galaxy.webapps.galaxy.services.base.ServiceBase(security: Optional[IdEncodingHelper] = None)[source]

Bases: object

Base class with common logic and utils reused by other services.

A service class:
  • Provides top level operations (Index, Show, Delete…) that are usually consumed directly by the API controllers or other services.

  • Uses a combination of managers to perform the operations and avoids accessing the database layer directly.

  • Can speak ‘pydantic’ and has rich type annotations to be explicit about the required parameters and outputs of each operation.

__init__(security: Optional[IdEncodingHelper] = None)[source]
property security: IdEncodingHelper
decode_id(id: EncodedDatabaseIdField, kind: Optional[str] = None) int[source]

Decodes a previously encoded database ID.

encode_id(id: int, kind: Optional[str] = None) EncodedDatabaseIdField[source]

Encodes a raw database ID.

decode_ids(ids: List[EncodedDatabaseIdField]) List[int][source]

Decodes all encoded IDs in the given list.

encode_all_ids(rval, recursive: bool = False)[source]

Encodes all integer values in the dict rval whose keys are ‘id’ or end with ‘_id’

It might be useful to turn this in to a decorator

build_order_by(manager: SortableManager, order_by_query: Optional[str] = None)[source]

Returns an ORM compatible order_by clause using the order attribute and the given manager.

The manager has to implement the parse_order_by function to support all the sortable model attributes.

get_class(class_name)[source]

Returns the class object that a string denotes. Without this method, we’d have to do eval(<class_name>).

get_object(trans, id, class_name, check_ownership=False, check_accessible=False, deleted=None)[source]

Convenience method to get a model object with the specified checks.

check_user_is_authenticated(trans: ProvidesUserContext)[source]

Raises an exception if the request is anonymous.

get_authenticated_user(trans: ProvidesUserContext) User[source]

Gets the authenticated user and prevents access from anonymous users.

class galaxy.webapps.galaxy.services.base.ServedExportStore(export_store, export_target)[source]

Bases: tuple

property export_store

Alias for field number 0

property export_target

Alias for field number 1

galaxy.webapps.galaxy.services.base.model_store_storage_target(short_term_storage_allocator: ShortTermStorageAllocator, file_name: str, model_store_format: str) ShortTermStorageTarget[source]
class galaxy.webapps.galaxy.services.base.ServesExportStores[source]

Bases: object

serve_export_store(app, download_format: str)[source]
class galaxy.webapps.galaxy.services.base.ConsumesModelStores[source]

Bases: object

create_objects_from_store(trans, payload, history=None, for_library=False)[source]
galaxy.webapps.galaxy.services.base.async_task_summary(async_result: AsyncResult) AsyncTaskResultSummary[source]

galaxy.webapps.galaxy.services.dataset_collections module

class galaxy.webapps.galaxy.services.dataset_collections.UpdateCollectionAttributePayload(*, dbkey: str)[source]

Bases: Model

Contains attributes that can be updated for all elements in a dataset collection.

dbkey: str
class Config[source]

Bases: object

extra = 'forbid'
class galaxy.webapps.galaxy.services.dataset_collections.DatasetCollectionAttributesResult(*, dbkey: str, extension: str, model_class: typing_extensions.Literal[HistoryDatasetCollectionAssociation] = 'HistoryDatasetCollectionAssociation', dbkeys: Optional[Set[str]] = None, extensions: Optional[Set[str]] = None, tags: TagCollection)[source]

Bases: Model

dbkey: str
extension: str
model_class: typing_extensions.Literal[HistoryDatasetCollectionAssociation]
dbkeys: Optional[Set[str]]
extensions: Optional[Set[str]]
tags: TagCollection
class galaxy.webapps.galaxy.services.dataset_collections.SuitableConverter(*, tool_id: str, name: str, target_type: str, original_type: str)[source]

Bases: Model

tool_id: str
name: str
target_type: str
original_type: str
class galaxy.webapps.galaxy.services.dataset_collections.SuitableConverters(*, __root__: List[SuitableConverter])[source]

Bases: Model

Collection of converters that can be used on a particular dataset collection.

class galaxy.webapps.galaxy.services.dataset_collections.DatasetCollectionContentElements(*, __root__: List[DCESummary])[source]

Bases: Model

Represents a collection of elements contained in the dataset collection.

class galaxy.webapps.galaxy.services.dataset_collections.DatasetCollectionsService(security: IdEncodingHelper, history_manager: HistoryManager, hdca_manager: HDCAManager, collection_manager: DatasetCollectionManager, datatypes_registry: Registry)[source]

Bases: ServiceBase, UsesLibraryMixinItems

__init__(security: IdEncodingHelper, history_manager: HistoryManager, hdca_manager: HDCAManager, collection_manager: DatasetCollectionManager, datatypes_registry: Registry)[source]
create(trans: ProvidesHistoryContext, payload: CreateNewCollectionPayload) HDCADetailed[source]

Create a new dataset collection instance.

Parameters:

payload (dict) – (optional) dictionary structure containing: * collection_type: dataset collection type to create. * instance_type: Instance type - ‘history’ or ‘library’. * name: the new dataset collections’s name * datasets: object describing datasets for collection

Return type:

dict

Returns:

element view of new dataset collection

copy(trans: ProvidesHistoryContext, id: DecodedDatabaseIdField, payload: UpdateCollectionAttributePayload)[source]

Iterate over all datasets of a collection and copy datasets with new attributes to a new collection. e.g attributes = {‘dbkey’: ‘dm3’}

attributes(trans: ProvidesHistoryContext, id: DecodedDatabaseIdField, instance_type: typing_extensions.Literal[history, library] = 'history') DatasetCollectionAttributesResult[source]

Returns dbkey/extension for collection elements

suitable_converters(trans: ProvidesHistoryContext, id: DecodedDatabaseIdField, instance_type: typing_extensions.Literal[history, library] = 'history') SuitableConverters[source]

Returns suitable converters for all datatypes in collection

show(trans: ProvidesHistoryContext, id: DecodedDatabaseIdField, instance_type: typing_extensions.Literal[history, library] = 'history') HDCADetailed[source]

Returns information about a particular dataset collection.

dce_content(trans: ProvidesHistoryContext, dce_id: DecodedDatabaseIdField) DCESummary[source]
contents(trans: ProvidesHistoryContext, hdca_id: DecodedDatabaseIdField, parent_id: DecodedDatabaseIdField, instance_type: typing_extensions.Literal[history, library] = 'history', limit: Optional[int] = None, offset: Optional[int] = None) DatasetCollectionContentElements[source]

Shows direct child contents of indicated dataset collection parent id

Parameters:
  • id – HDCA.id

  • parent_id – parent dataset_collection.id for the dataset contents to be viewed

  • limit – pagination limit for returned dataset collection elements

  • offset – pagination offset for returned dataset collection elements

Return type:

list

Returns:

list of dataset collection elements and contents

galaxy.webapps.galaxy.services.datasets module

API operations on the contents of a history dataset.

class galaxy.webapps.galaxy.services.datasets.RequestDataType(value)[source]

Bases: str, Enum

Particular pieces of information that can be requested for a dataset.

state = 'state'
converted_datasets_state = 'converted_datasets_state'
data = 'data'
features = 'features'
raw_data = 'raw_data'
track_config = 'track_config'
genome_data = 'genome_data'
in_use_state = 'in_use_state'
class galaxy.webapps.galaxy.services.datasets.DatasetContentType(value)[source]

Bases: str, Enum

For retrieving content from a structured dataset (e.g. HDF5)

meta = 'meta'
attr = 'attr'
stats = 'stats'
data = 'data'
class galaxy.webapps.galaxy.services.datasets.ConcreteObjectStoreQuotaSourceDetails(*, source: Optional[str] = None, enabled: bool)[source]

Bases: Model

source: Optional[str]
enabled: bool
class galaxy.webapps.galaxy.services.datasets.DatasetStorageDetails(*, object_store_id: Optional[str] = None, name: Optional[str] = None, description: Optional[str] = None, percent_used: Optional[float] = None, dataset_state: str, hashes: List[dict], sources: List[dict], shareable: bool, quota: dict, badges: List[Dict[str, Any]])[source]

Bases: Model

object_store_id: Optional[str]
name: Optional[str]
description: Optional[str]
percent_used: Optional[float]
dataset_state: str
hashes: List[dict]
sources: List[dict]
shareable: bool
quota: dict
badges: List[Dict[str, Any]]
class galaxy.webapps.galaxy.services.datasets.DatasetInheritanceChainEntry(*, name: str, dep: str)[source]

Bases: Model

name: str
dep: str
class galaxy.webapps.galaxy.services.datasets.DatasetInheritanceChain(*, __root__: List[DatasetInheritanceChainEntry] = [])[source]

Bases: Model

class galaxy.webapps.galaxy.services.datasets.ExtraFilesEntryClass(value)[source]

Bases: str, Enum

An enumeration.

Directory = 'Directory'
File = 'File'
class galaxy.webapps.galaxy.services.datasets.ExtraFileEntry(*, class_: ExtraFilesEntryClass, path: str)[source]

Bases: Model

class_: ExtraFilesEntryClass
path: str
class galaxy.webapps.galaxy.services.datasets.DatasetTextContentDetails(*, item_data: Optional[str] = None, truncated: bool, item_url: str)[source]

Bases: Model

item_data: Optional[str]
truncated: bool
item_url: str
class galaxy.webapps.galaxy.services.datasets.ConvertedDatasetsMap(*, __root__: Dict[str, DecodedDatabaseIdField])[source]

Bases: Model

Map of file extension -> converted dataset encoded id

class Config[source]

Bases: object

schema_extra = {'example': {'csv': 'dataset_id'}}
class galaxy.webapps.galaxy.services.datasets.DataMode(value)[source]

Bases: str, Enum

An enumeration.

Coverage = 'Coverage'
Auto = 'Auto'
class galaxy.webapps.galaxy.services.datasets.DataResult(*, data: List[Any], dataset_type: Optional[str] = None, message: Optional[str] = None, extra_info: Optional[Any] = None)[source]

Bases: Model

data: List[Any]
dataset_type: Optional[str]
message: Optional[str]
extra_info: Optional[Any]
class galaxy.webapps.galaxy.services.datasets.BamDataResult(*, data: List[Any], dataset_type: Optional[str] = None, message: Optional[str] = None, extra_info: Optional[Any] = None, max_low: int, max_high: int)[source]

Bases: DataResult

max_low: int
max_high: int
class galaxy.webapps.galaxy.services.datasets.DeleteDatasetBatchPayload(*, datasets: List[DatasetSourceId], purge: Optional[bool] = False)[source]

Bases: Model

datasets: List[DatasetSourceId]
purge: Optional[bool]
class galaxy.webapps.galaxy.services.datasets.ComputeDatasetHashPayload(*, hash_function: Optional[HashFunctionNameEnum] = HashFunctionNameEnum.md5, extra_files_path: Optional[str] = None)[source]

Bases: Model

hash_function: Optional[HashFunctionNameEnum]
extra_files_path: Optional[str]
class Config[source]

Bases: object

use_enum_values = True
class galaxy.webapps.galaxy.services.datasets.DatasetErrorMessage(*, dataset: EncodedDatasetSourceId, error_message: str)[source]

Bases: Model

dataset: EncodedDatasetSourceId
error_message: str
class galaxy.webapps.galaxy.services.datasets.DeleteDatasetBatchResult(*, success_count: int, errors: Optional[List[DatasetErrorMessage]] = None)[source]

Bases: Model

success_count: int
errors: Optional[List[DatasetErrorMessage]]
class galaxy.webapps.galaxy.services.datasets.DatasetsService(security: IdEncodingHelper, history_manager: HistoryManager, hda_manager: HDAManager, hda_serializer: HDASerializer, hdca_serializer: HDCASerializer, ldda_manager: LDDAManager, history_contents_manager: HistoryContentsManager, history_contents_filters: HistoryContentsFilters, data_provider_registry: DataProviderRegistry)[source]

Bases: ServiceBase, UsesVisualizationMixin

__init__(security: IdEncodingHelper, history_manager: HistoryManager, hda_manager: HDAManager, hda_serializer: HDASerializer, hdca_serializer: HDCASerializer, ldda_manager: LDDAManager, history_contents_manager: HistoryContentsManager, history_contents_filters: HistoryContentsFilters, data_provider_registry: DataProviderRegistry)[source]
property serializer_by_type: Dict[str, ModelSerializer]
property dataset_manager_by_type: Dict[str, DatasetAssociationManager]
index(trans: ProvidesHistoryContext, history_id: Optional[DecodedDatabaseIdField], serialization_params: SerializationParams, filter_query_params: FilterQueryParams) List[Union[HDADetailed, HDASummary, HDCADetailed, HDCASummary, CustomHistoryItem]][source]

Search datasets or collections using a query system and returns a list containing summary of dataset or dataset_collection information.

show(trans: ProvidesHistoryContext, dataset_id: DecodedDatabaseIdField, hda_ldda: DatasetSourceType, serialization_params: SerializationParams, data_type: Optional[RequestDataType] = None, **extra_params)[source]

Displays information about and/or content of a dataset.

show_storage(trans: ProvidesHistoryContext, dataset_id: DecodedDatabaseIdField, hda_ldda: DatasetSourceType = DatasetSourceType.hda) DatasetStorageDetails[source]

Display user-facing storage details related to the objectstore a dataset resides in.

show_inheritance_chain(trans: ProvidesHistoryContext, dataset_id: DecodedDatabaseIdField, hda_ldda: DatasetSourceType = DatasetSourceType.hda) DatasetInheritanceChain[source]

Display inheritance chain for the given dataset.

compute_hash(trans: ProvidesHistoryContext, dataset_id: DecodedDatabaseIdField, payload: ComputeDatasetHashPayload, hda_ldda: DatasetSourceType = DatasetSourceType.hda) AsyncTaskResultSummary[source]
drs_dataset_instance(object_id: str) Tuple[int, DatasetSourceType][source]
get_drs_object(trans: ProvidesHistoryContext, object_id: str, request_url: URL) Model[source]
update_permissions(trans: ProvidesHistoryContext, dataset_id: DecodedDatabaseIdField, payload: UpdateDatasetPermissionsPayload, hda_ldda: DatasetSourceType = DatasetSourceType.hda) DatasetAssociationRoles[source]

Updates permissions of a dataset.

extra_files(trans: ProvidesHistoryContext, history_content_id: DecodedDatabaseIdField)[source]

Generate list of extra files.

display(trans: ProvidesHistoryContext, dataset_id: DecodedDatabaseIdField, hda_ldda: DatasetSourceType = DatasetSourceType.hda, preview: bool = False, filename: Optional[str] = None, to_ext: Optional[str] = None, raw: bool = False, offset: Optional[int] = None, ck_size: Optional[int] = None, **kwd)[source]

Displays history content (dataset).

The query parameter ‘raw’ should be considered experimental and may be dropped at some point in the future without warning. Generally, data should be processed by its datatype prior to display (the default if raw is unspecified or explicitly false.

get_content_as_text(trans: ProvidesHistoryContext, dataset_id: DecodedDatabaseIdField) DatasetTextContentDetails[source]

Returns dataset content as Text.

get_metadata_file(trans: ProvidesHistoryContext, history_content_id: DecodedDatabaseIdField, metadata_file: str, open_file: bool = False)[source]

Gets the associated metadata file.

The open_file parameter determines if we return the path of the file or the opened file handle. TODO: Remove the open_file parameter when removing the associated legacy endpoint.

converted_ext(trans: ProvidesHistoryContext, dataset_id: DecodedDatabaseIdField, ext: str, serialization_params: SerializationParams) Union[HDADetailed, HDASummary][source]

Return information about datasets made by converting this dataset to a new format

converted(trans: ProvidesHistoryContext, dataset_id: DecodedDatabaseIdField) ConvertedDatasetsMap[source]

Return a file extension -> converted dataset encoded id map with all the existing converted datasets associated with this instance.

delete_batch(trans: ProvidesHistoryContext, payload: DeleteDatasetBatchPayload) DeleteDatasetBatchResult[source]

Deletes or purges a batch of datasets. Warning: only the ownership of the dataset and upload state for HDAs is checked, no other checks or restrictions are made.

get_structured_content(trans: ProvidesHistoryContext, dataset_id: DecodedDatabaseIdField, content_type: DatasetContentType, **params)[source]

Retrieves contents of a dataset. It is left to the datatype to decide how to interpret the content types.

galaxy.webapps.galaxy.services.histories module

class galaxy.webapps.galaxy.services.histories.HistoriesService(security: IdEncodingHelper, manager: HistoryManager, user_manager: UserManager, serializer: HistorySerializer, deserializer: HistoryDeserializer, citations_manager: CitationsManager, history_export_manager: HistoryExportManager, filters: HistoryFilters, short_term_storage_allocator: ShortTermStorageAllocator, notification_manager: NotificationManager)[source]

Bases: ServiceBase, ConsumesModelStores, ServesExportStores

Common interface/service logic for interactions with histories in the context of the API.

Provides the logic of the actions invoked by API controllers and uses type definitions and pydantic models to declare its parameters and return types.

__init__(security: IdEncodingHelper, manager: HistoryManager, user_manager: UserManager, serializer: HistorySerializer, deserializer: HistoryDeserializer, citations_manager: CitationsManager, history_export_manager: HistoryExportManager, filters: HistoryFilters, short_term_storage_allocator: ShortTermStorageAllocator, notification_manager: NotificationManager)[source]
index(trans: ProvidesHistoryContext, serialization_params: SerializationParams, filter_query_params: FilterQueryParams, deleted_only: Optional[bool] = False, all_histories: Optional[bool] = False)[source]

Return a collection of histories for the current user. Additional filters can be applied.

Parameters:

deleted_only (optional boolean) – if True, show only deleted histories, if False, non-deleted

Note

Anonymous users are allowed to get their current history

create(trans: ProvidesHistoryContext, payload: CreateHistoryPayload, serialization_params: SerializationParams)[source]

Create a new history from scratch, by copying an existing one or by importing from URL or File depending on the provided parameters in the payload.

create_from_store(trans, payload: CreateHistoryFromStore, serialization_params: SerializationParams) Union[HistorySummary, HistoryDetailed, Any][source]
create_from_store_async(trans, payload: CreateHistoryFromStore) AsyncTaskResultSummary[source]
show(trans: ProvidesHistoryContext, serialization_params: SerializationParams, history_id: Optional[DecodedDatabaseIdField] = None)[source]

Returns detailed information about the history with the given encoded id. If no id is provided, then the most recently used history will be returned.

Parameters:
  • history_id – the encoded id of the history to query or None to use the most recently used

  • serialization_params – contains the optional view, keys and default_view for serialization

Returns:

detailed history information

prepare_download(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, payload: StoreExportPayload) AsyncFile[source]
write_store(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, payload: WriteStoreToPayload) AsyncTaskResultSummary[source]
update(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, payload, serialization_params: SerializationParams)[source]

Updates the values for the history with the given id

Parameters:
  • history_id – the encoded id of the history to update

  • payload

    a dictionary containing any or all the fields in galaxy.model.History.to_dict() and/or the following:

    • annotation: an annotation for the history

  • serialization_params – contains the optional view, keys and default_view for serialization

Returns:

an error object if an error occurred or a dictionary containing any values that were different from the original and, therefore, updated

delete(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, serialization_params: SerializationParams, purge: bool = False)[source]

Delete the history with the given id

Note

Stops all active jobs in the history if purge is set.

You can purge a history, removing all it’s datasets from disk (if unshared), by passing in purge=True in the url.

undelete(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, serialization_params: SerializationParams)[source]

Undelete history (that hasn’t been purged) with the given id

Parameters:
  • history_id – the encoded id of the history to undelete

  • serialization_params – contains the optional view, keys and default_view for serialization

Returns:

the undeleted history

shared_with_me(trans: ProvidesHistoryContext, serialization_params: SerializationParams, filter_query_params: FilterQueryParams)[source]

Return all histories that are shared with the current user. The results can be filtered.

count(trans: ProvidesHistoryContext)[source]

Returns number of histories for the current user.

published(trans: ProvidesHistoryContext, serialization_params: SerializationParams, filter_query_params: FilterQueryParams)[source]

Return all histories that are published. The results can be filtered.

citations(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField)[source]

Return all the citations for the tools used to produce the datasets in the history.

index_exports(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, use_tasks: bool = False, limit: Optional[int] = None, offset: Optional[int] = None)[source]
archive_export(trans, history_id: DecodedDatabaseIdField, payload: Optional[ExportHistoryArchivePayload] = None) Tuple[Union[JobExportHistoryArchiveModel, JobIdResponse], bool][source]

start job (if needed) to create history export for corresponding history.

Parameters:

history_id – the encoded id of the history to export

Returns:

object containing url to fetch export from.

get_ready_history_export(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, jeha_id: Union[DecodedDatabaseIdField, typing_extensions.Literal[latest]]) JobExportHistoryArchive[source]

Returns the exported history archive information if it’s ready or raises an exception if not.

get_archive_download_path(trans: ProvidesHistoryContext, jeha: JobExportHistoryArchive) str[source]

If ready and available, return raw contents of exported history using a generator function.

get_archive_media_type(jeha: JobExportHistoryArchive)[source]
legacy_archive_download(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, jeha_id: DecodedDatabaseIdField)[source]

If ready and available, return raw contents of exported history.

get_custom_builds_metadata(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField) CustomBuildsMetadataResponse[source]

Returns metadata for custom builds.

archive_history(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, payload: Optional[ArchiveHistoryRequestPayload] = None) Union[ArchivedHistorySummary, ArchivedHistoryDetailed, Any][source]

Marks the history with the given id as archived and optionally associates it with the given archive export record in the payload.

Archived histories are not part of the active histories of the user, so they won’t be shown to the user by default.

restore_archived_history(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, force: Optional[bool] = False) Union[HistorySummary, HistoryDetailed, Any][source]
get_archived_histories(trans: ProvidesHistoryContext, serialization_params: SerializationParams, filter_query_params: FilterQueryParams, include_total_matches: bool = False) Tuple[List[Union[ArchivedHistorySummary, ArchivedHistoryDetailed, Any]], Optional[int]][source]
galaxy.webapps.galaxy.services.histories.get_fasta_hdas_by_history(session: Session, history_id: int)[source]

galaxy.webapps.galaxy.services.history_contents module

class galaxy.webapps.galaxy.services.history_contents.HistoryContentsIndexParams(*, v: Optional[typing_extensions.Literal[dev]] = None, dataset_details: Optional[Union[Set[DecodedDatabaseIdField], typing_extensions.Literal[all]]] = None)[source]

Bases: Model

Query parameters exclusively used by the new version of index operation.

v: Optional[typing_extensions.Literal[dev]]
dataset_details: Optional[Union[Set[DecodedDatabaseIdField], typing_extensions.Literal[all]]]
class galaxy.webapps.galaxy.services.history_contents.LegacyHistoryContentsIndexParams(*, ids: Optional[List[DecodedDatabaseIdField]] = None, types: List[HistoryContentType], dataset_details: Optional[Union[Set[DecodedDatabaseIdField], typing_extensions.Literal[all]]] = None, deleted: Optional[bool] = None, visible: Optional[bool] = None, shareable: Optional[bool] = None)[source]

Bases: Model

Query parameters exclusively used by the legacy version of index operation.

ids: Optional[List[DecodedDatabaseIdField]]
types: List[HistoryContentType]
dataset_details: Optional[Union[Set[DecodedDatabaseIdField], typing_extensions.Literal[all]]]
deleted: Optional[bool]
visible: Optional[bool]
shareable: Optional[bool]
class galaxy.webapps.galaxy.services.history_contents.HistoryContentsIndexJobsSummaryParams(*, ids: List[DecodedDatabaseIdField] = [], types: List[JobSourceType] = [])[source]

Bases: Model

Query parameters exclusively used by the index_jobs_summary operation.

ids: List[DecodedDatabaseIdField]
types: List[JobSourceType]
class galaxy.webapps.galaxy.services.history_contents.CreateHistoryContentPayloadBase(*, type: Optional[HistoryContentType] = HistoryContentType.dataset)[source]

Bases: Model

type: Optional[HistoryContentType]
class galaxy.webapps.galaxy.services.history_contents.CreateHistoryContentPayloadFromCopy(*, type: Optional[HistoryContentType] = HistoryContentType.dataset, source: Optional[HistoryContentSource] = None, content: Optional[Union[DecodedDatabaseIdField, LibraryFolderDatabaseIdField]] = None)[source]

Bases: CreateHistoryContentPayloadBase

source: Optional[HistoryContentSource]
content: Optional[Union[DecodedDatabaseIdField, LibraryFolderDatabaseIdField]]
class galaxy.webapps.galaxy.services.history_contents.CollectionElementIdentifier(*, name: Optional[str] = None, src: ColletionSourceType, id: Optional[DecodedDatabaseIdField] = None, tags: List[str] = [], element_identifiers: Optional[List[CollectionElementIdentifier]] = None, collection_type: Optional[str] = None)[source]

Bases: Model

name: Optional[str]
src: ColletionSourceType
id: Optional[DecodedDatabaseIdField]
tags: List[str]
element_identifiers: Optional[List[CollectionElementIdentifier]]
collection_type: Optional[str]
class galaxy.webapps.galaxy.services.history_contents.CreateHistoryContentFromStore(*, store_content_uri: Optional[str] = None, store_dict: Optional[Dict[str, Any]] = None, model_store_format: Optional[ModelStoreFormat] = None)[source]

Bases: StoreContentSource

store_content_uri: Optional[str]
store_dict: Optional[Dict[str, Any]]
model_store_format: Optional[ModelStoreFormat]
class galaxy.webapps.galaxy.services.history_contents.CreateHistoryContentPayloadFromCollection(*, type: Optional[HistoryContentType] = HistoryContentType.dataset, source: Optional[HistoryContentSource] = None, content: Optional[Union[DecodedDatabaseIdField, LibraryFolderDatabaseIdField]] = None, dbkey: Optional[str] = None, copy_elements: Optional[bool] = True)[source]

Bases: CreateHistoryContentPayloadFromCopy

dbkey: Optional[str]
copy_elements: Optional[bool]
class galaxy.webapps.galaxy.services.history_contents.CreateHistoryContentPayload(*, collection_type: Optional[str] = None, element_identifiers: Optional[List[CollectionElementIdentifier]] = None, name: Optional[str] = None, hide_source_items: Optional[bool] = False, copy_elements: Optional[bool] = True, instance_type: Optional[typing_extensions.Literal[history, library]] = 'history', history_id: Optional[DecodedDatabaseIdField] = None, folder_id: Optional[LibraryFolderDatabaseIdField] = None, type: Optional[HistoryContentType] = HistoryContentType.dataset, source: Optional[HistoryContentSource] = None, content: Optional[Union[DecodedDatabaseIdField, LibraryFolderDatabaseIdField]] = None, dbkey: Optional[str] = None, **extra_data: Any)[source]

Bases: CreateHistoryContentPayloadFromCollection, CreateNewCollectionPayload

class Config[source]

Bases: object

extra = 'allow'
dbkey: Optional[str]
copy_elements: Optional[bool]
source: Optional[HistoryContentSource]
content: Optional[Union[DecodedDatabaseIdField, LibraryFolderDatabaseIdField]]
type: Optional[HistoryContentType]
class galaxy.webapps.galaxy.services.history_contents.HistoriesContentsService(security: IdEncodingHelper, object_store: BaseObjectStore, history_manager: HistoryManager, history_contents_manager: HistoryContentsManager, hda_manager: HDAManager, hdca_manager: HDCAManager, dataset_collection_manager: DatasetCollectionManager, ldda_manager: LibraryDatasetsManager, folder_manager: FolderManager, hda_serializer: HDASerializer, hda_deserializer: HDADeserializer, hdca_serializer: HDCASerializer, history_contents_filters: HistoryContentsFilters, short_term_storage_allocator: ShortTermStorageAllocator, genomes_manager: GenomesManager)[source]

Bases: ServiceBase, ServesExportStores, ConsumesModelStores

Common interface/service logic for interactions with histories contents in the context of the API.

Provides the logic of the actions invoked by API controllers and uses type definitions and pydantic models to declare its parameters and return types.

__init__(security: IdEncodingHelper, object_store: BaseObjectStore, history_manager: HistoryManager, history_contents_manager: HistoryContentsManager, hda_manager: HDAManager, hdca_manager: HDCAManager, dataset_collection_manager: DatasetCollectionManager, ldda_manager: LibraryDatasetsManager, folder_manager: FolderManager, hda_serializer: HDASerializer, hda_deserializer: HDADeserializer, hdca_serializer: HDCASerializer, history_contents_filters: HistoryContentsFilters, short_term_storage_allocator: ShortTermStorageAllocator, genomes_manager: GenomesManager)[source]
index(trans, history_id: DecodedDatabaseIdField, params: HistoryContentsIndexParams, legacy_params: LegacyHistoryContentsIndexParams, serialization_params: SerializationParams, filter_query_params: FilterQueryParams, accept: str) Union[HistoryContentsResult, HistoryContentsWithStatsResult][source]

Return a list of contents (HDAs and HDCAs) for the history with the given ID.

Note

Anonymous users are allowed to get their current history contents.

show(trans, id: DecodedDatabaseIdField, serialization_params: SerializationParams, contents_type: HistoryContentType, fuzzy_count: Optional[int] = None) Union[HDADetailed, HDASummary, HDCADetailed, HDCASummary, CustomHistoryItem][source]

Return detailed information about an HDA or HDCA within a history

Note

Anonymous users are allowed to get their current history contents

Parameters:
  • id – the encoded id of the HDA or HDCA to return

  • contents_type – ‘dataset’ or ‘dataset_collection’

  • serialization_params.view – if fetching a dataset collection - the view style of the dataset collection to produce. ‘collection’ returns no element information, ‘element’ returns detailed element information for all datasets, ‘element-reference’ returns a minimal set of information about datasets (for instance id, type, and state but not metadata, peek, info, or name). The default is ‘element’.

  • fuzzy_count – this value can be used to broadly restrict the magnitude of the number of elements returned via the API for large collections. The number of actual elements returned may be “a bit” more than this number or “a lot” less - varying on the depth of nesting, balance of nesting at each level, and size of target collection. The consumer of this API should not expect a stable number or pre-calculable number of elements to be produced given this parameter - the only promise is that this API will not respond with an order of magnitude more elements estimated with this value. The UI uses this parameter to fetch a “balanced” concept of the “start” of large collections at every depth of the collection.

Returns:

dictionary containing detailed HDA or HDCA information

prepare_store_download(trans: ProvidesHistoryContext, id: DecodedDatabaseIdField, payload: StoreExportPayload, contents_type: HistoryContentType = HistoryContentType.dataset) AsyncFile[source]
write_store(trans: ProvidesHistoryContext, id: DecodedDatabaseIdField, payload: WriteStoreToPayload, contents_type: HistoryContentType = HistoryContentType.dataset)[source]
index_jobs_summary(trans, params: HistoryContentsIndexJobsSummaryParams) List[Union[galaxy.schema.schema.JobStateSummary, galaxy.schema.schema.ImplicitCollectionJobsStateSummary, galaxy.schema.schema.WorkflowInvocationStateSummary][Union[JobStateSummary, ImplicitCollectionJobsStateSummary, WorkflowInvocationStateSummary]]][source]

Return job state summary info for jobs, implicit groups jobs for collections or workflow invocations

Warning: We allow anyone to fetch job state information about any object they can guess an encoded ID for - it isn’t considered protected data. This keeps polling IDs as part of state calculation for large histories and collections as efficient as possible.

show_jobs_summary(trans, id: DecodedDatabaseIdField, contents_type: HistoryContentType) Union[galaxy.schema.schema.JobStateSummary, galaxy.schema.schema.ImplicitCollectionJobsStateSummary, galaxy.schema.schema.WorkflowInvocationStateSummary][Union[JobStateSummary, ImplicitCollectionJobsStateSummary, WorkflowInvocationStateSummary]][source]

Return detailed information about an HDA or HDCAs jobs

Warning: We allow anyone to fetch job state information about any object they can guess an encoded ID for - it isn’t considered protected data. This keeps polling IDs as part of state calculation for large histories and collections as efficient as possible.

Parameters:
  • id – the encoded id of the HDA or HDCA to return

  • contents_type – ‘dataset’ or ‘dataset_collection’

Returns:

dictionary containing jobs summary object

get_dataset_collection_archive_for_download(trans, id: DecodedDatabaseIdField)[source]

Download the content of a HistoryDatasetCollection as a tgz archive while maintaining approximate collection structure.

Parameters:

id – encoded HistoryDatasetCollectionAssociation (HDCA) id

prepare_collection_download(trans, id: DecodedDatabaseIdField) AsyncFile[source]
create(trans, history_id: DecodedDatabaseIdField, payload: CreateHistoryContentPayload, serialization_params: SerializationParams) Union[HDADetailed, HDASummary, HDCADetailed, HDCASummary, CustomHistoryItem, List[Union[HDADetailed, HDASummary, HDCADetailed, HDCASummary, CustomHistoryItem]]][source]

Create a new HDA or HDCA.

..note:

Currently, a user can only copy an HDA from a history that the user owns.

create_from_store(trans, history_id: DecodedDatabaseIdField, payload: CreateHistoryContentFromStore, serialization_params: SerializationParams) List[Union[HDADetailed, HDASummary, HDCADetailed, HDCASummary, CustomHistoryItem]][source]
materialize(trans, request: MaterializeDatasetInstanceRequest) AsyncTaskResultSummary[source]
update_permissions(trans, history_content_id: DecodedDatabaseIdField, payload: UpdateDatasetPermissionsPayload) DatasetAssociationRoles[source]

Set permissions of the given dataset to the given role ids.

Parameters:

payload (dict) –

dictionary structure containing:

  • action: (required) describes what action should be performed. Available actions: make_private, remove_restrictions, set_permissions

  • access_ids[]: list of Role.id defining roles that should have access permission on the dataset

  • manage_ids[]: list of Role.id defining roles that should have manage permission on the dataset

  • modify_ids[]: list of Role.id defining roles that should have modify permission on the library dataset item

Raises:

RequestParameterInvalidException, ObjectNotFound, InsufficientPermissionsException, InternalServerError RequestParameterMissingException

update(trans, history_id: DecodedDatabaseIdField, id: DecodedDatabaseIdField, payload: Dict[str, Any], serialization_params: SerializationParams, contents_type: HistoryContentType)[source]

Updates the values for the history content item with the given id

Parameters:
  • history_id – encoded id string of the items’s History

  • id – the encoded id of the history item to update

  • payload – a dictionary containing any or all the fields for HDA or HDCA with values different than the defaults

Returns:

an error object if an error occurred or a dictionary containing any values that were different from the original and, therefore, updated

update_batch(trans, history_id: DecodedDatabaseIdField, payload: UpdateHistoryContentsBatchPayload, serialization_params: SerializationParams) List[Union[HDADetailed, HDASummary, HDCADetailed, HDCASummary, CustomHistoryItem]][source]

PUT /api/histories/{history_id}/contents

Parameters:
  • history_id (str) – encoded id string of the history containing supplied items

  • id (str) – the encoded id of the history to update

  • payload (dict) – a dictionary containing any or all the

Return type:

dict

Returns:

an error object if an error occurred or a dictionary containing any values that were different from the original and, therefore, updated

bulk_operation(trans: ProvidesHistoryContext, history_id: DecodedDatabaseIdField, filter_query_params: ValueFilterQueryParams, payload: HistoryContentBulkOperationPayload) HistoryContentBulkOperationResult[source]
validate(trans, history_id: DecodedDatabaseIdField, history_content_id: DecodedDatabaseIdField)[source]

Validates the metadata associated with a dataset within a History.

Parameters:
  • history_id (str) – encoded id string of the items’s History

  • id (str) – the encoded id of the history item to validate

Return type:

dict

Returns:

TODO

delete(trans, id: DecodedDatabaseIdField, serialization_params: SerializationParams, contents_type: HistoryContentType, payload: DeleteHistoryContentPayload)[source]

Delete the history content with the given id and specified type (defaults to dataset)

archive(trans, history_id: DecodedDatabaseIdField, filter_query_params: FilterQueryParams, filename: Optional[str] = '', dry_run: Optional[bool] = True) Union[HistoryContentsArchiveDryRunResult, ZipstreamWrapper][source]

Build and return a compressed archive of the selected history contents

Parameters:
  • filename (string) – (optional) archive name (defaults to history name)

  • dry_run (boolean) – (optional) if True, return the archive and file paths only as json and not an archive file

Returns:

archive file for download or json in dry run mode

class galaxy.webapps.galaxy.services.history_contents.ItemOperation(*args, **kwds)[source]

Bases: Protocol

__init__(*args, **kwargs)
class galaxy.webapps.galaxy.services.history_contents.HistoryItemOperator(hda_manager: HDAManager, hdca_manager: HDCAManager, dataset_collection_manager: DatasetCollectionManager)[source]

Bases: object

Defines operations on history items.

__init__(hda_manager: HDAManager, hdca_manager: HDCAManager, dataset_collection_manager: DatasetCollectionManager)[source]
apply(operation: HistoryContentItemOperation, item: Union[HistoryDatasetAssociation, HistoryDatasetCollectionAssociation], params: Optional[Union[ChangeDatatypeOperationParams, ChangeDbkeyOperationParams, TagOperationParams]], trans: ProvidesHistoryContext)[source]

galaxy.webapps.galaxy.services.invocations module

class galaxy.webapps.galaxy.services.invocations.InvocationSerializationView(value)[source]

Bases: str, Enum

An enumeration.

element = 'element'
collection = 'collection'
class galaxy.webapps.galaxy.services.invocations.InvocationSerializationParams(*, view: Optional[InvocationSerializationView] = None, step_details: bool = False, legacy_job_state: bool = False)[source]

Bases: BaseModel

Contains common parameters for customizing model serialization.

view: Optional[InvocationSerializationView]
step_details: bool
legacy_job_state: bool
class galaxy.webapps.galaxy.services.invocations.InvocationIndexPayload(*, workflow_id: Optional[DecodedDatabaseIdField] = None, history_id: Optional[DecodedDatabaseIdField] = None, job_id: Optional[DecodedDatabaseIdField] = None, user_id: Optional[DecodedDatabaseIdField] = None, sort_by: Optional[InvocationSortByEnum] = None, sort_desc: bool = False, include_terminal: bool = True, limit: Optional[ConstrainedIntValue] = 100, offset: Optional[int] = 0, instance: bool = False)[source]

Bases: InvocationIndexQueryPayload

instance: bool
class galaxy.webapps.galaxy.services.invocations.PrepareStoreDownloadPayload(*, bco_merge_history_metadata: bool = False, bco_override_environment_variables: Optional[Dict[str, str]] = None, bco_override_empirical_error: Optional[Dict[str, str]] = None, bco_override_algorithmic_error: Optional[Dict[str, str]] = None, bco_override_xref: Optional[List[XrefItem]] = None, model_store_format: ModelStoreFormat = ModelStoreFormat.TAR_DOT_GZ, include_files: bool = True, include_deleted: bool = False, include_hidden: bool = False)[source]

Bases: StoreExportPayload, BcoGenerationParametersMixin

model_store_format: ModelStoreFormat
include_files: bool
include_deleted: bool
include_hidden: bool
class galaxy.webapps.galaxy.services.invocations.WriteInvocationStoreToPayload(*, bco_merge_history_metadata: bool = False, bco_override_environment_variables: Optional[Dict[str, str]] = None, bco_override_empirical_error: Optional[Dict[str, str]] = None, bco_override_algorithmic_error: Optional[Dict[str, str]] = None, bco_override_xref: Optional[List[XrefItem]] = None, model_store_format: ModelStoreFormat = ModelStoreFormat.TAR_DOT_GZ, include_files: bool = True, include_deleted: bool = False, include_hidden: bool = False, target_uri: str)[source]

Bases: WriteStoreToPayload, BcoGenerationParametersMixin

target_uri: str
model_store_format: ModelStoreFormat
include_files: bool
include_deleted: bool
include_hidden: bool
class galaxy.webapps.galaxy.services.invocations.InvocationsService(security: IdEncodingHelper, histories_manager: HistoryManager, workflows_manager: WorkflowsManager, short_term_storage_allocator: ShortTermStorageAllocator)[source]

Bases: ServiceBase

__init__(security: IdEncodingHelper, histories_manager: HistoryManager, workflows_manager: WorkflowsManager, short_term_storage_allocator: ShortTermStorageAllocator)[source]
index(trans, invocation_payload: InvocationIndexPayload, serialization_params: InvocationSerializationParams) Tuple[List[Dict[str, Any]], int][source]
prepare_store_download(trans, invocation_id: DecodedDatabaseIdField, payload: PrepareStoreDownloadPayload) AsyncFile[source]
write_store(trans, invocation_id: DecodedDatabaseIdField, payload: WriteInvocationStoreToPayload) AsyncTaskResultSummary[source]
serialize_workflow_invocation(invocation: WorkflowInvocation, params: InvocationSerializationParams, default_view: InvocationSerializationView = InvocationSerializationView.element)[source]
serialize_workflow_invocations(invocations, params: InvocationSerializationParams, default_view: InvocationSerializationView = InvocationSerializationView.collection)[source]
deprecated_generate_invocation_bco(trans, invocation_id: DecodedDatabaseIdField, export_options: BcoExportOptions)[source]

galaxy.webapps.galaxy.services.jobs module

class galaxy.webapps.galaxy.services.jobs.JobIndexViewEnum(value)[source]

Bases: str, Enum

An enumeration.

collection = 'collection'
admin_job_list = 'admin_job_list'
class galaxy.webapps.galaxy.services.jobs.JobIndexPayload(*, states: Optional[List[str]] = None, user_details: bool = False, user_id: Optional[DecodedDatabaseIdField] = None, tool_ids: Optional[List[str]] = None, tool_ids_like: Optional[List[str]] = None, date_range_min: Optional[Union[OffsetNaiveDatetime, date]] = None, date_range_max: Optional[Union[OffsetNaiveDatetime, date]] = None, history_id: Optional[DecodedDatabaseIdField] = None, workflow_id: Optional[DecodedDatabaseIdField] = None, invocation_id: Optional[DecodedDatabaseIdField] = None, order_by: JobIndexSortByEnum = JobIndexSortByEnum.update_time, search: Optional[str] = None, limit: int = 500, offset: int = 0, view: JobIndexViewEnum = JobIndexViewEnum.collection)[source]

Bases: JobIndexQueryPayload

view: JobIndexViewEnum
class galaxy.webapps.galaxy.services.jobs.JobsService(security: IdEncodingHelper, job_manager: JobManager, job_search: JobSearch, hda_manager: HDAManager)[source]

Bases: ServiceBase

__init__(security: IdEncodingHelper, job_manager: JobManager, job_search: JobSearch, hda_manager: HDAManager)[source]
job_manager: JobManager
hda_manager: HDAManager
show(trans: ProvidesUserContext, id: DecodedDatabaseIdField, full: bool = False) Dict[str, Any][source]
index(trans: ProvidesUserContext, payload: JobIndexPayload)[source]
get_job(trans: ProvidesUserContext, job_id: Optional[int] = None, dataset_id: Optional[int] = None, hda_ldda: str = 'hda')[source]
dictify_associations(trans, *association_lists) List[JobAssociation][source]

galaxy.webapps.galaxy.services.libraries module

class galaxy.webapps.galaxy.services.libraries.LibrariesService(security: IdEncodingHelper, folder_manager: FolderManager, library_manager: LibraryManager, role_manager: RoleManager)[source]

Bases: ServiceBase, ConsumesModelStores

Common interface/service logic for interactions with libraries (top level) in the context of the API.

Provides the logic of the actions invoked by API controllers and uses type definitions and pydantic models to declare its parameters and return types.

__init__(security: IdEncodingHelper, folder_manager: FolderManager, library_manager: LibraryManager, role_manager: RoleManager)[source]
index(trans: ProvidesAppContext, deleted: Optional[bool] = False) LibrarySummaryList[source]

Returns a list of summary data for all libraries.

Parameters:

deleted (boolean (optional)) – if True, show only deleted libraries, if False show only non-deleted

Returns:

list of dictionaries containing library information

Return type:

list

show(trans, id: DecodedDatabaseIdField) LibrarySummary[source]

Returns detailed information about a library.

create(trans, payload: CreateLibraryPayload) LibrarySummary[source]

Creates a new library.

Note

Currently, only admin users can create libraries.

create_from_store(trans, payload: CreateLibrariesFromStore) List[LibrarySummary][source]
update(trans, id: DecodedDatabaseIdField, payload: UpdateLibraryPayload) LibrarySummary[source]

Updates the library with given id with the data in the payload.

delete(trans, id: DecodedDatabaseIdField, undelete: Optional[bool] = False) LibrarySummary[source]

Marks the library with the given id as deleted (or removes the deleted mark if the undelete param is true)

Note

Currently, only admin users can un/delete libraries.

Parameters:

undelete (bool) – (optional) flag specifying whether the item should be deleted or undeleted, defaults to false:

get_permissions(trans, id: DecodedDatabaseIdField, scope: Optional[LibraryPermissionScope] = LibraryPermissionScope.current, is_library_access: Optional[bool] = False, page: int = 1, page_limit: int = 10, query: Optional[str] = None) Union[LibraryCurrentPermissions, LibraryAvailablePermissions][source]

Load all permissions for the given library id and return it.

Parameters:
  • id (an encoded id string) – the encoded id of the library

  • scope (string) – either ‘current’ or ‘available’

  • is_library_access (bool) – indicates whether the roles available for the library access are requested

Returns:

dictionary with all applicable permissions’ values

Return type:

dictionary

Raises:

InsufficientPermissionsException

set_permissions(trans, id: DecodedDatabaseIdField, payload: Dict[str, Any]) Union[LibraryLegacySummary, LibraryCurrentPermissions][source]

Set permissions of the given library to the given role ids.

Parameters:
  • id (an encoded id string) – the encoded id of the library to set the permissions of

  • payload

    dictionary structure containing:

    param action:

    (required) describes what action should be performed available actions: remove_restrictions, set_permissions

    type action:

    str

    param access_ids[]:

    list of Role.id defining roles that should have access permission on the library

    type access_ids[]:

    string or list

    param add_ids[]:

    list of Role.id defining roles that should have add item permission on the library

    type add_ids[]:

    string or list

    param manage_ids[]:

    list of Role.id defining roles that should have manage permission on the library

    type manage_ids[]:

    string or list

    param modify_ids[]:

    list of Role.id defining roles that should have modify permission on the library

    type modify_ids[]:

    string or list

Type:

dictionary

Returns:

dict of current roles for all available permission types

Return type:

dictionary

Raises:

RequestParameterInvalidException, InsufficientPermissionsException, InternalServerError RequestParameterMissingException

set_permissions_old(trans, library, payload: Dict[str, Any]) LibraryLegacySummary[source]

* old implementation for backward compatibility *

Updates the library permissions.

galaxy.webapps.galaxy.services.library_folder_contents module

class galaxy.webapps.galaxy.services.library_folder_contents.UserFolderPermissions(access: bool, modify: bool, add: bool, manage: bool)[source]

Bases: object

access: bool
modify: bool
add: bool
manage: bool
__init__(access: bool, modify: bool, add: bool, manage: bool) None
class galaxy.webapps.galaxy.services.library_folder_contents.LibraryFolderContentsService(security: IdEncodingHelper, hda_manager: HDAManager, folder_manager: FolderManager)[source]

Bases: ServiceBase, UsesLibraryMixinItems

Interface/service shared by controllers for interacting with the contents of a library folder.

__init__(security: IdEncodingHelper, hda_manager: HDAManager, folder_manager: FolderManager)[source]
get_object(trans, id, class_name, check_ownership=False, check_accessible=False, deleted=None)[source]

Convenience method to get a model object with the specified checks.

index(trans: ProvidesUserContext, folder_id: LibraryFolderDatabaseIdField, payload: LibraryFolderContentsIndexQueryPayload) LibraryFolderContentsIndexResult[source]

Displays a collection (list) of a folder’s contents (files and folders). Encoded folder ID is prepended with ‘F’ if it is a folder as opposed to a data set which does not have it. Full path is provided in response as a separate object providing data for breadcrumb path building.

create(trans: ProvidesUserContext, folder_id: LibraryFolderDatabaseIdField, payload: CreateLibraryFilePayload)[source]

Create a new library file from an HDA/HDCA.

galaxy.webapps.galaxy.services.library_folders module

class galaxy.webapps.galaxy.services.library_folders.LibraryFoldersService(security: IdEncodingHelper, folder_manager: FolderManager, role_manager: RoleManager)[source]

Bases: ServiceBase

Common interface/service logic for interactions with library folders in the context of the API. Provides the logic of the actions invoked by API controllers and uses type definitions and pydantic models to declare its parameters and return types.

__init__(security: IdEncodingHelper, folder_manager: FolderManager, role_manager: RoleManager)[source]
show(trans, folder_id: LibraryFolderDatabaseIdField) LibraryFolderDetails[source]

Displays information about a folder.

Parameters:

id (an encoded id string (has to be prefixed by 'F')) – the folder’s encoded id (required)

Returns:

dictionary including details of the folder

Return type:

dict

create(trans, parent_folder_id: LibraryFolderDatabaseIdField, payload: CreateLibraryFolderPayload) LibraryFolderDetails[source]

Create a new folder object underneath the one specified in the parameters.

Parameters:
  • parent_folder_id – (required) the parent folder’s id

  • payload

    dictionary structure containing:

    param name:

    (required) the name of the new folder

    type name:

    str

    param description:

    the description of the new folder

    type description:

    str

:type dictionary :returns: information about newly created folder, notably including ID :rtype: dictionary :raises: RequestParameterMissingException

get_permissions(trans, folder_id: LibraryFolderDatabaseIdField, scope: Optional[LibraryPermissionScope] = LibraryPermissionScope.current, page: int = 1, page_limit: int = 10, query: Optional[str] = None) Union[LibraryFolderCurrentPermissions, LibraryAvailablePermissions][source]

Load all permissions for the given folder id and return it.

Parameters:
  • folder_id – the encoded id of the folder

  • scope (string) – either ‘current’ or ‘available’

Returns:

dictionary with all applicable permissions’ values

Return type:

dictionary

Raises:

InsufficientPermissionsException

set_permissions(trans, folder_id: LibraryFolderDatabaseIdField, payload: dict) LibraryFolderCurrentPermissions[source]

Set permissions of the given folder to the given role ids.

Parameters:
  • folder_id – the encoded id of the folder to set the permissions of

  • payload

    dictionary structure containing:

    param action:

    (required) describes what action should be performed

    type action:

    string

    param add_ids[]:

    list of Role.id defining roles that should have add item permission on the folder

    type add_ids[]:

    string or list

    param manage_ids[]:

    list of Role.id defining roles that should have manage permission on the folder

    type manage_ids[]:

    string or list

    param modify_ids[]:

    list of Role.id defining roles that should have modify permission on the folder

    type modify_ids[]:

    string or list

:type dictionary :returns: dict of current roles for all available permission types. :rtype: dictionary :raises: RequestParameterInvalidException, InsufficientPermissionsException, RequestParameterMissingException

delete(trans, folder_id: LibraryFolderDatabaseIdField, undelete: Optional[bool] = False) LibraryFolderDetails[source]

Mark the folder with the given encoded_folder_id as deleted (or remove the deleted mark if the undelete param is true).

Note

Currently, only admin users can un/delete folders.

Parameters:
  • folder_id – the encoded id of the folder to un/delete

  • undelete (bool) – (optional) flag specifying whether the item should be deleted or undeleted, defaults to false:

Returns:

detailed folder information

Return type:

dictionary

update(trans, folder_id: LibraryFolderDatabaseIdField, payload: UpdateLibraryFolderPayload) LibraryFolderDetails[source]

Update the folder with id folder_id with the data in the payload.

Note

Currently, only administrators can update library folders. Also the folder must not be deleted.

param folder_id:

the encoded id of the folder

param payload:

(required) dictionary structure containing:: ‘name’: new folder’s name, cannot be empty ‘description’: new folder’s description

type payload:

dict

returns:

detailed folder information

rtype:

dict

raises:

RequestParameterMissingException

galaxy.webapps.galaxy.services.pages module

class galaxy.webapps.galaxy.services.pages.PagesService(security: IdEncodingHelper, manager: PageManager, serializer: PageSerializer, short_term_storage_allocator: ShortTermStorageAllocator, notification_manager: NotificationManager)[source]

Bases: ServiceBase

Common interface/service logic for interactions with pages in the context of the API.

Provides the logic of the actions invoked by API controllers and uses type definitions and pydantic models to declare its parameters and return types.

__init__(security: IdEncodingHelper, manager: PageManager, serializer: PageSerializer, short_term_storage_allocator: ShortTermStorageAllocator, notification_manager: NotificationManager)[source]
index(trans, payload: PageIndexQueryPayload, include_total_count: bool = False) Tuple[PageSummaryList, int][source]

Return a list of Pages viewable by the user

Return type:

list

Returns:

dictionaries containing summary or detailed Page information

create(trans, payload: CreatePagePayload) PageSummary[source]

Create a page and return Page summary

delete(trans, id: DecodedDatabaseIdField)[source]

Mark page as deleted

Parameters:

id – ID of the page to be deleted

show(trans, id: DecodedDatabaseIdField) PageDetails[source]

View a page summary and the content of the latest revision

Parameters:

id – ID of page to be displayed

Return type:

dict

Returns:

Dictionary return of the Page.to_dict call with the ‘content’ field populated by the most recent revision

show_pdf(trans, id: DecodedDatabaseIdField)[source]

View a page summary and the content of the latest revision as PDF.

Parameters:

id – ID of page to be displayed

Return type:

dict

Returns:

Dictionary return of the Page.to_dict call with the ‘content’ field populated by the most recent revision

prepare_pdf(trans, id: DecodedDatabaseIdField) AsyncFile[source]

galaxy.webapps.galaxy.services.quotas module

class galaxy.webapps.galaxy.services.quotas.QuotasService(security: IdEncodingHelper, quota_manager: QuotaManager)[source]

Bases: ServiceBase

Interface/service object shared by controllers for interacting with quotas.

__init__(security: IdEncodingHelper, quota_manager: QuotaManager)[source]
index(trans: ProvidesUserContext, deleted: bool = False) QuotaSummaryList[source]

Displays a list of quotas.

show(trans: ProvidesUserContext, id: DecodedDatabaseIdField, deleted: bool = False) QuotaDetails[source]

Displays information about a quota.

create(trans: ProvidesUserContext, params: CreateQuotaParams) CreateQuotaResult[source]

Creates a new quota.

update(trans: ProvidesUserContext, id: DecodedDatabaseIdField, params: UpdateQuotaParams) str[source]

Modifies a quota.

delete(trans: ProvidesUserContext, id: DecodedDatabaseIdField, payload: Optional[DeleteQuotaPayload] = None) str[source]

Marks a quota as deleted.

undelete(trans: ProvidesUserContext, id: DecodedDatabaseIdField) str[source]

Restores a previously deleted quota.

validate_in_users_and_groups(trans, payload)[source]

For convenience, in_users and in_groups can be encoded IDs or emails/group names in the API.

galaxy.webapps.galaxy.services.quotas.get_quotas(session: Session, deleted: bool = False)[source]

galaxy.webapps.galaxy.services.sharable module

class galaxy.webapps.galaxy.services.sharable.ShareableService(manager: SharableModelManager, serializer: SharableModelSerializer, notification_manager: NotificationManager)[source]

Bases: object

Provides the common logic used by the API to share any kind of resource with other users.

The Manager class of the particular resource must implement the SharableModelManager and have a compatible SharableModelSerializer implementation.

__init__(manager: SharableModelManager, serializer: SharableModelSerializer, notification_manager: NotificationManager) None[source]
set_slug(trans, id: DecodedDatabaseIdField, payload: SetSlugPayload)[source]
sharing(trans, id: DecodedDatabaseIdField) SharingStatus[source]

Gets the current sharing status of the item with the given id.

Makes this item accessible by link. If this item contains other elements they will be publicly accessible too.

publish(trans, id: DecodedDatabaseIdField) SharingStatus[source]

Makes this item publicly accessible. If this item contains other elements they will be publicly accessible too.

unpublish(trans, id: DecodedDatabaseIdField) SharingStatus[source]
share_with_users(trans, id: DecodedDatabaseIdField, payload: ShareWithPayload) ShareWithStatus[source]
class galaxy.webapps.galaxy.services.sharable.SharedItemNotificationFactory[source]

Bases: object

source = 'galaxy_sharing_system'
type_map: Dict[Union[History, StoredWorkflow, Visualization, Page], typing_extensions.Literal[history, workflow, visualization, page]] = {<class 'galaxy.model.History'>: 'history', <class 'galaxy.model.StoredWorkflow'>: 'workflow', <class 'galaxy.model.Visualization'>: 'visualization', <class 'galaxy.model.Page'>: 'page'}
static build_notification_request(item: Union[History, StoredWorkflow, Visualization, Page], users_to_notify: Set[User], status: ShareWithStatus) NotificationCreateRequest[source]

galaxy.webapps.galaxy.services.tools module

class galaxy.webapps.galaxy.services.tools.ToolsService(config: GalaxyAppConfiguration, toolbox_search: ToolBoxSearch, security: IdEncodingHelper, history_manager: HistoryManager)[source]

Bases: ServiceBase

__init__(config: GalaxyAppConfiguration, toolbox_search: ToolBoxSearch, security: IdEncodingHelper, history_manager: HistoryManager)[source]
create_fetch(trans: ProvidesHistoryContext, fetch_payload: Union[FetchDataFormPayload, FetchDataPayload], files: Optional[List[UploadFile]] = None)[source]

galaxy.webapps.galaxy.services.users module

class galaxy.webapps.galaxy.services.users.UsersService(security: IdEncodingHelper, user_manager: UserManager, api_key_manager: ApiKeyManager, user_serializer: UserSerializer, user_deserializer: UserDeserializer, quota_agent: QuotaAgent)[source]

Bases: ServiceBase

Common interface/service logic for interactions with users in the context of the API.

Provides the logic of the actions invoked by API controllers and uses type definitions and pydantic models to declare its parameters and return types.

__init__(security: IdEncodingHelper, user_manager: UserManager, api_key_manager: ApiKeyManager, user_serializer: UserSerializer, user_deserializer: UserDeserializer, quota_agent: QuotaAgent)[source]
recalculate_disk_usage(trans: ProvidesUserContext)[source]
get_api_key(trans: ProvidesUserContext, user_id: int) Optional[APIKeyModel][source]

Returns the current API key or None if the user doesn’t have any valid API key.

get_or_create_api_key(trans: ProvidesUserContext, user_id: int) str[source]

Returns the current API key (as plain string) or creates a new one.

create_api_key(trans: ProvidesUserContext, user_id: int) APIKeyModel[source]

Creates a new API key for the given user

delete_api_key(trans: ProvidesUserContext, user_id: int) None[source]

Deletes a particular API key

get_user(trans: ProvidesUserContext, user_id)[source]
get_non_anonymous_user_full(trans: ProvidesUserContext, user_id: Union[DecodedDatabaseIdField, typing_extensions.Literal[current]], deleted: bool) User[source]
get_user_full(trans: ProvidesUserContext, user_id: Union[DecodedDatabaseIdField, typing_extensions.Literal[current]], deleted: bool) Optional[User][source]
show_user(trans: ProvidesHistoryContext, user_id: Union[DecodedDatabaseIdField, typing_extensions.Literal[current]], deleted: bool) Union[DetailedUserModel, AnonUserModel][source]
user_to_detailed_model(user: User) DetailedUserModel[source]
get_index(trans: ProvidesUserContext, deleted: bool, f_email: Optional[str], f_name: Optional[str], f_any: Optional[str]) List[Union[UserModel, LimitedUserModel]][source]

galaxy.webapps.galaxy.services.visualizations module

class galaxy.webapps.galaxy.services.visualizations.VisualizationsService(security: IdEncodingHelper, manager: VisualizationManager, serializer: VisualizationSerializer, notification_manager: NotificationManager)[source]

Bases: ServiceBase

Common interface/service logic for interactions with visualizations in the context of the API.

Provides the logic of the actions invoked by API controllers and uses type definitions and pydantic models to declare its parameters and return types.

__init__(security: IdEncodingHelper, manager: VisualizationManager, serializer: VisualizationSerializer, notification_manager: NotificationManager)[source]
index(trans, payload: VisualizationIndexQueryPayload, include_total_count: bool = False) Tuple[VisualizationSummaryList, int][source]

Return a list of Visualizations viewable by the user

Return type:

list

Returns:

dictionaries containing Visualization details

galaxy.webapps.galaxy.services.workflows module

class galaxy.webapps.galaxy.services.workflows.WorkflowIndexPayload(*, show_deleted: bool = False, show_hidden: bool = False, show_published: Optional[bool] = None, show_shared: Optional[bool] = None, sort_by: Optional[typing_extensions.Literal[create_time, update_time, name]] = None, sort_desc: Optional[bool] = None, limit: Optional[ConstrainedIntValue] = None, offset: Optional[int] = 0, search: Optional[str] = None, skip_step_counts: bool = False, missing_tools: bool = False)[source]

Bases: WorkflowIndexQueryPayload

missing_tools: bool
class galaxy.webapps.galaxy.services.workflows.WorkflowsService(workflows_manager: WorkflowsManager, workflow_contents_manager: WorkflowContentsManager, serializer: WorkflowSerializer, tool_shed_registry: Registry, notification_manager: NotificationManager)[source]

Bases: ServiceBase

__init__(workflows_manager: WorkflowsManager, workflow_contents_manager: WorkflowContentsManager, serializer: WorkflowSerializer, tool_shed_registry: Registry, notification_manager: NotificationManager)[source]
index(trans: ProvidesUserContext, payload: WorkflowIndexPayload, include_total_count: bool = False) Tuple[List[Dict[str, Any]], Optional[int]][source]
delete(trans, workflow_id)[source]
undelete(trans, workflow_id)[source]
get_versions(trans, workflow_id, instance)[source]
get_workflow_menu(trans, payload)[source]