galaxy.managers package
Classes that manage resources (models, tools, etc.) by using the current Transaction.
Encapsulates the intersection of trans (or trans.sa_session), models, and Controllers.
Responsibilities:
model operations that involve the trans/sa_session (CRUD)
security: ownership, accessibility
common aspect-oriented operations via new mixins: sharable, annotatable, tagable, ratable
Not responsible for:
encoding/decoding ids
any http gobblygook
formatting of returned data (always python structures)
formatting of raised errors
The goal is to have Controllers only handle:
query-string/payload parsing and encoding/decoding ids
http
return formatting
control, improve namespacing in Controllers
DRY for Controller ops (define here - use in both UI/API Controllers)
In other words, ‘Business logic’ independent of web transactions/user context (trans) should be pushed into models - but logic that requires the context trans should be placed under this module.
Submodules
galaxy.managers.annotatable module
Mixins for Annotatable model managers and serializers.
- class galaxy.managers.annotatable.AnnotatableManagerMixin[source]
Bases:
object
- class galaxy.managers.annotatable.AnnotatableSerializerMixin[source]
Bases:
object
- serializers: Dict[str, Serializer]
galaxy.managers.api_keys module
- class galaxy.managers.api_keys.IsUserModel(*args, **kwargs)[source]
Bases:
Protocol
- __init__(*args, **kwargs)
- class galaxy.managers.api_keys.ApiKeyManager(app: BasicSharedApp)[source]
Bases:
object
- __init__(app: BasicSharedApp)[source]
- get_api_key(user: IsUserModel)[source]
- create_api_key(user: IsUserModel)[source]
- get_or_create_api_key(user: IsUserModel) str [source]
- delete_api_key(user: IsUserModel) None [source]
Marks the current user API key as deleted.
galaxy.managers.base module
Keeps the older BaseController security and fetching methods and also defines a base ModelManager, ModelSerializer, and ModelDeserializer.
ModelManagers are used for operations on models that occur outside the scope of a single model object, such as:
object creation
object lookup
interactions between 2+ objects of different model classes
(Since these were to replace model Mixins from web/framework/base/controller.py the rule of thumb used there also generally has been applied here: if it uses the trans or sa_session, put it in a manager and not the model.)
ModelSerializers allow flexible conversion of model objects to dictionaries. They control what keys are sent, how values are simplified, can remap keys, and allow both predefined and user controlled key sets.
ModelDeserializers control how a model validates and process an incoming attribute change to a model object.
- class galaxy.managers.base.ParsedFilter(filter_type, filter, case_insensitive)[source]
Bases:
tuple
- galaxy.managers.base.parsed_filter
alias of
ParsedFilter
- galaxy.managers.base.security_check(trans, item, check_ownership=False, check_accessible=False)[source]
Security checks for an item: checks if (a) user owns item or (b) item is accessible to user. This is a generic method for dealing with objects uniformly from the older controller mixin code - however whenever possible the managers for a particular model should be used to perform security checks.
- galaxy.managers.base.get_class(class_name)[source]
Returns the class object that a string denotes. Without this method, we’d have to do eval(<class_name>).
- galaxy.managers.base.decode_with_security(security: IdEncodingHelper, id: Any, kind: str | None = None)[source]
- galaxy.managers.base.encode_with_security(security: IdEncodingHelper, id: Any, kind: str | None = None)[source]
- galaxy.managers.base.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. This is a generic method for dealing with objects uniformly from the older controller mixin code - however whenever possible the managers for a particular model should be used to load objects.
- class galaxy.managers.base.ModelManager(app: BasicSharedApp)[source]
Bases:
Generic
[U
]Base class for all model/resource managers.
Provides common queries and CRUD operations as a (hopefully) light layer over the ORM.
- __init__(app: BasicSharedApp)[source]
- app: BasicSharedApp
- query(eagerloads: bool = True, filters=None, order_by=None, limit: int | None = None, offset: int | None = None) Query [source]
Return a basic query from model_class, filters, order_by, and limit and offset.
Set eagerloads to False to disable them for this query.
- list(filters=None, order_by=None, limit=None, offset=None, **kwargs)[source]
Returns all objects matching the given filters
- count(filters=None, **kwargs) int [source]
Returns the number of objects matching the given filters.
If the filters include functional filters, this function will raise an exception as they might cause performance issues.
- by_ids(ids, filters=None, **kwargs)[source]
Returns an in-order list of models with the matching ids in ids.
- update(item, new_values, flush=True, **kwargs) U [source]
Given a dictionary of new values, update item and return it.
..note: NO validation or deserialization occurs here.
- class galaxy.managers.base.HasAModelManager(app: MinimalManagerApp, manager=None, **kwargs)[source]
Bases:
Generic
[T
]Mixin used where serializers, deserializers, filter parsers, etc. need some functionality around the model they’re mainly concerned with and would perform that functionality with a manager.
- model_manager_class: Type[T]
the class used to create this serializer’s generically accessible model_manager
- __init__(app: MinimalManagerApp, manager=None, **kwargs)[source]
- app: MinimalManagerApp
- property manager: T
Return an appropriate manager if it exists, instantiate if not.
- exception galaxy.managers.base.ModelSerializingError(err_msg: str | None = None, type='info', **extra_error_info)[source]
Bases:
InternalServerError
Thrown when request model values can’t be serialized
- exception galaxy.managers.base.ModelDeserializingError(err_msg: str | None = None, type='info', **extra_error_info)[source]
Bases:
ObjectAttributeInvalidException
Thrown when an incoming value isn’t usable by the model (bad type, out of range, etc.)
- exception galaxy.managers.base.SkipAttribute[source]
Bases:
Exception
Raise this inside a serializer to prevent the returned dictionary from having a the associated key or value for this attribute.
- class galaxy.managers.base.Serializer(*args, **kwargs)[source]
Bases:
Protocol
- __init__(*args, **kwargs)
- class galaxy.managers.base.ModelSerializer(app: MinimalManagerApp, **kwargs)[source]
Bases:
HasAModelManager
[T
]Turns models into JSONable dicts.
Maintains a map of requestable keys and the Callable() serializer functions that should be called for those keys. E.g. { ‘x’ : lambda item, key: item.x, … }
Note: if a key to serialize is not listed in the Serializer.serializable_keyset or serializers, it will not be returned.
- To serialize call:
my_serializer = MySerializer( app ) … keys_to_serialize = [ ‘id’, ‘name’, ‘attr1’, ‘attr2’, … ] item_dict = MySerializer.serialize( my_item, keys_to_serialize )
- __init__(app: MinimalManagerApp, **kwargs)[source]
Set up serializer map, any additional serializable keys, and views here.
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- add_view(view_name, key_list, include_keys_from=None)[source]
Add the list of serializable attributes key_list to the serializer’s view dictionary under the key view_name.
If include_keys_from is a proper view name, extend key_list by the list in that view.
- serialize(item, keys, **context)[source]
Serialize the model item to a dictionary.
Given model item and the list keys, create and return a dictionary built from each key in keys that also exists in serializers and values of calling the keyed/named serializers on item.
- skip(msg='skipped')[source]
To be called from inside a serializer to skip it.
Handy for config checks, information hiding, etc.
- serialize_id(item: Any, key: str, encode_id=True, **context)[source]
Serialize an id attribute of item.
- serialize_to_view(item, view=None, keys=None, default_view=None, **context)[source]
Use a predefined list of keys (the string view) and any additional keys listed in keys.
- The combinations can be:
view only: return those keys listed in the named view keys only: return those keys listed no view or keys: use the default_view if any view and keys: combine both into one list of keys
- class galaxy.managers.base.ModelValidator[source]
Bases:
object
An object that inspects a dictionary (generally meant to be a set of new/updated values for the model) and raises an error if a value is not acceptable.
- static matches_type(key: str, val: Any, types: type | Tuple[type | Tuple[Any, ...], ...])[source]
Check val against the type (or tuple of types) in types.
- Raises:
exceptions.RequestParameterInvalidException – if not an instance.
- class galaxy.managers.base.Deserializer(*args, **kwargs)[source]
Bases:
Protocol
- __init__(*args, **kwargs)
- class galaxy.managers.base.ModelDeserializer(app: MinimalManagerApp, **kwargs)[source]
Bases:
HasAModelManager
[T
]An object that converts an incoming serialized dict into values that can be directly assigned to an item’s attributes and assigns them.
- validate = <galaxy.managers.base.ModelValidator object>
- app: MinimalManagerApp
- __init__(app: MinimalManagerApp, **kwargs)[source]
Set up deserializers and validator.
- add_deserializers()[source]
Register a map of attribute keys -> functions that will deserialize data into attributes to be assigned to the item.
- deserialize(item, data, flush=True, **context)[source]
Convert an incoming serialized dict into values that can be directly assigned to an item’s attributes and assign them
- class galaxy.managers.base.ModelFilterParser(app: MinimalManagerApp, **kwargs)[source]
Bases:
HasAModelManager
Converts string tuples (partially converted query string params) of attr, op, val into either:
ORM based filters (filters that can be applied by the ORM at the SQL level) or
functional filters (filters that use derived values or values not within the SQL tables)
These filters can then be applied to queries.
This abstraction allows ‘smarter’ application of limit and offset at either the SQL level or the generator/list level based on the presence of functional filters. In other words, if no functional filters are present, limit and offset may be applied at the SQL level. If functional filters are present, limit and offset need to applied at the list level.
These might be safely be replaced in the future by creating SQLAlchemy hybrid properties or more thoroughly mapping derived values.
- parsed_filter
alias of
ParsedFilter
- __init__(app: MinimalManagerApp, **kwargs)[source]
Set up serializer map, any additional serializable keys, and views here.
- date_string_re
regex for testing/dicing iso8601 date strings, with optional time and ms, but allowing only UTC timezone
- fn_filter_parsers: Dict[str, Any]
dictionary containing parsing data for functional filters - applied after a query is made
- build_filter_params(query_params: ValueFilterQueryParams, filter_attr_key: str = 'q', filter_value_key: str = 'qv', attr_op_split_char: str = '-') List[Tuple[str, str, str]] [source]
Builds a list of tuples containing filtering information in the form of (attribute, operator, value).
- parse_query_filters(query_filters: ValueFilterQueryParams)[source]
Convenience function to parse a ValueFilterQueryParams object into a collection of filtering criteria.
- parse_filters(filter_tuple_list)[source]
Parse string 3-tuples (attr, op, val) into orm or functional filters.
- parse_filter(attr, op, val)[source]
Attempt to parse filter as a custom/fn filter, then an orm filter, and if neither work - raise an error.
- Raises:
exceptions.RequestParameterInvalidException – if no functional or orm filter can be parsed.
- UNDERSCORED_OPS = ('lt', 'le', 'eq', 'ne', 'ge', 'gt')
these are the easier/shorter string equivalents to the python operator fn names that need ‘__’ around them
- parse_date(date_string)[source]
Reformats a string containing either seconds from epoch or an iso8601 formated date string into a new date string usable within a filter query.
Seconds from epoch can be a floating point value as well (i.e containing ms).
- contains_non_orm_filter(filters: List[ParsedFilter]) bool [source]
Whether the list of filters contains any non-orm filter.
- galaxy.managers.base.parse_bool(bool_string: str | bool) bool [source]
Parse a boolean from a string.
- class galaxy.managers.base.SortableManager[source]
Bases:
object
A manager interface for parsing order_by strings into actual ‘order by’ queries.
- class galaxy.managers.base.StorageCleanerManager(*args, **kwargs)[source]
Bases:
Protocol
Interface for monitoring storage usage and managing deletion/purging of objects that consume user’s storage space.
- __init__(*args, **kwargs)
- get_discarded_summary(user: User) CleanableItemsSummary [source]
Returns information with the total storage space taken by discarded items for the given user.
Discarded items are those that are deleted but not purged yet.
- get_discarded(user: User, offset: int | None, limit: int | None, order: StoredItemOrderBy | None) List[StoredItem] [source]
Returns a paginated list of items deleted by the given user that are not yet purged.
- get_archived_summary(user: User) CleanableItemsSummary [source]
Returns information with the total storage space taken by archived items for the given user.
Archived items are those that are not currently active. Some archived items may be purged already, but this method does not return information about those.
galaxy.managers.citations module
- class galaxy.managers.citations.CitationsManager(app: BasicSharedApp)[source]
Bases:
object
- __init__(app: BasicSharedApp) None [source]
- galaxy.managers.citations.parse_citation(elem, citation_manager)[source]
Parse an abstract citation entry from the specified XML element.
- class galaxy.managers.citations.BibtexCitation(elem, citation_manager)[source]
Bases:
BaseCitation
galaxy.managers.cloud module
Manager and serializer for cloud-based storages.
- class galaxy.managers.cloud.CloudManager(app: MinimalManagerApp)[source]
Bases:
SharableModelManager
- static configure_provider(provider, credentials)[source]
Given a provider name and required credentials, it configures and returns a cloudbridge connection to the provider.
- Parameters:
provider (string) – the name of cloud-based resource provided. A list of supported providers is given in SUPPORTED_PROVIDERS variable.
credentials (dict) – a dictionary containing all the credentials required to authenticated to the specified provider.
- Return type:
provider specific, e.g., cloudbridge.cloud.providers.aws.provider.AWSCloudProvider for AWS.
- Returns:
a cloudbridge connection to the specified provider.
- get(trans, history_id, bucket_name, objects, authz_id, input_args=None)[source]
Implements the logic of getting a file from a cloud-based storage (e.g., Amazon S3) and persisting it as a Galaxy dataset.
This manager does NOT require use credentials, instead, it uses a more secure method, which leverages CloudAuthz (https://github.com/galaxyproject/cloudauthz) and automatically requests temporary credentials to access the defined resources.
- Parameters:
trans (galaxy.webapps.base.webapp.GalaxyWebTransaction) – Galaxy web transaction
history_id (string) – the (decoded) id of history to which the object should be received to.
bucket_name (string) – the name of a bucket from which data should be fetched (e.g., a bucket name on AWS S3).
objects (list of string) – the name of objects to be fetched.
authz_id (int) – the ID of CloudAuthz to be used for authorizing access to the resource provider. You may get a list of the defined authorizations sending GET to /api/cloud/authz. Also, you can POST to /api/cloud/authz to define a new authorization.
input_args (dict) – a [Optional] a dictionary of input parameters: dbkey, file_type, space_to_tab, to_posix_lines (see galaxy/webapps/galaxy/api/cloud.py)
- Return type:
- Returns:
a list of datasets created for the fetched files.
- send(trans, history_id, bucket_name, authz_id, dataset_ids=None, overwrite_existing=False)[source]
Implements the logic of sending dataset(s) from a given history to a given cloud-based storage (e.g., Amazon S3).
- Parameters:
trans (galaxy.webapps.base.webapp.GalaxyWebTransaction) – Galaxy web transaction
history_id (string) – the (encoded) id of history from which the object should be sent.
bucket_name (string) – the name of a bucket to which data should be sent (e.g., a bucket name on AWS S3).
authz_id (int) – the ID of CloudAuthz to be used for authorizing access to the resource provider. You may get a list of the defined authorizations via /api/cloud/authz. Also, you can use /api/cloud/authz/create to define a new authorization.
dataset_ids (set) – [Optional] The list of (decoded) dataset ID(s) belonging to the given history which should be sent to the given provider. If not provided, Galaxy sends all the datasets belonging to the given history.
overwrite_existing (boolean) – [Optional] If set to “True”, and an object with same name of the dataset to be sent already exist in the bucket, Galaxy replaces the existing object with the dataset to be sent. If set to “False”, Galaxy appends datetime to the dataset name to prevent overwriting the existing object.
- Return type:
- Returns:
A tuple of two lists of labels of the objects that were successfully and unsuccessfully sent to cloud.
the model used for UserShareAssociations with this model
galaxy.managers.cloudauthzs module
Manager and (de)serializer for cloud authorizations (cloudauthzs).
- class galaxy.managers.cloudauthzs.CloudAuthzManager(app: MinimalManagerApp)[source]
Bases:
SharableModelManager
- model_class
alias of
CloudAuthz
the model used for UserShareAssociations with this model
- class galaxy.managers.cloudauthzs.CloudAuthzsSerializer(app, **kwargs)[source]
Bases:
ModelSerializer
Interface/service object for serializing cloud authorizations (cloudauthzs) into dictionaries.
- model_manager_class
alias of
CloudAuthzManager
- __init__(app, **kwargs)[source]
Set up serializer map, any additional serializable keys, and views here.
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- serializers: Dict[str, Serializer]
- app: MinimalManagerApp
- class galaxy.managers.cloudauthzs.CloudAuthzsDeserializer(app: MinimalManagerApp, **kwargs)[source]
Bases:
ModelDeserializer
Service object for validating and deserializing dictionaries that update/alter cloudauthz configurations.
- model_manager_class
alias of
CloudAuthzManager
- add_deserializers()[source]
Register a map of attribute keys -> functions that will deserialize data into attributes to be assigned to the item.
- deserialize_and_validate_authn_id(item, key, val, **context)[source]
Deserializes an authentication ID (authn_id), and asserts if the current user can assume that authentication.
- Parameters:
item (galaxy.model.CloudAuthz) – an instance of cloudauthz
key (string) – authn_id attribute of the cloudauthz object (i.e., the item param).
val (string) – the value of authn_id attribute of the cloudauthz object (i.e., the item param).
context (dict) – a dictionary object containing Galaxy trans.
- Return type:
string
- Returns:
decoded authentication ID.
- app: MinimalManagerApp
- deserializers: Dict[str, Deserializer]
galaxy.managers.collections module
- class galaxy.managers.collections.DatasetCollectionManager(model: GalaxyModelMapping, security: IdEncodingHelper, hda_manager: HDAManager, history_manager: HistoryManager, ldda_manager: LDDAManager, short_term_storage_monitor: ShortTermStorageMonitor)[source]
Bases:
object
Abstraction for interfacing with dataset collections instance - ideally abstracts out model and plugin details.
- ELEMENTS_UNINITIALIZED = <object object>
- __init__(model: GalaxyModelMapping, security: IdEncodingHelper, hda_manager: HDAManager, history_manager: HistoryManager, ldda_manager: LDDAManager, short_term_storage_monitor: ShortTermStorageMonitor)[source]
- precreate_dataset_collection_instance(trans: ProvidesHistoryContext, parent, name, structure, implicit_inputs=None, implicit_output_name=None, tags=None, completed_collection=None)[source]
- precreate_dataset_collection(structure, allow_uninitialized_element=True, completed_collection=None, implicit_output_name=None)[source]
- create(trans: ProvidesHistoryContext, parent, name, collection_type, element_identifiers=None, elements=None, implicit_collection_info=None, trusted_identifiers=None, hide_source_items=False, tags=None, copy_elements=False, history=None, set_hid=True, flush=True, completed_job=None, output_name=None)[source]
PRECONDITION: security checks on ability to add to parent occurred during load.
- create_dataset_collection(trans: ProvidesHistoryContext, collection_type, element_identifiers=None, elements=None, hide_source_items=None, copy_elements=False, history=None)[source]
- get_converters_for_collection(trans: ProvidesHistoryContext, id, datatypes_registry: Registry, instance_type='history')[source]
- delete(trans: ProvidesHistoryContext, instance_type, id, recursive=False, purge=False)[source]
- update(trans: ProvidesHistoryContext, instance_type, id, payload)[source]
- copy(trans: ProvidesHistoryContext, parent, source, encoded_source_id, copy_elements=False, dataset_instance_attributes=None)[source]
PRECONDITION: security checks on ability to add to parent occurred during load.
- match_collections(collections_to_match)[source]
May seem odd to place it here, but planning to grow sophistication and get plugin types involved so it will likely make sense in the future.
- get_dataset_collection_instance(trans: ProvidesHistoryContext, instance_type: typing_extensions.Literal[history], id, **kwds: Any) HistoryDatasetCollectionAssociation [source]
- get_dataset_collection_instance(trans: ProvidesHistoryContext, instance_type: typing_extensions.Literal[library], id, **kwds: Any) LibraryDatasetCollectionAssociation
- get_collection_contents(trans: ProvidesAppContext, parent_id, limit=None, offset=None)[source]
Find first level of collection contents by containing collection parent_id
- write_dataset_collection(request: PrepareDatasetCollectionDownload)[source]
galaxy.managers.collections_util module
galaxy.managers.configuration module
Managers, serializers for Galaxy config file data. ConfigSerializer for all users and a more expanded set of data for admin in AdminConfigSerializer.
Used by both the API and bootstrapped data.
- class galaxy.managers.configuration.ConfigurationManager(app: StructuredApp)[source]
Bases:
object
Interface/service object for interacting with configuration and related data.
- __init__(app: StructuredApp)[source]
- get_configuration(trans: ProvidesUserContext, serialization_params: SerializationParams) Dict[str, Any] [source]
- class galaxy.managers.configuration.ConfigSerializer(app)[source]
Bases:
ModelSerializer
Configuration (galaxy.ini) settings viewable by all users
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- serializers: Dict[str, Serializer]
- model_manager_class: Type[T]
the class used to create this serializer’s generically accessible model_manager
- app: MinimalManagerApp
- class galaxy.managers.configuration.AdminConfigSerializer(app)[source]
Bases:
ConfigSerializer
Configuration attributes viewable only by admin users
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- serializers: Dict[str, Serializer]
- model_manager_class: Type[T]
the class used to create this serializer’s generically accessible model_manager
- app: MinimalManagerApp
galaxy.managers.context module
Interfaces/mixins for transaction-like objects.
These objects describe the context around a unit of work. This unit of work is very broad and can be anything from the response to a web request, the scheduling of a workflow, the reloading the toolbox, etc.. Traditionally, Galaxy has simply passed around a GalaxyWebTransaction object through all layers and large components of the Galaxy app. Having random backend components define explicit dependencies on this however is inappropriate because Galaxy may not be used in all sort of non-web contexts. The future use of message queues and web sockets as well as the decomposition of the backend into packages only further make this heavy reliance on GalaxyWebTransaction inappropriate.
A better approach is for components to annotate their reliance on much narrower, typed views of the GalaxyWebTransaction. This allows explicit declaration of what is being required in the context of a method or class and allows the Python type system to ensure the transaction supplied to the method is appropriate for the context. For instance, an effective use of the type system in this way can prevent the backend work context used to schedule workflow from being supplied to a method that requires an older-style WSGI web response object.
There are various levels of transactions defined in this file - these
include galaxy.managers.context.ProvidesAppContext
,
galaxy.managers.context.ProvidesUserContext
,
and galaxy.managers.context.ProvidesHistoryContext
. Methods
should annotate their dependency on the narrowest context they require.
A method that requires a user but not a history should declare its
trans
argument as requiring type galaxy.managers.context.ProvidesUserContext
.
- class galaxy.managers.context.ProvidesAppContext[source]
Bases:
object
For transaction-like objects to provide Galaxy convenience layer for database and event handling.
Mixed in class must provide app property.
- abstract property app: MinimalManagerApp
Provide access to the Galaxy
app
object.
- abstract property url_builder: Callable[[...], str] | None
Provide access to Galaxy URLs (if available).
- Parameters:
qualified (bool) – if True, the fully qualified URL is returned, else a relative URL is returned (default False).
- property security: IdEncodingHelper
Provide access to Galaxy app’s id encoding helper.
- Return type:
- log_action(user=None, action=None, context=None, params=None)[source]
Application-level logging of user actions.
- log_event(message, tool_id=None, **kwargs)[source]
Application level logging. Still needs fleshing out (log levels and such) Logging events is a config setting - if False, do not log.
- property sa_session: galaxy_scoped_session
Provide access to Galaxy’s SQLAlchemy session.
- Return type:
- property model: ModelMapping
Provide access to Galaxy’s model mapping class.
This is sometimes used for quick access to classes in
galaxy.model
but this is discouraged. Those classes should be imported by the consumer for stronger static checking.This is more proper use for this is accessing the threadbound SQLAlchemy session or engine.
- Return type:
- property install_model: ModelMapping
Provide access to Galaxy’s install mapping.
Comments on the
model
property apply here also.
- class galaxy.managers.context.ProvidesUserContext[source]
Bases:
ProvidesAppContext
For transaction-like objects to provide Galaxy convenience layer for reasoning about users.
Mixed in class must provide user and app properties.
- galaxy_session: GalaxySession | None = None
- property tag_handler
- property async_request_user: RequestUser
- abstract property user
Provide access to the user object.
- property user_vault
Provide access to a user’s personal vault.
- class galaxy.managers.context.ProvidesHistoryContext[source]
Bases:
ProvidesUserContext
For transaction-like objects to provide Galaxy convenience layer for reasoning about histories.
Mixed in class must provide user, history, and app properties.
- abstract property history: History | None
Provide access to the user’s current history model object.
- Return type:
Optional[galaxy.model.History]
- db_dataset_for(dbkey) HistoryDatasetAssociation | None [source]
Optionally return the db_file dataset associated/needed by dataset.
- property db_builds
Returns the builds defined by galaxy and the builds defined by the user (chromInfo in history).
galaxy.managers.datasets module
Manager and Serializer for Datasets.
- class galaxy.managers.datasets.DatasetManager(app: MinimalManagerApp)[source]
Bases:
ModelManager
[Dataset
],AccessibleManagerMixin
,PurgableManagerMixin
Manipulate datasets: the components contained in DatasetAssociations/DatasetInstances/HDAs/LDDAs
- app: MinimalManagerApp
- __init__(app: MinimalManagerApp)[source]
- create(manage_roles=None, access_roles=None, flush=True, **kwargs)[source]
Create and return a new Dataset object.
- purge(dataset, flush=True)[source]
Remove the object_store/file for this dataset from storage and mark as purged.
- Raises:
exceptions.ConfigDoesNotAllowException – if the instance doesn’t allow
- purge_datasets(request: PurgeDatasetsTaskRequest)[source]
Caution: any additional security checks must be done before executing this action.
Completely removes a set of object_store/files associated with the datasets from storage and marks them as purged. They might not be removed if there are still un-purged associations to the dataset.
- is_accessible(item: Any, user: User | None, **kwargs) bool [source]
Is this dataset readable/viewable to user?
- has_access_permission(dataset, user)[source]
Return T/F if the user has role-based access to the dataset.
- compute_hash(request: ComputeDatasetHashTaskRequest)[source]
- class galaxy.managers.datasets.DatasetSerializer(app: MinimalManagerApp, user_manager: UserManager)[source]
Bases:
ModelSerializer
[DatasetManager
],PurgableSerializerMixin
- model_manager_class
alias of
DatasetManager
- __init__(app: MinimalManagerApp, user_manager: UserManager)[source]
Set up serializer map, any additional serializable keys, and views here.
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- serialize_file_name(item, key, user=None, **context)[source]
If the config allows or the user is admin, return the file name of the file that contains this dataset’s data.
- serialize_extra_files_path(item, key, user=None, **context)[source]
If the config allows or the user is admin, return the file path.
- serializers: Dict[str, Serializer]
- app: MinimalManagerApp
- class galaxy.managers.datasets.DatasetAssociationManager(app)[source]
Bases:
ModelManager
[DatasetInstance
],AccessibleManagerMixin
,OwnableManagerMixin
,PurgableManagerMixin
DatasetAssociation/DatasetInstances are intended to be working proxies to a Dataset, associated with either a library or a user/history (HistoryDatasetAssociation).
- app: MinimalManagerApp
- delete(item, flush: bool = True, stop_job: bool = False, **kwargs)[source]
Marks this dataset association as deleted. If stop_job is True, will stop the creating job if all other outputs are deleted.
- stop_creating_job(dataset_assoc, flush=False)[source]
Stops an dataset_assoc’s creating job if all the job’s other outputs are deleted.
- is_composite(dataset_assoc)[source]
Return True if this hda/ldda is a composite type dataset.
Note
see also (whereever we keep information on composite datatypes?)
- extra_files(dataset_assoc)[source]
Return a list of file paths for composite files, an empty list otherwise.
- ensure_can_change_datatype(dataset: DatasetInstance, raiseException: bool = True) bool [source]
- ensure_can_set_metadata(dataset: DatasetInstance, raiseException: bool = True) bool [source]
- detect_datatype(trans, dataset_assoc)[source]
Sniff and assign the datatype to a given dataset association (ldda or hda)
- class galaxy.managers.datasets.DatasetAssociationSerializer(app)[source]
Bases:
_UnflattenedMetadataDatasetAssociationSerializer
[T
]- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- serialize(dataset_assoc, keys, **context)[source]
Override to add metadata as flattened keys on the serialized DatasetInstance.
- serializers: Dict[str, Serializer]
- model_manager_class: Type[T]
the class used to create this serializer’s generically accessible model_manager
- app: MinimalManagerApp
- class galaxy.managers.datasets.DatasetAssociationDeserializer(app: MinimalManagerApp, **kwargs)[source]
Bases:
ModelDeserializer
,PurgableDeserializerMixin
- add_deserializers()[source]
Register a map of attribute keys -> functions that will deserialize data into attributes to be assigned to the item.
- app: MinimalManagerApp
- model_manager_class: Type[T]
the class used to create this serializer’s generically accessible model_manager
- class galaxy.managers.datasets.DatasetAssociationFilterParser(app: MinimalManagerApp, **kwargs)[source]
Bases:
ModelFilterParser
,PurgableFiltersMixin
- eq_datatype(dataset_assoc, class_str)[source]
Is the dataset_assoc datatype equal to the registered datatype class_str?
- isinstance_datatype(dataset_assoc, class_strs)[source]
Is the dataset_assoc datatype derived from any of the registered datatypes in the comma separated string class_strs?
- fn_filter_parsers: Dict[str, Any]
dictionary containing parsing data for functional filters - applied after a query is made
- model_manager_class: Type[T]
the class used to create this serializer’s generically accessible model_manager
- app: MinimalManagerApp
galaxy.managers.datatypes module
- class galaxy.managers.datatypes.DatatypeConverterList(root: RootModelRootType = PydanticUndefined)[source]
Bases:
RootModel
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=List[galaxy.datatypes._schema.DatatypeConverter], required=False, default=[], title='List of data type converters')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class galaxy.managers.datatypes.DatatypeDetails(*, extension: str, description: str | None, description_url: Url[Url] | None, display_in_upload: bool = False, composite_files: List[CompositeFileInfo] | None = None, upload_warning: str | None = None)[source]
Bases:
BaseModel
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'composite_files': FieldInfo(annotation=Union[List[galaxy.datatypes._schema.CompositeFileInfo], NoneType], required=False, default=None, title='Composite files', description='A collection of files composing this data type'), 'description': FieldInfo(annotation=Union[str, NoneType], required=True, title='Description', description='A summary description for this data type'), 'description_url': FieldInfo(annotation=Union[Annotated[pydantic_core._pydantic_core.Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)], NoneType], required=True, title='Description URL', description='The URL to a detailed description for this datatype', examples=['https://wiki.galaxyproject.org/Learn/Datatypes#Bed']), 'display_in_upload': FieldInfo(annotation=bool, required=False, default=False, title='Display in upload', description='If True, the associated file extension will be displayed in the `File Format` select list in the `Upload File from your computer` tool in the `Get Data` tool section of the tool panel'), 'extension': FieldInfo(annotation=str, required=True, title='Extension', description='The data type’s Dataset file extension', examples=['bed']), 'upload_warning': FieldInfo(annotation=Union[str, NoneType], required=False, default=None, title='Upload warning', description='End-user information regarding potential pitfalls with this upload type.')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class galaxy.managers.datatypes.DatatypesCombinedMap(*, datatypes: List[str], datatypes_mapping: DatatypesMap)[source]
Bases:
BaseModel
- datatypes_mapping: DatatypesMap
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'datatypes': FieldInfo(annotation=List[str], required=True, title='Datatypes', description='List of datatypes extensions'), 'datatypes_mapping': FieldInfo(annotation=DatatypesMap, required=True, title='Datatypes Mapping', description="Dictionaries for mapping datatype's extensions/classes with their implementation classes")}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class galaxy.managers.datatypes.DatatypesEDAMDetailsDict(root: RootModelRootType = PydanticUndefined)[source]
Bases:
RootModel
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'root': FieldInfo(annotation=Dict[str, galaxy.datatypes._schema.DatatypeEDAMDetails], required=False, default={}, title='Dict of EDAM details for formats')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class galaxy.managers.datatypes.DatatypesMap(*, ext_to_class_name: Dict[str, str], class_to_classes: Dict[str, Dict[str, bool]])[source]
Bases:
BaseModel
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'class_to_classes': FieldInfo(annotation=Dict[str, Dict[str, bool]], required=True, title='Classes Map', description="Dictionary mapping datatype's classes with their base classes"), 'ext_to_class_name': FieldInfo(annotation=Dict[str, str], required=True, title='Extension Map', description="Dictionary mapping datatype's extensions with implementation classes")}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- galaxy.managers.datatypes.view_index(datatypes_registry: Registry, extension_only: bool | None = True, upload_only: bool | None = True) List[DatatypeDetails] | List[str] [source]
- galaxy.managers.datatypes.view_mapping(datatypes_registry: Registry) DatatypesMap [source]
- galaxy.managers.datatypes.view_types_and_mapping(datatypes_registry: Registry, extension_only: bool | None = True, upload_only: bool | None = True) DatatypesCombinedMap [source]
- galaxy.managers.datatypes.view_converters(datatypes_registry: Registry) DatatypeConverterList [source]
galaxy.managers.deletable module
Many models in Galaxy are not meant to be removed from the database but only marked as deleted. These models have the boolean attribute ‘deleted’.
Other models are deletable and also may be purged. Most often these are models have some backing/supporting resources that can be removed as well (e.g. Datasets have data files on a drive). Purging these models removes the supporting resources as well. These models also have the boolean attribute ‘purged’.
- class galaxy.managers.deletable.DeletableManagerMixin[source]
Bases:
object
A mixin/interface for a model that is deletable (i.e. has a ‘deleted’ attr).
Many resources in Galaxy can be marked as deleted - meaning (in most cases) that they are no longer needed, should not be displayed, or may be actually removed by an admin/script.
- class galaxy.managers.deletable.DeletableDeserializerMixin[source]
Bases:
object
- deserializers: Dict[str, Deserializer]
- class galaxy.managers.deletable.PurgableManagerMixin[source]
Bases:
DeletableManagerMixin
A manager interface/mixin for a resource that allows deleting and purging where purging is often removal of some additional, non-db resource (e.g. a dataset’s file).
- class galaxy.managers.deletable.PurgableSerializerMixin[source]
Bases:
DeletableSerializerMixin
- class galaxy.managers.deletable.PurgableDeserializerMixin[source]
Bases:
DeletableDeserializerMixin
- deserializers: Dict[str, Deserializer] = {}
galaxy.managers.display_applications module
- class galaxy.managers.display_applications.Link(*, name: str)[source]
Bases:
BaseModel
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class galaxy.managers.display_applications.DisplayApplication(*, id: str, name: str, version: str, filename_: str, links: List[Link])[source]
Bases:
BaseModel
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'filename_': FieldInfo(annotation=str, required=True), 'id': FieldInfo(annotation=str, required=True), 'links': FieldInfo(annotation=List[galaxy.managers.display_applications.Link], required=True), 'name': FieldInfo(annotation=str, required=True), 'version': FieldInfo(annotation=str, required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class galaxy.managers.display_applications.ReloadFeedback(*, message: str, reloaded: List[str | None], failed: List[str | None])[source]
Bases:
BaseModel
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'failed': FieldInfo(annotation=List[Union[str, NoneType]], required=True), 'message': FieldInfo(annotation=str, required=True), 'reloaded': FieldInfo(annotation=List[Union[str, NoneType]], required=True)}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class galaxy.managers.display_applications.DisplayApplicationsManager(app: StructuredApp)[source]
Bases:
object
Interface/service object for sharing logic between controllers.
- __init__(app: StructuredApp)[source]
- index() List[DisplayApplication] [source]
Returns the list of display applications.
- Returns:
list of available display applications
- Return type:
galaxy.managers.executables module
Utilities for loading tools and workflows from paths for admin user requests.
galaxy.managers.folders module
Manager and Serializer for Library Folders.
- class galaxy.managers.folders.SecurityParams(user_role_ids: List[Role], security_agent: RBACAgent, is_admin: bool)[source]
Bases:
object
Contains security data bundled for reusability.
- class galaxy.managers.folders.FolderManager[source]
Bases:
object
Interface/service object for interacting with folders.
- get(trans, decoded_folder_id: int, check_manageable: bool = False, check_accessible: bool = True)[source]
Get the folder from the DB.
- Parameters:
decoded_folder_id – decoded folder id
check_manageable – flag whether the check that user can manage item
check_accessible – flag whether to check that user can access item
- Returns:
the requested folder
- Return type:
- Raises:
InconsistentDatabase, RequestParameterInvalidException, InternalServerError
- secure(trans, folder, check_manageable=True, check_accessible=True)[source]
Check if (a) user can manage folder or (b) folder is accessible to user.
- Parameters:
folder (LibraryFolder) – folder item
check_manageable (bool) – flag whether to check that user can manage item
check_accessible (bool) – flag whether to check that user can access item
- Returns:
the original folder
- Return type:
- check_modifyable(trans, folder)[source]
Check whether the user can modify the folder (name and description).
- Returns:
the original folder
- Return type:
- Raises:
AuthenticationRequired, InsufficientPermissionsException
- check_manageable(trans, folder)[source]
Check whether the user can manage the folder.
- Returns:
the original folder
- Return type:
- Raises:
AuthenticationRequired, InsufficientPermissionsException
- check_accessible(trans, folder)[source]
Check whether the folder is accessible to current user. By default every folder is accessible (contents have their own permissions).
- get_folder_dict(trans, folder)[source]
Return folder data in the form of a dictionary.
- Parameters:
folder (LibraryFolder) – folder item
- Returns:
dict with data about the folder
- Return type:
dictionary
- create(trans, parent_folder_id, new_folder_name, new_folder_description='')[source]
Create a new folder under the given folder.
- Parameters:
- Returns:
the new folder
- Return type:
- Raises:
InsufficientPermissionsException
- update(trans, folder, name=None, description=None)[source]
Update the given folder’s name or description.
- Parameters:
folder (LibraryFolder) – the model object
name (str) – new name for the library folder
description (str) – new description for the library folder
- Returns:
the folder
- Return type:
- Raises:
ItemAccessibilityException, InsufficientPermissionsException
- delete(trans, folder, undelete=False)[source]
Mark given folder deleted/undeleted based on the flag.
- Parameters:
folder (LibraryFolder) – the model object
undelete (Bool) – flag whether to delete (when False) or undelete
- Returns:
the folder
- Return type:
- Raises:
ItemAccessibilityException
- get_current_roles(trans, folder)[source]
Find all roles currently connected to relevant permissions on the folder.
- Parameters:
folder (LibraryFolder) – the model object
- Returns:
dict of current roles for all available permission types
- Return type:
dictionary
- can_add_item(trans, folder)[source]
Return true if the user has permissions to add item to the given folder.
- cut_the_prefix(encoded_folder_id)[source]
Remove the prefix from the encoded folder id.
- Parameters:
encoded_folder_id (string) – encoded id of the Folder object with ‘F’ prepended
- Returns:
encoded Folder id without the ‘F’ prefix
- Return type:
string
- Raises:
MalformedId
- decode_folder_id(trans, encoded_folder_id)[source]
Decode the folder id given that it has already lost the prefixed ‘F’.
- Parameters:
encoded_folder_id (string) – encoded id of the Folder object
- Returns:
decoded Folder id
- Return type:
- Raises:
MalformedId
- cut_and_decode(trans, encoded_folder_id)[source]
Cuts the folder prefix (the prepended ‘F’) and returns the decoded id.
- Parameters:
encoded_folder_id (string) – encoded id of the Folder object
- Returns:
decoded Folder id
- Return type:
- get_contents(trans, folder: LibraryFolder, payload: LibraryFolderContentsIndexQueryPayload) Tuple[List[LibraryFolder | LibraryDataset], int] [source]
Retrieves the contents of the given folder that match the provided filters and pagination parameters. Returns a tuple with the list of paginated contents and the total number of items contained in the folder.
- build_folder_path(sa_session: galaxy_scoped_session, folder: LibraryFolder) List[Tuple[int, str | None]] [source]
Returns the folder path from root to the given folder.
The path items are tuples with the name and id of each folder for breadcrumb building purposes.
galaxy.managers.genomes module
galaxy.managers.group_roles module
- class galaxy.managers.group_roles.GroupRolesManager(app: MinimalManagerApp)[source]
Bases:
object
Interface/service object shared by controllers for interacting with group roles.
- __init__(app: MinimalManagerApp) None [source]
- index(trans: ProvidesAppContext, group_id: int) List[GroupRoleAssociation] [source]
Returns a collection roles associated with the given group.
- show(trans: ProvidesAppContext, role_id: int, group_id: int) Role [source]
Returns information about a group role.
- galaxy.managers.group_roles.get_group_role(session: galaxy_scoped_session, group, role) GroupRoleAssociation | None [source]
galaxy.managers.group_users module
- class galaxy.managers.group_users.GroupUsersManager(app: MinimalManagerApp)[source]
Bases:
object
Interface/service object shared by controllers for interacting with group users.
- __init__(app: MinimalManagerApp) None [source]
- index(trans: ProvidesAppContext, group_id: int) List[User] [source]
Returns a collection (list) with some information about users associated with the given group.
- show(trans: ProvidesAppContext, user_id: int, group_id: int) User [source]
Returns information about a group user.
- galaxy.managers.group_users.get_group_user(session: galaxy_scoped_session, user, group) UserGroupAssociation | None [source]
galaxy.managers.groups module
- class galaxy.managers.groups.GroupsManager(app: MinimalManagerApp)[source]
Bases:
object
Interface/service object shared by controllers for interacting with groups.
- __init__(app: MinimalManagerApp) None [source]
- index(trans: ProvidesAppContext)[source]
Displays a collection (list) of groups.
- create(trans: ProvidesAppContext, payload: GroupCreatePayload)[source]
Creates a new group.
- show(trans: ProvidesAppContext, group_id: int)[source]
Displays information about a group.
- update(trans: ProvidesAppContext, group_id: int, payload: GroupUpdatePayload)[source]
Modifies a group.
- delete(trans: ProvidesAppContext, group_id: int)[source]
- purge(trans: ProvidesAppContext, group_id: int)[source]
- undelete(trans: ProvidesAppContext, group_id: int)[source]
- galaxy.managers.groups.get_group_by_name(session: galaxy_scoped_session, name: str)[source]
- galaxy.managers.groups.get_not_deleted_groups(session: galaxy_scoped_session)[source]
galaxy.managers.hdas module
Manager and Serializer for HDAs.
HistoryDatasetAssociations (HDAs) are datasets contained or created in a history.
- exception galaxy.managers.hdas.HistoryDatasetAssociationNoHistoryException[source]
Bases:
Exception
- class galaxy.managers.hdas.HDAManager(app: MinimalManagerApp, user_manager: UserManager, ldda_manager: LDDAManager)[source]
Bases:
DatasetAssociationManager
,OwnableManagerMixin
,AnnotatableManagerMixin
Interface/service object for interacting with HDAs.
- model_class
alias of
HistoryDatasetAssociation
- tag_assoc
- annotation_assoc
- app: MinimalManagerApp
- __init__(app: MinimalManagerApp, user_manager: UserManager, ldda_manager: LDDAManager)[source]
Set up and initialize other managers needed by hdas.
- is_accessible(item: HistoryDatasetAssociation, user: User | None, **kwargs: Any) bool [source]
Override to allow owners (those that own the associated history).
- is_owner(item, user: User | None, current_history=None, **kwargs: Any) bool [source]
Use history to see if current user owns HDA.
- create(flush: bool = True, history=None, dataset=None, *args: Any, **kwargs: Any) HistoryDatasetAssociation [source]
Create a new hda optionally passing in it’s history and dataset.
..note: to explicitly set hid to None you must pass in hid=None, otherwise it will be automatically set.
- materialize(request: MaterializeDatasetInstanceTaskRequest) None [source]
- copy(item: Any, history=None, hide_copy: bool = False, flush: bool = True, **kwargs: Any) HistoryDatasetAssociation [source]
Copy hda, including annotation and tags, add to history and return the given HDA.
- class galaxy.managers.hdas.HDAStorageCleanerManager(hda_manager: HDAManager, dataset_manager: DatasetManager)[source]
Bases:
StorageCleanerManager
- __init__(hda_manager: HDAManager, dataset_manager: DatasetManager)[source]
- get_discarded_summary(user: User) CleanableItemsSummary [source]
Returns information with the total storage space taken by discarded items for the given user.
Discarded items are those that are deleted but not purged yet.
- class galaxy.managers.hdas.HDASerializer(app: StructuredApp)[source]
Bases:
DatasetAssociationSerializer
[HDAManager
],TaggableSerializerMixin
,AnnotatableSerializerMixin
- model_manager_class
alias of
HDAManager
- app: StructuredApp
- __init__(app: StructuredApp)[source]
Set up serializer map, any additional serializable keys, and views here.
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- serialize(hda, keys, user=None, **context)[source]
Override to hide information to users not able to access.
- serialize_display_apps(item, key, trans=None, **context)[source]
Return dictionary containing new-style display app urls.
- class galaxy.managers.hdas.HDADeserializer(app: MinimalManagerApp)[source]
Bases:
DatasetAssociationDeserializer
,TaggableDeserializerMixin
,AnnotatableDeserializerMixin
Interface/service object for validating and deserializing dictionaries into histories.
- model_manager_class
alias of
HDAManager
- __init__(app: MinimalManagerApp)[source]
Set up deserializers and validator.
- add_deserializers()[source]
Register a map of attribute keys -> functions that will deserialize data into attributes to be assigned to the item.
- app: MinimalManagerApp
- class galaxy.managers.hdas.HDAFilterParser(app: MinimalManagerApp, **kwargs)[source]
Bases:
DatasetAssociationFilterParser
,TaggableFilterMixin
,AnnotatableFilterMixin
- model_manager_class
alias of
HDAManager
- model_class
alias of
HistoryDatasetAssociation
- fn_filter_parsers: Dict[str, Any]
dictionary containing parsing data for functional filters - applied after a query is made
- app: MinimalManagerApp
galaxy.managers.hdcas module
Manager and Serializer for HDCAs.
HistoryDatasetCollectionAssociations (HDCAs) are datasets contained or created in a history.
- galaxy.managers.hdcas.stream_dataset_collection(dataset_collection_instance, upstream_mod_zip=False, upstream_gzip=False)[source]
- class galaxy.managers.hdcas.HDCAManager(app: MinimalManagerApp)[source]
Bases:
ModelManager
,AccessibleManagerMixin
,OwnableManagerMixin
,PurgableManagerMixin
,AnnotatableManagerMixin
Interface/service object for interacting with HDCAs.
- model_class
alias of
HistoryDatasetCollectionAssociation
- tag_assoc
- annotation_assoc
alias of
HistoryDatasetCollectionAssociationAnnotationAssociation
- __init__(app: MinimalManagerApp)[source]
Set up and initialize other managers needed by hdas.
- map_datasets(content, fn, *parents)[source]
Iterate over the datasets of a given collection, recursing into collections, and calling fn on each dataset.
Uses the same kwargs as contents above.
- app: BasicSharedApp
- class galaxy.managers.hdcas.DCESerializer(app: StructuredApp)[source]
Bases:
ModelSerializer
Serializer for DatasetCollectionElements.
- __init__(app: StructuredApp)[source]
Set up serializer map, any additional serializable keys, and views here.
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- serializers: Dict[str, Serializer]
- model_manager_class: Type[T]
the class used to create this serializer’s generically accessible model_manager
- app: MinimalManagerApp
- class galaxy.managers.hdcas.DCSerializer(app: StructuredApp, dce_serializer=None)[source]
Bases:
ModelSerializer
Serializer for DatasetCollections.
- __init__(app: StructuredApp, dce_serializer=None)[source]
Set up serializer map, any additional serializable keys, and views here.
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- serializers: Dict[str, Serializer]
- model_manager_class: Type[T]
the class used to create this serializer’s generically accessible model_manager
- app: MinimalManagerApp
- class galaxy.managers.hdcas.DCASerializer(app: StructuredApp, dce_serializer=None)[source]
Bases:
ModelSerializer
Base (abstract) Serializer class for HDCAs and LDCAs.
- app: StructuredApp
- __init__(app: StructuredApp, dce_serializer=None)[source]
Set up serializer map, any additional serializable keys, and views here.
- class galaxy.managers.hdcas.HDCASerializer(app: StructuredApp)[source]
Bases:
DCASerializer
,TaggableSerializerMixin
,AnnotatableSerializerMixin
Serializer for HistoryDatasetCollectionAssociations.
- __init__(app: StructuredApp)[source]
Set up serializer map, any additional serializable keys, and views here.
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- app: StructuredApp
- serializers: Dict[str, Serializer]
- model_manager_class: Type[T]
the class used to create this serializer’s generically accessible model_manager
galaxy.managers.histories module
Manager and Serializer for histories.
Histories are containers for datasets or dataset collections created (or copied) by users over the course of an analysis.
- class galaxy.managers.histories.HistoryManager(app: MinimalManagerApp, hda_manager: HDAManager, contents_manager: HistoryContentsManager, contents_filters: HistoryContentsFilters)[source]
Bases:
SharableModelManager
,PurgableManagerMixin
,SortableManager
alias of
HistoryUserShareAssociation
- tag_assoc
alias of
HistoryTagAssociation
- annotation_assoc
alias of
HistoryAnnotationAssociation
- rating_assoc
alias of
HistoryRatingAssociation
- __init__(app: MinimalManagerApp, hda_manager: HDAManager, contents_manager: HistoryContentsManager, contents_filters: HistoryContentsFilters) None [source]
- index_query(trans: ProvidesUserContext, payload: HistoryIndexQueryPayload, include_total_count: bool = False) Tuple[List[History], int] [source]
- by_user(user: User, current_history: History | None = None, **kwargs: Any) List[History] [source]
Get all the histories for a given user (allowing anon users’ theirs) ordered by update time.
- is_owner(item: Base, user: User | None, current_history: History | None = None, **kwargs: Any) bool [source]
True if the current user is the owner of the given history.
- most_recent(user, filters=None, current_history=None)[source]
Return the most recently update history for the user.
If user is anonymous, return the current history. If the user is anonymous and the current history is deleted, return None.
- purge(history, flush=True, **kwargs)[source]
Purge this history and all HDAs, Collections, and Datasets inside this history.
- parse_order_by(order_by_string, default=None)[source]
Return an ORM compatible order_by using the given string
- non_ready_jobs(history)[source]
Return the currently running job objects associated with this history.
Where running is defined as new, waiting, queued, running, resubmitted, and upload.
- get_ready_history_export_file_path(trans, jeha) str [source]
Serves the history export archive for use as a streaming response so the file doesn’t need to be loaded into memory.
- queue_history_export(trans, history, gzip=True, include_hidden=False, include_deleted=False, directory_uri=None, file_name=None)[source]
- get_sharing_extra_information(trans, item, users: Set[User], errors: Set[str], option: SharingOptions | None = None) ShareHistoryExtra [source]
Returns optional extra information about the datasets of the history that can be accessed by the users.
- make_members_public(trans, item)[source]
Make the non-purged datasets in history public. Performs permissions check.
- archive_history(history: History, archive_export_id: int | None)[source]
Marks the history with the given id as archived and optionally associates it with the given archive export record.
Important: The caller is responsible for passing a valid archive_export_id that belongs to the given history.
- restore_archived_history(history: History, force: bool = False)[source]
Marks the history with the given id as not archived anymore.
Only un-archives the history if it is not associated with an archive export record. You can force the un-archiving in this case by passing force=True.
Please note that histories that are associated with an archive export are usually purged after export, so un-archiving them will not restore the datasets that were in the history before it was archived. You will need to import the archive export record to restore the history and its datasets as a new copy.
- class galaxy.managers.histories.HistoryStorageCleanerManager(history_manager: HistoryManager)[source]
Bases:
StorageCleanerManager
- __init__(history_manager: HistoryManager)[source]
- get_discarded_summary(user: User) CleanableItemsSummary [source]
Returns information with the total storage space taken by discarded items for the given user.
Discarded items are those that are deleted but not purged yet.
- get_discarded(user: User, offset: int | None, limit: int | None, order: StoredItemOrderBy | None) List[StoredItem] [source]
Returns a paginated list of items deleted by the given user that are not yet purged.
- get_archived_summary(user: User) CleanableItemsSummary [source]
Returns information with the total storage space taken by archived items for the given user.
Archived items are those that are not currently active. Some archived items may be purged already, but this method does not return information about those.
- class galaxy.managers.histories.HistoryExportManager(app: MinimalManagerApp, export_tracker: StoreExportTracker)[source]
Bases:
object
- export_object_type = 'history'
- __init__(app: MinimalManagerApp, export_tracker: StoreExportTracker)[source]
- get_task_exports(trans, history_id: int, limit: int | None = None, offset: int | None = None)[source]
Returns task-based exports associated with this history
- get_task_export_by_id(store_export_id: int) StoreExportAssociation [source]
- create_export_association(history_id: int) StoreExportAssociation [source]
- get_record_metadata(export: StoreExportAssociation) ExportObjectMetadata | None [source]
- serialize(trans, history_id: int, jeha: JobExportHistoryArchive) dict [source]
- class galaxy.managers.histories.HistorySerializer(app: MinimalManagerApp, hda_manager: HDAManager, hda_serializer: HDASerializer, history_contents_serializer: HistoryContentsSerializer)[source]
Bases:
SharableModelSerializer
,PurgableSerializerMixin
Interface/service object for serializing histories into dictionaries.
- model_manager_class
alias of
HistoryManager
- __init__(app: MinimalManagerApp, hda_manager: HDAManager, hda_serializer: HDASerializer, history_contents_serializer: HistoryContentsSerializer)[source]
Set up serializer map, any additional serializable keys, and views here.
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- serialize_state_ids(item, key, **context)[source]
Return a dictionary keyed to possible dataset states and valued with lists containing the ids of each HDA in that state.
- serialize_state_counts(item, key, exclude_deleted=True, exclude_hidden=False, **context)[source]
Return a dictionary keyed to possible dataset states and valued with the number of datasets in this history that have those states.
- serialize_history_state(item, key, **context)[source]
Returns the history state based on the states of the HDAs it contains.
- serialize_contents_states(item, key, trans=None, **context)[source]
Return a dictionary containing the counts of all contents in each state keyed by the distinct states.
Note: does not include deleted/hidden contents.
- serialize_contents_active(item, key, **context)[source]
Return a dictionary keyed with ‘deleted’, ‘hidden’, and ‘active’ with values for each representing the count of contents in each state.
Note: counts for deleted and hidden overlap; In other words, a dataset that’s both deleted and hidden will be added to both totals.
- class galaxy.managers.histories.HistoryDeserializer(app: MinimalManagerApp)[source]
Bases:
SharableModelDeserializer
,PurgableDeserializerMixin
Interface/service object for validating and deserializing dictionaries into histories.
- model_manager_class
alias of
HistoryManager
- __init__(app: MinimalManagerApp)[source]
Set up deserializers and validator.
- add_deserializers()[source]
Register a map of attribute keys -> functions that will deserialize data into attributes to be assigned to the item.
- app: MinimalManagerApp
- class galaxy.managers.histories.HistoryFilters(app: MinimalManagerApp, **kwargs)[source]
Bases:
SharableModelFilters
,PurgableFiltersMixin
- model_manager_class
alias of
HistoryManager
- fn_filter_parsers: Dict[str, Any]
dictionary containing parsing data for functional filters - applied after a query is made
- app: MinimalManagerApp
galaxy.managers.history_contents module
Heterogenous lists/contents are difficult to query properly since unions are not easily made.
- class galaxy.managers.history_contents.HistoryContentsManager(app: MinimalManagerApp)[source]
Bases:
SortableManager
- contained_class
alias of
HistoryDatasetAssociation
- contained_class_manager_class
alias of
HDAManager
- contained_class_type_name = 'dataset'
- subcontainer_class
alias of
HistoryDatasetCollectionAssociation
- subcontainer_class_manager_class
alias of
HDCAManager
- subcontainer_class_type_name = 'dataset_collection'
- common_columns = ('history_id', 'history_content_type', 'id', 'type_id', 'hid', 'extension', 'dataset_id', 'collection_id', 'name', 'state', 'object_store_id', 'size', 'deleted', 'purged', 'visible', 'create_time', 'update_time')
- default_order_by = 'hid'
- __init__(app: MinimalManagerApp)[source]
- contents(container, filters=None, limit=None, offset=None, order_by=None, **kwargs)[source]
Returns a list of both/all types of contents, filtered and in some order.
- contents_count(container, filters=None, limit=None, offset=None, order_by=None, **kwargs)[source]
Returns a count of both/all types of contents, based on the given filters.
- contents_query(container, filters=None, limit=None, offset=None, order_by=None, **kwargs)[source]
Returns the contents union query for subqueries, etc.
- parse_order_by(order_by_string, default=None)[source]
Return an ORM compatible order_by using the given string
- state_counts(history)[source]
Return a dictionary containing the counts of all contents in each state keyed by the distinct states.
Note: does not include deleted/hidden contents.
- active_counts(history)[source]
Return a dictionary keyed with ‘deleted’, ‘hidden’, and ‘active’ with values for each representing the count of contents in each state.
Note: counts for deleted and hidden overlap; In other words, a dataset that’s both deleted and hidden will be added to both totals.
- class galaxy.managers.history_contents.HistoryContentsSerializer(app: MinimalManagerApp, **kwargs)[source]
Bases:
ModelSerializer
,PurgableSerializerMixin
Interface/service object for serializing histories into dictionaries.
- model_manager_class
alias of
HistoryContentsManager
- __init__(app: MinimalManagerApp, **kwargs)[source]
Set up serializer map, any additional serializable keys, and views here.
- add_serializers()[source]
Register a map of attribute keys -> serializing functions that will serialize the attribute.
- serialize_id_or_skip(item: Any, key: str, **context)[source]
Serialize id or skip if attribute with key is not present.
- serializers: Dict[str, Serializer]
- app: MinimalManagerApp
- class galaxy.managers.history_contents.HistoryContentsFilters(app: MinimalManagerApp, **kwargs)[source]
Bases:
ModelFilterParser
,AnnotatableFilterMixin
,PurgableFiltersMixin
,GenomeFilterMixin
,TaggableFilterMixin
,ToolFilterMixin
- model_class
alias of
HistoryDatasetAssociation
- parse_query_filters_with_relations(query_filters: ValueFilterQueryParams, history_id)[source]
Parse query filters but consider case where related filter is included.
- get_query_filters_with_relations(query_filters: ValueFilterQueryParams, related_q: str, history_id)[source]
Return query_filters_with_relations changing related:hid to related:[hid1, hid2, …].
- fn_filter_parsers: Dict[str, Any]
dictionary containing parsing data for functional filters - applied after a query is made
- model_manager_class: Type[T]
the class used to create this serializer’s generically accessible model_manager
- app: MinimalManagerApp
galaxy.managers.interactivetool module
- class galaxy.managers.interactivetool.InteractiveToolSqlite(sqlite_filename, encode_id)[source]
Bases:
object
- save(key, key_type, token, host, port, info=None)[source]
Writeout a key, key_type, token, value store that is can be used for coordinating with external resources.
galaxy.managers.jobs module
- class galaxy.managers.jobs.JobLock(*, active: bool)[source]
Bases:
BaseModel
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'active': FieldInfo(annotation=bool, required=True, title='Job lock status', description='If active, jobs will not dispatch')}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
- class galaxy.managers.jobs.JobManager(app: StructuredApp)[source]
Bases:
object
- __init__(app: StructuredApp)[source]
- index_query(trans: ProvidesUserContext, payload: JobIndexQueryPayload) ScalarResult [source]
The caller is responsible for security checks on the resulting job if history_id, invocation_id, or implicit_collection_jobs_id is set. Otherwise this will only return the user’s jobs or all jobs if the requesting user is acting as an admin.
- get_accessible_job(trans: ProvidesUserContext, decoded_job_id) Job [source]
- class galaxy.managers.jobs.JobSearch(sa_session: galaxy_scoped_session, hda_manager: HDAManager, dataset_collection_manager: DatasetCollectionManager, ldda_manager: LDDAManager, id_encoding_helper: IdEncodingHelper)[source]
Bases:
object
Search for jobs using tool inputs or other jobs
- __init__(sa_session: galaxy_scoped_session, hda_manager: HDAManager, dataset_collection_manager: DatasetCollectionManager, ldda_manager: LDDAManager, id_encoding_helper: IdEncodingHelper)[source]
- galaxy.managers.jobs.summarize_invocation_jobs(invocation_id, job_summaries, implicit_collection_job_summaries, invocation_state, invocation_step_states)[source]
- galaxy.managers.jobs.summarize_jobs_to_dict(sa_session, jobs_source) JobsSummary | None [source]
Produce a summary of jobs for job summary endpoints.
- Parameters:
jobs_source (a Job or ImplicitCollectionJobs or None) – the object to summarize
- Return type:
- Returns:
dictionary containing job summary information
- galaxy.managers.jobs.summarize_job_metrics(trans, job)[source]
Produce a dict-ified version of job metrics ready for tabular rendering.
Precondition: the caller has verified the job is accessible to the user represented by the trans parameter.
- galaxy.managers.jobs.summarize_destination_params(trans, job)[source]
Produce a dict-ified version of job destination parameters ready for tabular rendering.
Precondition: the caller has verified the job is accessible to the user represented by the trans parameter.
- galaxy.managers.jobs.summarize_job_parameters(trans, job: Job)[source]
Produce a dict-ified version of job parameters ready for tabular rendering.
Precondition: the caller has verified the job is accessible to the user represented by the trans parameter.
- galaxy.managers.jobs.get_jobs_to_check_at_startup(session: galaxy_scoped_session, track_jobs_in_database: bool, config)[source]
galaxy.managers.lddas module
- class galaxy.managers.lddas.LDDAManager(app: MinimalManagerApp)[source]
Bases:
DatasetAssociationManager
A fairly sparse manager for LDDAs.
- model_class
alias of
LibraryDatasetDatasetAssociation
- __init__(app: MinimalManagerApp)[source]
Set up and initialize other managers needed by lddas.
- get(trans, id: int, check_accessible=True) LibraryDatasetDatasetAssociation [source]
- app: MinimalManagerApp
galaxy.managers.libraries module
Manager and Serializer for libraries.
- class galaxy.managers.libraries.LibraryManager[source]
Bases:
object
Interface/service object for interacting with libraries.
- get(trans, decoded_library_id: int, check_accessible: bool = True) Library [source]
Get the library from the DB.
- Parameters:
- Returns:
the requested library
- Return type:
- create(trans, name: str, description: str | None = '', synopsis: str | None = '') Library [source]
Create a new library.
- update(trans, library: Library, name: str | None = None, description: str | None = None, synopsis: str | None = None) Library [source]
Update the given library
- delete(trans, library: Library, undelete: bool | None = False) Library [source]
Mark given library deleted/undeleted based on the flag.
- list(trans, deleted: bool | None = False) Tuple[Query, Dict[str, Set]] [source]
Return a list of libraries from the DB.
- Parameters:
deleted (boolean (optional)) – if True, show only
deleted
libraries, if False show onlynon-deleted
- Returns:
iterable that will emit all accessible libraries
- Return type:
sqlalchemy ScalarResult
- Returns:
dict of 3 sets with available actions for user’s accessible libraries and a set of ids of all public libraries. These are used for limiting the number of queries when dictifying the libraries later on.
- Return type:
- secure(trans, library: Library, check_accessible: bool = True) Library [source]
Check if library is accessible to user.
- Parameters:
library (galaxy.model.Library) – library
check_accessible (bool) – flag whether to check that user can access library
- Returns:
the original library
- Return type:
- check_accessible(trans, library: Library) Library [source]
Check whether the library is accessible to current user.
- get_library_dict(trans, library: Library, prefetched_ids: Dict[str, Set] | None = None) dict [source]
Return library data in the form of a dictionary.
- Parameters:
library (galaxy.model.Library) – library
prefetched_ids (dict) – dict of 3 sets with available actions for user’s accessible libraries and a set of ids of all public libraries. These are used for limiting the number of queries when dictifying a set of libraries.
- Returns:
dict with data about the library
- Return type:
dictionary
- get_current_roles(trans, library: Library) dict [source]
Load all permissions currently related to the given library.
- Parameters:
library (galaxy.model.Library) – the model object
- Return type:
dictionary
- Returns:
dict of current roles for all available permission types
- get_access_roles(trans, library: Library) Set[Role] [source]
Load access roles for all library permissions
- get_modify_roles(trans, library: Library) Set[Role] [source]
Load modify roles for all library permissions
- get_manage_roles(trans, library: Library) Set[Role] [source]
Load manage roles for all library permissions
- get_add_roles(trans, library: Library) Set[Role] [source]
Load add roles for all library permissions
galaxy.managers.library_datasets module
Manager and Serializer for library datasets.
- class galaxy.managers.library_datasets.LibraryDatasetsManager(app: MinimalManagerApp)[source]
Bases:
DatasetAssociationManager
Interface/service object for interacting with library datasets.
- model_class
alias of
LibraryDatasetDatasetAssociation
- __init__(app: MinimalManagerApp)[source]
- app: MinimalManagerApp
- get(trans, decoded_library_dataset_id, check_accessible=True)[source]
Get the library dataset from the DB.
- Parameters:
- Returns:
the requested library dataset
- Return type:
- update(trans, ld, payload)[source]
Update the given library dataset - the latest linked ldda. Updating older lddas (versions) is not allowed.
- Parameters:
ld (LibraryDataset) – library dataset to change
payload (dict) – dictionary structure containing:: :param name: new ld’s name, must be longer than 0 :type name: str :param misc_info: new ld’s misc info :type misc_info: str :param file_ext: new ld’s extension, must exist in the Galaxy registry :type file_ext: str :param genome_build: new ld’s genome build :type genome_build: str :param tags: list of dataset tags :type tags: list
- Returns:
the changed library dataset
- Return type:
- secure(trans, ld, check_accessible=True, check_ownership=False)[source]
Check if library dataset is accessible to current user or the user is an admin.
- Parameters:
ld (galaxy.model.LibraryDataset) – library dataset
check_accessible (bool) – flag whether to check that user can access library dataset
- Returns:
the original library dataset
- Return type:
- check_accessible(trans, ld)[source]
Check whether the current user has permissions to access library dataset.
- Parameters:
ld (galaxy.model.LibraryDataset) – library dataset
- Returns:
the original library dataset
- Return type:
- Raises:
ObjectNotFound
- check_modifiable(trans, ld)[source]
Check whether the current user has permissions to modify library dataset.
- Parameters:
ld (galaxy.model.LibraryDataset) – library dataset
- Returns:
the original library dataset
- Return type:
- Raises:
ObjectNotFound
galaxy.managers.licenses module
- class galaxy.managers.licenses.LicenseMetadataModel(*, licenseId: str, name: str, reference: str, referenceNumber: int, isDeprecatedLicenseId: bool, isOsiApproved: bool, seeAlso: List[Url[Url]], detailsUrl: Url[Url], recommended: bool, url: Url[Url], spdxUrl: Url[Url])[source]
Bases:
BaseModel
- detailsUrl: Url[Url]
- url: Url[Url]
- spdxUrl: Url[Url]
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'detailsUrl': FieldInfo(annotation=Url, required=True, title='Details URL', description='URL to the SPDX json details for this license', examples=['http://spdx.org/licenses/Apache-2.0.json'], metadata=[UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]), 'isDeprecatedLicenseId': FieldInfo(annotation=bool, required=True, title='Deprecated License', description='True if the entire license is deprecated', examples=[False]), 'isOsiApproved': FieldInfo(annotation=bool, required=True, title='OSI approved', description='Indicates if the [OSI](https://opensource.org/) has approved the license', examples=[True]), 'licenseId': FieldInfo(annotation=str, required=True, title='Identifier', description='SPDX Identifier', examples=['Apache-2.0']), 'name': FieldInfo(annotation=str, required=True, title='Name', description='Full name of the license', examples=['Apache License 2.0']), 'recommended': FieldInfo(annotation=bool, required=True, title='Recommended', description='True if this license is recommended to be used'), 'reference': FieldInfo(annotation=str, required=True, title='Reference', description='Reference to the HTML format for the license file', examples=['./Apache-2.0.html']), 'referenceNumber': FieldInfo(annotation=int, required=True, title='Reference number', description='*Deprecated* - this field is generated and is no longer in use'), 'seeAlso': FieldInfo(annotation=List[Annotated[pydantic_core._pydantic_core.Url, UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]], required=True, title='Reference URLs', description='Cross reference URL pointing to additional copies of the license'), 'spdxUrl': FieldInfo(annotation=Url, required=True, title='SPDX URL', examples=['https://spdx.org/licenses/Apache-2.0.html'], metadata=[UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)]), 'url': FieldInfo(annotation=Url, required=True, title='URL', description='License URL', examples=['http://www.apache.org/licenses/LICENSE-2.0'], metadata=[UrlConstraints(max_length=2083, allowed_schemes=['http', 'https'], host_required=None, default_host=None, default_port=None, default_path=None)])}
Metadata about the fields defined on the model, mapping of field names to [FieldInfo][pydantic.fields.FieldInfo].
This replaces Model.__fields__ from Pydantic V1.
galaxy.managers.markdown_parse module
Utilities for parsing “Galaxy Flavored Markdown”.
See markdown_util.py for loading objects and interacting with the rest of Galaxy. This file is meant to be relatively self contained and just used to “parse” and validate Galaxy Markdown. Keeping things isolated to allow re-use of these utilities in other projects (e.g. gxformat2).
galaxy.managers.markdown_util module
Utilities defining “Galaxy Flavored Markdown”.
This is an extension of markdown designed to allow rendering Galaxy object references.
The core “Galaxy Flavored Markdown” format should just reference objects by encoded IDs - but preprocessing should allow for instance workflow objects to be referenced relative to the workflow (inputs, outputs, steps, etc..) and potential history flavor would allow objects to be referenced by HID. This second idea is unimplemented, it is just an example of the general concept of context specific processing.
- galaxy.managers.markdown_util.internal_galaxy_markdown_to_pdf(trans, internal_galaxy_markdown: str, document_type: PdfDocumentType) bytes [source]
- galaxy.managers.markdown_util.ready_galaxy_markdown_for_export(trans, internal_galaxy_markdown)[source]
Fill in details needed to render Galaxy flavored markdown.
Take it from a minimal internal version to an externally render-able version with more details populated and actual IDs replaced with encoded IDs to render external links. Return expanded markdown and extra data useful for rendering custom container tags.
- galaxy.managers.markdown_util.ready_galaxy_markdown_for_import(trans, external_galaxy_markdown)[source]
Convert from encoded IDs to decoded numeric IDs for storing in the DB.
- galaxy.managers.markdown_util.resolve_invocation_markdown(trans, invocation, workflow_markdown)[source]
Resolve invocation objects to convert markdown to ‘internal’ representation.
Replace references to abstract workflow parts with actual galaxy object IDs corresponding to the actual executed workflow. For instance:
convert output=name -to- history_dataset_id=<id> | history_dataset_collection_id=<id> convert input=name -to- history_dataset_id=<id> | history_dataset_collection_id=<id> convert step=name -to- job_id=<id>
Also expand/convert workflow invocation specific container sections into actual Galaxy markdown - these containers include: invocation_inputs, invocation_outputs, invocation_workflow. Hopefully this list will be expanded to include invocation_qc.
galaxy.managers.metrics module
- class galaxy.managers.metrics.Metric(*, namespace: str, time: str, level: int, args: str)[source]
Bases:
BaseModel
- model_computed_fields: ClassVar[dict[str, ComputedFieldInfo]] = {}
A dictionary of computed field names and their corresponding ComputedFieldInfo objects.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- model_fields: ClassVar[dict[str, FieldInfo]] = {'args': FieldInfo(annotation=str, required=True, title='Arguments', description='A JSON string containing an array of extra data.'), 'level': FieldInfo(annotation=int, required=True, title='Level', description="An integer representing the metric's log level."), 'namespace': FieldInfo(annotation=str, required=True, title='Namespace', description='Label indicating