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.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
galaxy.managers.api_keys module¶
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.
-
galaxy.managers.base.
parsed_filter
¶ alias of
galaxy.managers.base.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: galaxy.security.idencoding.IdEncodingHelper, id: Any)[source]¶
-
galaxy.managers.base.
encode_with_security
(security: galaxy.security.idencoding.IdEncodingHelper, id: Any)[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.
-
galaxy.managers.base.
munge_lists
(listA, listB)[source]¶ Combine two lists into a single list.
(While allowing them to be None, non-lists, or lists.)
-
class
galaxy.managers.base.
ModelManager
(app: galaxy.structured_app.BasicApp)[source]¶ Bases:
object
Base class for all model/resource managers.
Provides common queries and CRUD operations as a (hopefully) light layer over the ORM.
-
__init__
(app: galaxy.structured_app.BasicApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
app
: galaxy.structured_app.BasicApp¶
-
query
(eagerloads=True, **kwargs)[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
-
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)[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: galaxy.structured_app.MinimalManagerApp, manager=None, **kwargs)[source]¶ Bases:
object
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[object]¶ the class used to create this serializer’s generically accessible model_manager
-
__init__
(app: galaxy.structured_app.MinimalManagerApp, manager=None, **kwargs)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
property
manager
¶ Return an appropriate manager if it exists, instantiate if not.
-
-
exception
galaxy.managers.base.
ModelSerializingError
(err_msg=None, type='info', **extra_error_info)[source]¶ Bases:
galaxy.exceptions.InternalServerError
Thrown when request model values can’t be serialized
-
exception
galaxy.managers.base.
ModelDeserializingError
(err_msg=None, type='info', **extra_error_info)[source]¶ Bases:
galaxy.exceptions.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.
ModelSerializer
(app: galaxy.structured_app.MinimalManagerApp, **kwargs)[source]¶ Bases:
galaxy.managers.base.HasAModelManager
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 )
-
static
url_for
(*args, **kwargs) → str¶ ‘service’ to use for getting urls - use class var to allow overriding when testing
-
__init__
(app: galaxy.structured_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_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.
ModelDeserializer
(app: galaxy.structured_app.MinimalManagerApp, validator=None, **kwargs)[source]¶ Bases:
galaxy.managers.base.HasAModelManager
An object that converts an incoming serialized dict into values that can be directly assigned to an item’s attributes and assigns them.
-
__init__
(app: galaxy.structured_app.MinimalManagerApp, validator=None, **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
-
default_deserializer
(item, key, val, **context)[source]¶ If the incoming val is different than the item value change it and, in either case, return the value.
-
-
class
galaxy.managers.base.
ModelValidator
(app, *args, **kwargs)[source]¶ Bases:
galaxy.managers.base.HasAModelManager
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.
-
__init__
(app, *args, **kwargs)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
type
(key, val, types)[source]¶ Check val against the type (or tuple of types) in types.
- Raises
exceptions.RequestParameterInvalidException – if not an instance.
-
-
class
galaxy.managers.base.
ModelFilterParser
(app: galaxy.structured_app.MinimalManagerApp, **kwargs)[source]¶ Bases:
galaxy.managers.base.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
galaxy.managers.base.ParsedFilter
-
__init__
(app: galaxy.structured_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, Dict]¶ dictionary containing parsing data for functional filters - applied after a query is made
-
build_filter_params
(query_params: galaxy.schema.FilterQueryParams, 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: galaxy.schema.FilterQueryParams)[source]¶ Convenience function to parse a FilterQueryParams 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
-
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.
ServiceBase
(security: galaxy.security.idencoding.IdEncodingHelper)[source]¶ Bases:
object
Base class with common logic and utils reused by other Services.
-
__init__
(security: galaxy.security.idencoding.IdEncodingHelper)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
decode_id
(id: galaxy.schema.fields.EncodedDatabaseIdField) → int[source]¶ Decodes a previously encoded database ID.
-
encode_id
(id: int) → galaxy.schema.fields.EncodedDatabaseIdField[source]¶ Encodes a raw database ID.
-
decode_ids
(ids: List[galaxy.schema.fields.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: galaxy.managers.base.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.
-
galaxy.managers.citations module¶
-
class
galaxy.managers.citations.
CitationsManager
(app: galaxy.structured_app.BasicApp)[source]¶ Bases:
object
-
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]¶
galaxy.managers.cloud module¶
Manager and serializer for cloud-based storages.
-
class
galaxy.managers.cloud.
CloudManager
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.sharable.SharableModelManager
-
model_class
¶ alias of
galaxy.model.History
-
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
list of galaxy.model.Dataset
- 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: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.sharable.SharableModelManager
-
model_class
¶ alias of
galaxy.model.CloudAuthz
the model used for UserShareAssociations with this model
-
-
class
galaxy.managers.cloudauthzs.
CloudAuthzsSerializer
(app, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelSerializer
Interface/service object for serializing cloud authorizations (cloudauthzs) into dictionaries.
-
model_manager_class
¶
-
__init__
(app, **kwargs)[source]¶ Set up serializer map, any additional serializable keys, and views here.
-
-
class
galaxy.managers.cloudauthzs.
CloudAuthzsDeserializer
(app: galaxy.structured_app.MinimalManagerApp, validator=None, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelDeserializer
Service object for validating and deserializing dictionaries that update/alter cloudauthz configurations.
-
model_manager_class
¶
-
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.
-
galaxy.managers.collections module¶
-
class
galaxy.managers.collections.
DatasetCollectionManager
(model: galaxy.model.mapping.GalaxyModelMapping, security: galaxy.security.idencoding.IdEncodingHelper, hda_manager: galaxy.managers.hdas.HDAManager, history_manager: galaxy.managers.histories.HistoryManager, tag_handler: galaxy.model.tags.GalaxyTagHandler, ldda_manager: galaxy.managers.lddas.LDDAManager)[source]¶ Bases:
object
Abstraction for interfacing with dataset collections instance - ideally abstracts out model and plugin details.
-
ELEMENTS_UNINITIALIZED
= <object object>¶
-
__init__
(model: galaxy.model.mapping.GalaxyModelMapping, security: galaxy.security.idencoding.IdEncodingHelper, hda_manager: galaxy.managers.hdas.HDAManager, history_manager: galaxy.managers.histories.HistoryManager, tag_handler: galaxy.model.tags.GalaxyTagHandler, ldda_manager: galaxy.managers.lddas.LDDAManager)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
precreate_dataset_collection_instance
(trans, parent, name, structure, implicit_inputs=None, implicit_output_name=None, tags=None, completed_collection=None)[source]¶
-
precreate_dataset_collection
(structure, allow_unitialized_element=True, completed_collection=None, implicit_output_name=None)[source]¶
-
create
(trans, 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, collection_type, element_identifiers=None, elements=None, hide_source_items=None, copy_elements=False, history=None)[source]¶
-
get_converters_for_collection
(trans, id, datatypes_registry: galaxy.datatypes.registry.Registry, instance_type='history')[source]¶
-
copy
(trans, 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.
-
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: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
object
Interface/service object for interacting with configuration and related data.
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
get_configuration
(trans: galaxy.managers.context.ProvidesUserContext, serialization_params: Dict[str, Optional[Union[str, List]]]) → Dict[str, Any][source]¶
-
decode_id
(encoded_id: galaxy.schema.fields.EncodedDatabaseIdField) → Dict[str, int][source]¶
-
-
class
galaxy.managers.configuration.
ConfigSerializer
(app)[source]¶ Bases:
galaxy.managers.base.ModelSerializer
Configuration (galaxy.ini) settings viewable by all users
-
class
galaxy.managers.configuration.
AdminConfigSerializer
(app)[source]¶ Bases:
galaxy.managers.configuration.ConfigSerializer
Configuration attributes viewable only by admin users
galaxy.managers.containers module¶
Manager mixins to unify the interface into things that can contain: Datasets and other (nested) containers.
(e.g. DatasetCollections, Histories, LibraryFolders)
-
class
galaxy.managers.containers.
ContainerManagerMixin
[source]¶ Bases:
object
- A class that tracks/contains two types of items:
some non-container object (such as datasets)
other sub-containers nested within this one
Levels of nesting are not considered here; In other words, each of the methods below only work on the first level of nesting.
-
class
galaxy.managers.containers.
LibraryFolderAsContainerManagerMixin
[source]¶ Bases:
galaxy.managers.containers.ContainerManagerMixin
-
contained_class
¶ alias of
galaxy.model.LibraryDataset
-
subcontainer_class
¶ alias of
galaxy.model.LibraryFolder
-
order_contents_on
= operator.attrgetter('create_time')¶
-
-
class
galaxy.managers.containers.
DatasetCollectionAsContainerManagerMixin
[source]¶ Bases:
galaxy.managers.containers.ContainerManagerMixin
-
contained_class
¶
-
subcontainer_class
¶ alias of
galaxy.model.DatasetCollection
-
order_contents_on
= operator.attrgetter('element_index')¶
-
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
¶ Provide access to the Galaxy
app
object.
-
abstract property
url_builder
¶ 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
¶ 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
¶ Provide access to Galaxy’s SQLAlchemy session.
- Return type
sqlalchemy.orm.scoping.scoped_session
-
property
model
¶ 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
¶ Provide access to Galaxy’s install mapping.
Comments on the
model
property apply here also.
-
abstract property
-
class
galaxy.managers.context.
ProvidesUserContext
[source]¶ Bases:
galaxy.managers.context.ProvidesAppContext
For transaction-like objects to provide Galaxy convenience layer for reasoning about users.
Mixed in class must provide user and app properties.
-
abstract property
user
¶ Provide access to the user object.
-
property
anonymous
¶
-
get_current_user_roles
() → List[galaxy.model.Role][source]¶
-
property
user_is_admin
¶
-
property
user_is_bootstrap_admin
¶ Master key provided so there is no real user
-
property
user_can_do_run_as
¶
-
property
user_is_active
¶
-
check_user_activation
()[source]¶ If user activation is enabled and the user is not activated throw an exception.
-
property
user_ftp_dir
¶
-
abstract property
-
class
galaxy.managers.context.
ProvidesHistoryContext
[source]¶ Bases:
galaxy.managers.context.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
¶ Provide access to the user’s current history model object.
- Return type
Optional[galaxy.model.History]
-
db_dataset_for
(dbkey) → Optional[galaxy.model.HistoryDatasetAssociation][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).
-
abstract property
galaxy.managers.datasets module¶
Manager and Serializer for Datasets.
-
class
galaxy.managers.datasets.
DatasetManager
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.base.ModelManager
,galaxy.managers.secured.AccessibleManagerMixin
,galaxy.managers.deletable.PurgableManagerMixin
Manipulate datasets: the components contained in DatasetAssociations/DatasetInstances/HDAs/LDDAs
-
model_class
¶ alias of
galaxy.model.Dataset
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
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
-
has_access_permission
(dataset, user)[source]¶ Return T/F if the user has role-based access to the dataset.
-
app
: galaxy.structured_app.BasicApp¶
-
-
class
galaxy.managers.datasets.
DatasetSerializer
(app: galaxy.structured_app.MinimalManagerApp, user_manager: galaxy.managers.users.UserManager)[source]¶ Bases:
galaxy.managers.base.ModelSerializer
,galaxy.managers.deletable.PurgableSerializerMixin
-
model_manager_class
¶
-
__init__
(app: galaxy.structured_app.MinimalManagerApp, user_manager: galaxy.managers.users.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
(dataset, 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.
-
-
class
galaxy.managers.datasets.
DatasetAssociationManager
(app)[source]¶ Bases:
galaxy.managers.base.ModelManager
,galaxy.managers.secured.AccessibleManagerMixin
,galaxy.managers.deletable.PurgableManagerMixin
DatasetAssociation/DatasetInstances are intended to be working proxies to a Dataset, associated with either a library or a user/history (HistoryDatasetAssociation).
-
model_class
¶ alias of
galaxy.model.DatasetInstance
-
stop_creating_job
(dataset_assoc)[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.
-
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:
galaxy.managers.datasets._UnflattenedMetadataDatasetAssociationSerializer
-
add_serializers
()[source]¶ Register a map of attribute keys -> serializing functions that will serialize the attribute.
-
-
class
galaxy.managers.datasets.
DatasetAssociationDeserializer
(app: galaxy.structured_app.MinimalManagerApp, validator=None, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelDeserializer
,galaxy.managers.deletable.PurgableDeserializerMixin
-
add_deserializers
()[source]¶ Register a map of attribute keys -> functions that will deserialize data into attributes to be assigned to the item.
-
-
class
galaxy.managers.datasets.
DatasetAssociationFilterParser
(app: galaxy.structured_app.MinimalManagerApp, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelFilterParser
,galaxy.managers.deletable.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?
-
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.
PurgableManagerMixin
[source]¶ Bases:
galaxy.managers.deletable.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).
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.
FolderManager
[source]¶ Bases:
object
Interface/service object for interacting with folders.
-
get
(trans, decoded_folder_id, check_manageable=False, check_accessible=True)[source]¶ Get the folder from the DB.
- Parameters
- 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
-
-
class
galaxy.managers.folders.
FoldersService
(app: galaxy.structured_app.StructuredApp, folder_manager: galaxy.managers.folders.FolderManager, role_manager: galaxy.managers.roles.RoleManager)[source]¶ Bases:
object
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__
(app: galaxy.structured_app.StructuredApp, folder_manager: galaxy.managers.folders.FolderManager, role_manager: galaxy.managers.roles.RoleManager) → None[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
show
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField) → galaxy.schema.schema.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
-
create
(trans, encoded_parent_folder_id: galaxy.schema.fields.EncodedDatabaseIdField, payload: galaxy.schema.schema.CreateLibraryFolderPayload) → galaxy.schema.schema.LibraryFolderDetails[source]¶ Create a new folder object underneath the one specified in the parameters.
- Parameters
encoded_parent_folder_id (an encoded id string (should be prefixed by 'F')) – (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, encoded_folder_id: galaxy.schema.fields.EncodedDatabaseIdField, scope: Optional[galaxy.schema.schema.LibraryPermissionScope] = <LibraryPermissionScope.current: 'current'>, page: Optional[int] = 1, page_limit: Optional[int] = 10, query: Optional[str] = None) → Union[galaxy.schema.schema.LibraryFolderCurrentPermissions, galaxy.schema.schema.LibraryAvailablePermissions][source]¶ Load all permissions for the given folder id and return it.
- Parameters
encoded_folder_id (an encoded id string) – 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, encoded_folder_id: galaxy.schema.fields.EncodedDatabaseIdField, payload: dict) → galaxy.schema.schema.LibraryFolderCurrentPermissions[source]¶ Set permissions of the given folder to the given role ids.
- Parameters
encoded_folder_id (an encoded id string) – 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, encoded_folder_id: galaxy.schema.fields.EncodedDatabaseIdField, undelete: Optional[bool] = False) → galaxy.schema.schema.LibraryFolderDetails[source]¶ DELETE /api/folders/{encoded_folder_id}
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
encoded_folder_id (an encoded id string) – 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, encoded_folder_id: galaxy.schema.fields.EncodedDatabaseIdField, payload: galaxy.schema.schema.UpdateLibraryFolderPayload) → galaxy.schema.schema.LibraryFolderDetails[source]¶ Update the folder defined by an
encoded_folder_id
with the data in the payload.Note
Currently, only admin users can update library folders. Also the folder must not be deleted.
- param id
the encoded id of the folder
- type id
an encoded id string
- 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.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: galaxy.structured_app.MinimalManagerApp, user_manager: galaxy.managers.users.UserManager)[source]¶ Bases:
galaxy.managers.datasets.DatasetAssociationManager
,galaxy.managers.secured.OwnableManagerMixin
,galaxy.managers.taggable.TaggableManagerMixin
,galaxy.managers.annotatable.AnnotatableManagerMixin
Interface/service object for interacting with HDAs.
-
model_class
¶
-
tag_assoc
¶ alias of
galaxy.model.HistoryDatasetAssociationTagAssociation
-
annotation_assoc
¶ alias of
galaxy.model.HistoryDatasetAssociationAnnotationAssociation
-
__init__
(app: galaxy.structured_app.MinimalManagerApp, user_manager: galaxy.managers.users.UserManager)[source]¶ Set up and initialize other managers needed by hdas.
-
is_accessible
(hda, user, **kwargs)[source]¶ Override to allow owners (those that own the associated history).
-
is_owner
(hda, user, current_history=None, **kwargs)[source]¶ Use history to see if current user owns HDA.
-
create
(history=None, dataset=None, flush=True, **kwargs)[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.
-
copy
(hda, history=None, hide_copy=False, flush=True, **kwargs)[source]¶ Copy hda, including annotation and tags, add to history and return the given HDA.
-
-
class
galaxy.managers.hdas.
HDASerializer
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.datasets.DatasetAssociationSerializer
,galaxy.managers.taggable.TaggableSerializerMixin
,galaxy.managers.annotatable.AnnotatableSerializerMixin
-
model_manager_class
¶ alias of
galaxy.managers.hdas.HDAManager
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[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
(hda, key, trans=None, **context)[source]¶ Return dictionary containing new-style display app urls.
-
serialize_old_display_applications
(hda, key, trans=None, **context)[source]¶ Return dictionary containing old-style display app urls.
-
-
class
galaxy.managers.hdas.
HDADeserializer
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.datasets.DatasetAssociationDeserializer
,galaxy.managers.taggable.TaggableDeserializerMixin
,galaxy.managers.annotatable.AnnotatableDeserializerMixin
Interface/service object for validating and deserializing dictionaries into histories.
-
model_manager_class
¶ alias of
galaxy.managers.hdas.HDAManager
-
-
class
galaxy.managers.hdas.
HDAFilterParser
(app: galaxy.structured_app.MinimalManagerApp, **kwargs)[source]¶ Bases:
galaxy.managers.datasets.DatasetAssociationFilterParser
,galaxy.managers.taggable.TaggableFilterMixin
,galaxy.managers.annotatable.AnnotatableFilterMixin
-
model_manager_class
¶ alias of
galaxy.managers.hdas.HDAManager
-
model_class
¶
-
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: galaxy.structured_app.BasicApp)[source]¶ Bases:
galaxy.managers.base.ModelManager
,galaxy.managers.secured.AccessibleManagerMixin
,galaxy.managers.secured.OwnableManagerMixin
,galaxy.managers.deletable.PurgableManagerMixin
,galaxy.managers.taggable.TaggableManagerMixin
,galaxy.managers.annotatable.AnnotatableManagerMixin
Interface/service object for interacting with HDCAs.
-
model_class
¶
-
tag_assoc
¶ alias of
galaxy.model.HistoryDatasetCollectionTagAssociation
-
annotation_assoc
¶ alias of
galaxy.model.HistoryDatasetCollectionAssociationAnnotationAssociation
-
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
: galaxy.structured_app.BasicApp¶
-
-
class
galaxy.managers.hdcas.
DCESerializer
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.base.ModelSerializer
Serializer for DatasetCollectionElements.
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Set up serializer map, any additional serializable keys, and views here.
-
-
class
galaxy.managers.hdcas.
DCSerializer
(app: galaxy.structured_app.MinimalManagerApp, dce_serializer=None)[source]¶ Bases:
galaxy.managers.base.ModelSerializer
Serializer for DatasetCollections.
-
__init__
(app: galaxy.structured_app.MinimalManagerApp, dce_serializer=None)[source]¶ Set up serializer map, any additional serializable keys, and views here.
-
-
class
galaxy.managers.hdcas.
DCASerializer
(app: galaxy.structured_app.MinimalManagerApp, dce_serializer=None)[source]¶ Bases:
galaxy.managers.base.ModelSerializer
Base (abstract) Serializer class for HDCAs and LDCAs.
-
__init__
(app: galaxy.structured_app.MinimalManagerApp, dce_serializer=None)[source]¶ Set up serializer map, any additional serializable keys, and views here.
-
-
class
galaxy.managers.hdcas.
HDCASerializer
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.hdcas.DCASerializer
,galaxy.managers.taggable.TaggableSerializerMixin
,galaxy.managers.annotatable.AnnotatableSerializerMixin
Serializer for HistoryDatasetCollectionAssociations.
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Set up serializer map, any additional serializable keys, and views here.
-
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.
HDABasicInfo
(*, id: galaxy.schema.fields.EncodedDatabaseIdField, name: str)[source]¶ Bases:
pydantic.main.BaseModel
-
class
galaxy.managers.histories.
HistoryManager
(app: galaxy.structured_app.MinimalManagerApp, hda_manager: galaxy.managers.hdas.HDAManager, contents_manager: galaxy.managers.history_contents.HistoryContentsManager, contents_filters: galaxy.managers.history_contents.HistoryContentsFilters)[source]¶ Bases:
galaxy.managers.sharable.SharableModelManager
,galaxy.managers.deletable.PurgableManagerMixin
,galaxy.managers.base.SortableManager
-
model_class
¶ alias of
galaxy.model.History
-
tag_assoc
¶ alias of
galaxy.model.HistoryTagAssociation
-
annotation_assoc
¶
-
rating_assoc
¶
-
__init__
(app: galaxy.structured_app.MinimalManagerApp, hda_manager: galaxy.managers.hdas.HDAManager, contents_manager: galaxy.managers.history_contents.HistoryContentsManager, contents_filters: galaxy.managers.history_contents.HistoryContentsFilters)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
by_user
(user, current_history=None, **kwargs)[source]¶ Get all the histories for a given user (allowing anon users’ theirs) ordered by update time.
-
is_owner
(history, user, current_history=None, **kwargs)[source]¶ True if the current user is the owner of the given history.
-
most_recent
(user, filters=None, current_history=None, **kwargs)[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.
-
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[galaxy.model.User], errors: Set[str], option: Optional[galaxy.managers.sharable.SharingOptions] = None) → Optional[galaxy.managers.sharable.ShareWithExtra][source]¶ Returns optional extra information about the datasets of the history that can be accessed by the users.
-
-
class
galaxy.managers.histories.
HistoryExportView
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
object
-
class
galaxy.managers.histories.
HistorySerializer
(app: galaxy.structured_app.MinimalManagerApp, hda_manager: galaxy.managers.hdas.HDAManager, hda_serializer: galaxy.managers.hdas.HDASerializer, history_contents_serializer: galaxy.managers.history_contents.HistoryContentsSerializer)[source]¶ Bases:
galaxy.managers.sharable.SharableModelSerializer
,galaxy.managers.deletable.PurgableSerializerMixin
Interface/service object for serializing histories into dictionaries.
-
model_manager_class
¶
-
__init__
(app: galaxy.structured_app.MinimalManagerApp, hda_manager: galaxy.managers.hdas.HDAManager, hda_serializer: galaxy.managers.hdas.HDASerializer, history_contents_serializer: galaxy.managers.history_contents.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
(history, 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
(history, 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
(history, key, **context)[source]¶ Returns the history state based on the states of the HDAs it contains.
-
serialize_contents_states
(history, 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
(history, 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: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.sharable.SharableModelDeserializer
,galaxy.managers.deletable.PurgableDeserializerMixin
Interface/service object for validating and deserializing dictionaries into histories.
-
model_manager_class
¶
-
-
class
galaxy.managers.histories.
HistoryFilters
(app: galaxy.structured_app.MinimalManagerApp, **kwargs)[source]¶ Bases:
galaxy.managers.sharable.SharableModelFilters
,galaxy.managers.deletable.PurgableFiltersMixin
-
model_class
¶ alias of
galaxy.model.History
-
model_manager_class
¶
-
-
class
galaxy.managers.histories.
HistoriesService
(security: galaxy.security.idencoding.IdEncodingHelper, manager: galaxy.managers.histories.HistoryManager, user_manager: galaxy.managers.users.UserManager, serializer: galaxy.managers.histories.HistorySerializer, deserializer: galaxy.managers.histories.HistoryDeserializer, citations_manager: galaxy.managers.citations.CitationsManager, history_export_view: galaxy.managers.histories.HistoryExportView, filters: galaxy.managers.histories.HistoryFilters)[source]¶ Bases:
galaxy.managers.base.ServiceBase
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: galaxy.security.idencoding.IdEncodingHelper, manager: galaxy.managers.histories.HistoryManager, user_manager: galaxy.managers.users.UserManager, serializer: galaxy.managers.histories.HistorySerializer, deserializer: galaxy.managers.histories.HistoryDeserializer, citations_manager: galaxy.managers.citations.CitationsManager, history_export_view: galaxy.managers.histories.HistoryExportView, filters: galaxy.managers.histories.HistoryFilters)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
index
(trans, serialization_params: Dict[str, Optional[Union[str, List]]], filter_query_params: galaxy.schema.FilterQueryParams, deleted_only: Optional[bool] = False, all_histories: 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, payload: galaxy.schema.schema.CreateHistoryPayload, serialization_params: Dict[str, Optional[Union[str, List]]])[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.
-
show
(trans, serialization_params: Dict[str, Optional[Union[str, List]]], history_id: Optional[galaxy.schema.fields.EncodedDatabaseIdField] = 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
id (an optional encoded id string) – the encoded id of the history to query or None to use the most recently used
serialization_params (dictionary) – contains the optional view, keys and default_view for serialization
- Return type
dictionary
- Returns
detailed history information
-
update
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField, payload, serialization_params: Dict[str, Optional[Union[str, List]]])[source]¶ Updates the values for the history with the given
id
- Parameters
id (str) – the encoded id of the history to update
payload (dict) –
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 (dictionary) – contains the optional view, keys and default_view for serialization
- Return type
- 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, history_id: galaxy.schema.fields.EncodedDatabaseIdField, serialization_params: Dict[str, Optional[Union[str, List]]], 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.- Parameters
serialization_params (dictionary) – contains the optional view, keys and default_view for serialization
- Return type
- Returns
the deleted or purged history
-
undelete
(trans, history_id: galaxy.schema.fields.EncodedDatabaseIdField, serialization_params: Dict[str, Optional[Union[str, List]]])[source]¶ Undelete history (that hasn’t been purged) with the given
id
Return all histories that are shared with the current user. The results can be filtered.
-
published
(trans, serialization_params: Dict[str, Optional[Union[str, List]]], filter_query_params: galaxy.schema.FilterQueryParams)[source]¶ Return all histories that are published. The results can be filtered.
-
citations
(trans, history_id)[source]¶ Return all the citations for the tools used to produce the datasets in the history.
-
index_exports
(trans, id)[source]¶ Get previous history exports (to links). Effectively returns serialized JEHA objects.
-
archive_export
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField, payload: galaxy.schema.schema.ExportHistoryArchivePayload) → Union[galaxy.schema.schema.JobExportHistoryArchive, galaxy.schema.schema.JobIdResponse][source]¶ start job (if needed) to create history export for corresponding history.
-
archive_download
(trans, id, jeha_id)[source]¶ If ready and available, return raw contents of exported history.
-
get_custom_builds_metadata
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField) → galaxy.schema.schema.CustomBuildsMetadataResponse[source]¶ Returns meta data for custom builds.
-
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: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.containers.ContainerManagerMixin
,galaxy.managers.base.SortableManager
-
root_container_class
¶ alias of
galaxy.model.History
-
contained_class
¶
-
contained_class_manager_class
¶ alias of
galaxy.managers.hdas.HDAManager
-
contained_class_type_name
= 'dataset'¶
-
subcontainer_class
¶
-
subcontainer_class_manager_class
¶ alias of
galaxy.managers.hdcas.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', 'deleted', 'purged', 'visible', 'create_time', 'update_time')¶
-
default_order_by
: Optional[str] = 'hid'¶ how any contents lists produced are ordered - (string) attribute name to sort on or tuple of attribute names
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
contained
(container, filters=None, limit=None, offset=None, order_by=None, **kwargs)[source]¶ Returns non-subcontainer objects within container.
-
subcontainers
(container, filters=None, limit=None, offset=None, order_by=None, **kwargs)[source]¶ Returns only the containers within container.
-
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: galaxy.structured_app.MinimalManagerApp, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelSerializer
,galaxy.managers.deletable.PurgableSerializerMixin
Interface/service object for serializing histories into dictionaries.
-
model_manager_class
¶ alias of
galaxy.managers.history_contents.HistoryContentsManager
-
__init__
(app: galaxy.structured_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.
-
-
class
galaxy.managers.history_contents.
HistoryContentsFilters
(app: galaxy.structured_app.MinimalManagerApp, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelFilterParser
,galaxy.managers.annotatable.AnnotatableFilterMixin
,galaxy.managers.deletable.PurgableFiltersMixin
,galaxy.managers.taggable.TaggableFilterMixin
,galaxy.managers.tools.ToolFilterMixin
-
model_class
¶
-
galaxy.managers.interactivetool module¶
-
class
galaxy.managers.interactivetool.
InteractiveToolSqlite
(sqlite_filename, encode_id)[source]¶ Bases:
object
-
__init__
(sqlite_filename, encode_id)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
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.
JobManager
(app: galaxy.structured_app.StructuredApp)[source]¶ Bases:
object
-
__init__
(app: galaxy.structured_app.StructuredApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
job_lock
() → galaxy.managers.jobs.JobLock[source]¶
-
update_job_lock
(job_lock: galaxy.managers.jobs.JobLock)[source]¶
-
-
class
galaxy.managers.jobs.
JobSearch
(sa_session: sqlalchemy.orm.scoping.scoped_session, hda_manager: galaxy.managers.hdas.HDAManager, dataset_collection_manager: galaxy.managers.collections.DatasetCollectionManager, ldda_manager: galaxy.managers.lddas.LDDAManager, id_encoding_helper: galaxy.security.idencoding.IdEncodingHelper)[source]¶ Bases:
object
Search for jobs using tool inputs or other jobs
-
__init__
(sa_session: sqlalchemy.orm.scoping.scoped_session, hda_manager: galaxy.managers.hdas.HDAManager, dataset_collection_manager: galaxy.managers.collections.DatasetCollectionManager, ldda_manager: galaxy.managers.lddas.LDDAManager, id_encoding_helper: galaxy.security.idencoding.IdEncodingHelper)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
-
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)[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)[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.
summarize_job_outputs
(job: galaxy.model.Job, tool, params, security)[source]¶
galaxy.managers.lddas module¶
-
class
galaxy.managers.lddas.
LDDAManager
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.datasets.DatasetAssociationManager
A fairly sparse manager for LDDAs.
-
model_class
¶
-
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, check_accessible=True)[source]¶ Get the library from the DB.
- Parameters
- Returns
the requested library
- Return type
-
update
(trans, library, name=None, description=None, synopsis=None)[source]¶ Update the given library
-
delete
(trans, library, undelete=False)[source]¶ Mark given library deleted/undeleted based on the flag.
-
list
(trans, deleted: Optional[bool] = False)[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
query that will emit all accessible libraries
- Return type
sqlalchemy query
- 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, check_accessible=True)[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
-
get_library_dict
(trans, library, prefetched_ids=None)[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)[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
-
-
galaxy.managers.libraries.
get_containing_library_from_library_dataset
(trans, library_dataset)[source]¶ Given a library_dataset, get the containing library
-
class
galaxy.managers.libraries.
LibrariesService
(folder_manager: galaxy.managers.folders.FolderManager, library_manager: galaxy.managers.libraries.LibraryManager, role_manager: galaxy.managers.roles.RoleManager)[source]¶ Bases:
object
Interface/service object for sharing logic between controllers.
-
__init__
(folder_manager: galaxy.managers.folders.FolderManager, library_manager: galaxy.managers.libraries.LibraryManager, role_manager: galaxy.managers.roles.RoleManager)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
index
(trans: galaxy.managers.context.ProvidesAppContext, deleted: Optional[bool] = False) → galaxy.schema.schema.LibrarySummaryList[source]¶ Returns a list of summary data for all libraries.
- Parameters
deleted (boolean (optional)) – if True, show only
deleted
libraries, if False show onlynon-deleted
- Returns
list of dictionaries containing library information
- Return type
-
show
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField) → galaxy.schema.schema.LibrarySummary[source]¶ Returns detailed information about a library.
- Parameters
id (an encoded id string) – the encoded id of the library
deleted (boolean) – if True, allow information on a
deleted
library
- Returns
detailed library information
- Return type
- Raises
MalformedId, ObjectNotFound
-
create
(trans, payload: galaxy.schema.schema.CreateLibraryPayload) → galaxy.schema.schema.LibrarySummary[source]¶ Creates a new library.
Note
Currently, only admin users can create libraries.
- Parameters
payload (dict) – dictionary structure containing:: :param name: (required) the new library’s name :type name: str :param description: the new library’s description :type description: str :param synopsis: the new library’s synopsis :type synopsis: str
- Returns
detailed library information
- Return type
- Raises
RequestParameterMissingException
-
update
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField, payload: galaxy.schema.schema.UpdateLibraryPayload) → galaxy.schema.schema.LibrarySummary[source]¶ Updates the library defined by an
encoded_id
with the data in the payload.Note
Currently, only admin users can update libraries. Also the library must not be deleted.
- param id
the encoded id of the library
- type id
an encoded id string
- param payload
dictionary structure containing:: :param name: new library’s name, cannot be empty :type name: str :param description: new library’s description :type description: str :param synopsis: new library’s synopsis :type synopsis: str
- type payload
dict
- returns
detailed library information
- rtype
dict
- raises
RequestParameterMissingException
-
delete
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField, undelete: Optional[bool] = False) → galaxy.schema.schema.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
id (an encoded id string) – the encoded id of the library to un/delete
undelete (bool) – (optional) flag specifying whether the item should be deleted or undeleted, defaults to false:
- Returns
detailed library information
- Return type
dictionary
-
get_permissions
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField, scope: Optional[galaxy.schema.schema.LibraryPermissionScope] = <LibraryPermissionScope.current: 'current'>, is_library_access: Optional[bool] = False, page: Optional[int] = 1, page_limit: Optional[int] = 10, query: Optional[str] = None) → Union[galaxy.schema.schema.LibraryCurrentPermissions, galaxy.schema.schema.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: galaxy.schema.fields.EncodedDatabaseIdField, payload: Dict[str, Any]) → Union[galaxy.schema.schema.LibraryLegacySummary, galaxy.schema.schema.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) → galaxy.schema.schema.LibraryLegacySummary[source]¶ * old implementation for backward compatibility *
Updates the library permissions.
-
galaxy.managers.library_datasets module¶
Manager and Serializer for library datasets.
-
class
galaxy.managers.library_datasets.
LibraryDatasetsManager
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.datasets.DatasetAssociationManager
Interface/service object for interacting with library datasets.
-
model_class
¶
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
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[pydantic.networks.HttpUrl], detailsUrl: pydantic.networks.HttpUrl, recommended: bool, url: pydantic.networks.HttpUrl, spdxUrl: pydantic.networks.HttpUrl)[source]¶ Bases:
pydantic.main.BaseModel
-
seeAlso
: List[pydantic.networks.HttpUrl]¶
-
detailsUrl
: pydantic.networks.HttpUrl¶
-
url
: pydantic.networks.HttpUrl¶
-
spdxUrl
: pydantic.networks.HttpUrl¶
-
-
class
galaxy.managers.licenses.
LicensesManager
[source]¶ Bases:
object
-
get_licenses
() → List[galaxy.managers.licenses.LicenseMetadataModel][source]¶
-
get_license_by_id
(id: str) → galaxy.managers.licenses.LicenseMetadataModel[source]¶
-
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, document_type) → 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.pages module¶
Manager and Serializers for Pages.
Pages are markup created and saved by users that can contain Galaxy objects (such as datasets) and are often used to describe or present an analysis from within Galaxy.
-
class
galaxy.managers.pages.
PageContentFormat
(value)[source]¶ -
An enumeration.
-
markdown
= 'markdown'¶
-
html
= 'html'¶
-
-
class
galaxy.managers.pages.
PageSummaryBase
(*, title: str, slug: galaxy.managers.pages.ConstrainedStrValue)[source]¶ Bases:
pydantic.main.BaseModel
-
class
galaxy.managers.pages.
CreatePagePayload
(*, title: str, slug: galaxy.managers.pages.ConstrainedStrValue, content_format: galaxy.managers.pages.PageContentFormat = <PageContentFormat.html: 'html'>, content: str = '', annotation: str = None, invocation_id: galaxy.schema.fields.EncodedDatabaseIdField = None, **extra_data: Any)[source]¶ Bases:
galaxy.managers.pages.PageSummaryBase
-
content_format
: galaxy.managers.pages.PageContentFormat¶
-
invocation_id
: Optional[galaxy.schema.fields.EncodedDatabaseIdField]¶
-
-
class
galaxy.managers.pages.
PageSummary
(*, title: str, slug: galaxy.managers.pages.ConstrainedStrValue, id: galaxy.schema.fields.EncodedDatabaseIdField, model_class: str, username: str, published: bool, importable: bool, deleted: bool, latest_revision_id: galaxy.schema.fields.EncodedDatabaseIdField, revision_ids: List[galaxy.schema.fields.EncodedDatabaseIdField])[source]¶ Bases:
galaxy.managers.pages.PageSummaryBase
-
latest_revision_id
: galaxy.schema.fields.EncodedDatabaseIdField¶
-
revision_ids
: List[galaxy.schema.fields.EncodedDatabaseIdField]¶
-
-
class
galaxy.managers.pages.
PageDetails
(*, title: str, slug: galaxy.managers.pages.ConstrainedStrValue, id: galaxy.schema.fields.EncodedDatabaseIdField, model_class: str, username: str, published: bool, importable: bool, deleted: bool, latest_revision_id: galaxy.schema.fields.EncodedDatabaseIdField, revision_ids: List[galaxy.schema.fields.EncodedDatabaseIdField], content_format: galaxy.managers.pages.PageContentFormat = <PageContentFormat.html: 'html'>, content: str = '', generate_version: str = None, generate_time: str = None, **extra_data: Any)[source]¶ Bases:
galaxy.managers.pages.PageSummary
-
content_format
: galaxy.managers.pages.PageContentFormat¶
-
-
class
galaxy.managers.pages.
PageSummaryList
(*, __root__: List[galaxy.managers.pages.PageSummary] = [])[source]¶ Bases:
pydantic.main.BaseModel
-
class
galaxy.managers.pages.
PagesService
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
object
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__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
index
(trans, deleted: bool = False) → galaxy.managers.pages.PageSummaryList[source]¶ Return a list of Pages viewable by the user
- Parameters
deleted – Display deleted pages
- Return type
- Returns
dictionaries containing summary or detailed Page information
-
create
(trans, payload: galaxy.managers.pages.CreatePagePayload) → galaxy.managers.pages.PageSummary[source]¶ Create a page and return Page summary
-
delete
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField)[source]¶ Deletes a page (or marks it as deleted)
-
show
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField) → galaxy.managers.pages.PageDetails[source]¶ View a page summary and the content of the latest revision
- Parameters
id – ID of page to be displayed
- Return type
- Returns
Dictionary return of the Page.to_dict call with the ‘content’ field populated by the most recent revision
-
show_pdf
(trans, id: galaxy.schema.fields.EncodedDatabaseIdField)[source]¶ View a page summary and the content of the latest revision as PDF.
- Parameters
id – ID of page to be displayed
- Return type
- Returns
Dictionary return of the Page.to_dict call with the ‘content’ field populated by the most recent revision
-
-
class
galaxy.managers.pages.
PageManager
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.sharable.SharableModelManager
,galaxy.model.item_attrs.UsesAnnotations
Provides operations for managing a Page.
-
model_class
¶ alias of
galaxy.model.Page
-
tag_assoc
¶ alias of
galaxy.model.PageTagAssociation
-
annotation_assoc
¶
-
rating_assoc
¶ alias of
galaxy.model.PageRatingAssociation
-
-
class
galaxy.managers.pages.
PageSerializer
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.sharable.SharableModelSerializer
Interface/service object for serializing pages into dictionaries.
-
model_manager_class
¶ alias of
galaxy.managers.pages.PageManager
-
-
class
galaxy.managers.pages.
PageDeserializer
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.sharable.SharableModelDeserializer
Interface/service object for validating and deserializing dictionaries into pages.
-
model_manager_class
¶ alias of
galaxy.managers.pages.PageManager
-
-
class
galaxy.managers.pages.
PageContentProcessor
(trans, render_embed_html_fn: Callable)[source]¶ Bases:
html.parser.HTMLParser
Processes page content to produce HTML that is suitable for display. For now, processor renders embedded objects.
-
bare_ampersand
= re.compile('&(?!#\\d+;|#x[0-9a-fA-F]+;|\\w+;)')¶
-
elements_no_end_tag
= {'area', 'base', 'basefont', 'br', 'col', 'command', 'embed', 'frame', 'hr', 'img', 'input', 'isindex', 'keygen', 'link', 'meta', 'param', 'source', 'track', 'wbr'}¶
-
__init__
(trans, render_embed_html_fn: Callable)[source]¶ Initialize and reset this instance.
If convert_charrefs is True (the default), all character references are automatically converted to the corresponding Unicode characters.
-
feed
(data)[source]¶ Feed data to the parser.
Call this as often as you want, with as little or as much text as you want (may include ‘n’).
-
handle_starttag
(tag, attrs)[source]¶ Called for each start tag
attrs is a list of (attr, value) tuples, e.g. for <pre class=’screen’>, tag=’pre’, attrs=[(‘class’, ‘screen’)]
-
-
galaxy.managers.pages.
placeholderRenderForEdit
(trans: galaxy.managers.context.ProvidesHistoryContext, item_class, item_id)[source]¶
-
galaxy.managers.pages.
placeholderRenderForSave
(trans: galaxy.managers.context.ProvidesHistoryContext, item_class, item_id, encode=False)[source]¶
galaxy.managers.ratable module¶
Mixins for Ratable model managers and serializers.
-
class
galaxy.managers.ratable.
RatableManagerMixin
[source]¶ Bases:
object
-
rating_assoc
: Type[galaxy.model.ItemRatingAssociation]¶
-
-
class
galaxy.managers.ratable.
RatableSerializerMixin
[source]¶ Bases:
object
galaxy.managers.rbac_secured module¶
-
exception
galaxy.managers.rbac_secured.
RBACPermissionFailedException
(err_msg=None, type='info', **extra_error_info)[source]¶
-
class
galaxy.managers.rbac_secured.
RBACPermission
(app)[source]¶ Bases:
object
Base class for wrangling/controlling the permissions ORM models (Permissions, Roles) that control which users can perform certain actions on their associated models (Libraries, Datasets).
-
permission_failed_error_class
¶ alias of
galaxy.managers.rbac_secured.RBACPermissionFailedException
-
-
class
galaxy.managers.rbac_secured.
DatasetRBACPermission
(app)[source]¶ Bases:
galaxy.managers.rbac_secured.RBACPermission
Base class for the manage and access RBAC permissions used by dataset security.
The DatasetPermissions used by the RBAC agent are associations between a Dataset and a single Role.
DatasetPermissions are typed (but not polymorphic themselves) by a string ‘action’. There are two types:
manage permissions : can a role manage the permissions on a dataset
access : can a role read/look at/copy a dataset
-
permissions_class
¶ alias of
galaxy.model.DatasetPermissions
-
action_name
= None¶
-
exception
galaxy.managers.rbac_secured.
DatasetManagePermissionFailedException
(err_msg=None, type='info', **extra_error_info)[source]¶ Bases:
galaxy.managers.rbac_secured.RBACPermissionFailedException
-
class
galaxy.managers.rbac_secured.
ManageDatasetRBACPermission
(app)[source]¶ Bases:
galaxy.managers.rbac_secured.DatasetRBACPermission
A class that controls the dataset permissions that control who can manage that dataset’s permissions.
When checking permissions for a user, if any of the user’s roles have permission on the dataset
-
action_name
= 'manage permissions'¶
-
permission_failed_error_class
¶ alias of
galaxy.managers.rbac_secured.DatasetManagePermissionFailedException
-
-
exception
galaxy.managers.rbac_secured.
DatasetAccessPermissionFailedException
(err_msg=None, type='info', **extra_error_info)[source]¶ Bases:
galaxy.managers.rbac_secured.RBACPermissionFailedException
-
class
galaxy.managers.rbac_secured.
AccessDatasetRBACPermission
(app)[source]¶ Bases:
galaxy.managers.rbac_secured.DatasetRBACPermission
A class to manage access permissions on a dataset.
An user must have all the Roles of all the access permissions associated with a dataset in order to access it.
-
action_name
= 'access'¶
-
permission_failed_error_class
¶ alias of
galaxy.managers.rbac_secured.DatasetAccessPermissionFailedException
-
galaxy.managers.roles module¶
Manager and Serializer for Roles.
-
class
galaxy.managers.roles.
RoleManager
(app: galaxy.structured_app.BasicApp)[source]¶ Bases:
galaxy.managers.base.ModelManager
Business logic for roles.
-
model_class
¶ alias of
galaxy.model.Role
-
user_assoc
¶ alias of
galaxy.model.UserRoleAssociation
-
group_assoc
¶ alias of
galaxy.model.GroupRoleAssociation
-
get
(trans: galaxy.managers.context.ProvidesUserContext, decoded_role_id)[source]¶ Method loads the role from the DB based on the given role id.
- Parameters
decoded_role_id (int) – id of the role to load from the DB
- Returns
the loaded Role object
- Return type
- Raises
InconsistentDatabase, RequestParameterInvalidException, InternalServerError
-
list_displayable_roles
(trans: galaxy.managers.context.ProvidesUserContext)[source]¶
-
create_role
(trans: galaxy.managers.context.ProvidesUserContext, role_definition_model) → galaxy.model.Role[source]¶
-
app
: galaxy.structured_app.BasicApp¶
-
galaxy.managers.secured module¶
Accessible models can be read and copied but not modified or deleted.
Owned models can be modified and deleted.
-
class
galaxy.managers.secured.
AccessibleManagerMixin
[source]¶ Bases:
object
A security interface to check if a User can read/view an item’s.
This can also be thought of as ‘read but not modify’ privileges.
-
get_accessible
(id, user, **kwargs)[source]¶ Return the item with the given id if it’s accessible to user, otherwise raise an error.
-
error_unless_accessible
(item, user, **kwargs)[source]¶ Raise an error if the item is NOT accessible to user, otherwise return the item.
-
-
class
galaxy.managers.secured.
OwnableManagerMixin
[source]¶ Bases:
object
A security interface to check if a User is an item’s owner.
Some resources are associated with the User that created or imported them and these Users can be considered the models’ owner.
This can also be thought of as write/edit privileges.
-
get_owned
(id, user, **kwargs)[source]¶ Return the item with the given id if owned by the user, otherwise raise an error.
- Raises
-
error_unless_owner
(item, user, **kwargs)[source]¶ Raise an error if the item is NOT owned by user, otherwise return the item.
-
galaxy.managers.session module¶
-
class
galaxy.managers.session.
GalaxySessionManager
(model: galaxy.model.base.SharedModelMapping)[source]¶ Bases:
object
Manages GalaxySession.
-
__init__
(model: galaxy.model.base.SharedModelMapping)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
galaxy.managers.sharable module¶
Superclass Manager and Serializers for Sharable objects.
- A sharable Galaxy object:
has an owner/creator User is sharable with other, specific Users is importable (copyable) by users that have access has a slug which can be used as a link to view the resource can be published effectively making it available to all other Users can be rated
-
class
galaxy.managers.sharable.
SharingOptions
(value)[source]¶ -
Options for sharing resources that may have restricted access to all or part of their contents.
-
make_public
= 'make_public'¶
-
no_changes
= 'no_changes'¶
-
Bases:
pydantic.main.BaseModel
Bases:
object
Bases:
pydantic.main.BaseModel
-
class
galaxy.managers.sharable.
SetSlugPayload
(*, new_slug: str)[source]¶ Bases:
pydantic.main.BaseModel
-
class
galaxy.managers.sharable.
UserEmail
(*, id: galaxy.schema.fields.EncodedDatabaseIdField, email: str)[source]¶ Bases:
pydantic.main.BaseModel
-
class
galaxy.managers.sharable.
SharingStatus
(*, id: galaxy.schema.fields.EncodedDatabaseIdField, title: str, importable: bool, published: bool, users_shared_with: List[galaxy.managers.sharable.UserEmail] = [], username_and_slug: str = None)[source]¶ Bases:
pydantic.main.BaseModel
-
class
galaxy.managers.sharable.
SharableModelManager
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.base.ModelManager
,galaxy.managers.secured.OwnableManagerMixin
,galaxy.managers.secured.AccessibleManagerMixin
,galaxy.managers.taggable.TaggableManagerMixin
,galaxy.managers.annotatable.AnnotatableManagerMixin
,galaxy.managers.ratable.RatableManagerMixin
the model used for UserShareAssociations with this model
-
SINGLE_CHAR_ABBR
: Optional[str] = None¶ the single character abbreviation used in username_and_slug: e.g. ‘h’ for histories: u/user/h/slug
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
by_user
(user, filters=None, **kwargs)[source]¶ Return list for all items (of model_class type) associated with the given user.
-
is_owner
(item, user, **kwargs)[source]¶ Return true if this sharable belongs to user (or user is an admin).
-
is_accessible
(item, user, **kwargs)[source]¶ If the item is importable, is owned by user, or (the valid) user is in ‘users shared with’ list for the item: return True.
-
make_importable
(item, flush=True)[source]¶ Makes item accessible–viewable and importable–and sets item’s slug. Does not flush/commit changes, however. Item must have name, user, importable, and slug attributes.
-
make_non_importable
(item, flush=True)[source]¶ Makes item accessible–viewable and importable–and sets item’s slug. Does not flush/commit changes, however. Item must have name, user, importable, and slug attributes.
Get the UserShareAssociations for the item.
Optionally send in user to test for a single match.
Get or create a share for the given user.
Delete a user share from the database.
Return a list of those models shared with a particular user.
-
get_sharing_extra_information
(trans, item, users: Set[galaxy.model.User], errors: Set[str], option: Optional[galaxy.managers.sharable.SharingOptions] = None) → Optional[galaxy.managers.sharable.ShareWithExtra][source]¶ Returns optional extra information about the shareability of the given item.
This function should be overridden in the particular manager class that wants to provide the extra information, otherwise, it will be None by default.
-
make_members_public
(trans, item)[source]¶ Make potential elements of this item public.
This method must be overridden in managers that need to change permissions of internal elements contained associated with the given item.
-
update_current_sharing_with_users
(item, new_users_shared_with: Set[galaxy.model.User], flush=True)[source]¶ Updates the currently list of users this item is shared with by adding new users and removing missing ones.
-
class
galaxy.managers.sharable.
SharableModelSerializer
(app, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelSerializer
,galaxy.managers.taggable.TaggableSerializerMixin
,galaxy.managers.annotatable.AnnotatableSerializerMixin
,galaxy.managers.ratable.RatableSerializerMixin
-
__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.
Returns a list of encoded ids for users the item has been shared.
Skipped if the requesting user is not the owner.
-
-
class
galaxy.managers.sharable.
SharableModelDeserializer
(app: galaxy.structured_app.MinimalManagerApp, validator=None, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelDeserializer
,galaxy.managers.taggable.TaggableDeserializerMixin
,galaxy.managers.annotatable.AnnotatableDeserializerMixin
,galaxy.managers.ratable.RatableDeserializerMixin
-
add_deserializers
()[source]¶ Register a map of attribute keys -> functions that will deserialize data into attributes to be assigned to the item.
Accept a list of encoded user_ids, validate them as users, and then add or remove user shares in order to update the users_shared_with to match the given list finally returning the new list of shares.
-
-
class
galaxy.managers.sharable.
SharableModelFilters
(app: galaxy.structured_app.MinimalManagerApp, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelFilterParser
,galaxy.managers.taggable.TaggableFilterMixin
,galaxy.managers.annotatable.AnnotatableFilterMixin
,galaxy.managers.ratable.RatableFilterMixin
-
class
galaxy.managers.sharable.
SlugBuilder
[source]¶ Bases:
object
Builder for creating slugs out of items.
Bases:
object
Provides the logic used by the API to share resources with other users.
Initialize self. See help(type(self)) for accurate signature.
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.
Makes this item publicly accessible. If this item contains other elements they will be publicly accessible too.
galaxy.managers.taggable module¶
Mixins for Taggable model managers and serializers.
-
class
galaxy.managers.taggable.
TaggableManagerMixin
[source]¶ Bases:
object
-
tag_assoc
: Type[galaxy.model.ItemTagAssociation]¶
Return a list of tag strings.
Set an item’s tags from a list of strings.
-
-
class
galaxy.managers.taggable.
TaggableSerializerMixin
[source]¶ Bases:
object
Return tags as a list of strings.
galaxy.managers.tools module¶
-
class
galaxy.managers.tools.
DynamicToolManager
(app: galaxy.structured_app.BasicApp)[source]¶ Bases:
galaxy.managers.base.ModelManager
Manages dynamic tools stored in Galaxy’s database.
-
model_class
¶ alias of
galaxy.model.DynamicTool
-
app
: galaxy.structured_app.BasicApp¶
-
galaxy.managers.users module¶
Manager and Serializer for Users.
-
class
galaxy.managers.users.
UserManager
(app: galaxy.structured_app.BasicApp)[source]¶ Bases:
galaxy.managers.base.ModelManager
,galaxy.managers.deletable.PurgableManagerMixin
-
__init__
(app: galaxy.structured_app.BasicApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
register
(trans, email=None, username=None, password=None, confirm=None, subscribe=False)[source]¶ Register a new user.
-
is_admin
(user, trans=None)[source]¶ Return True if this user is an admin (or session is authenticated as admin).
Do not pass trans to simply check if an existing user object is an admin user, pass trans when checking permissions.
-
error_unless_admin
(user, msg='Administrators only', **kwargs)[source]¶ Raise an error if user is not an admin.
- Raises
exceptions.AdminRequiredException – if user is not an admin.
-
error_if_anonymous
(user, msg='Log-in required', **kwargs)[source]¶ Raise an error if user is anonymous.
-
valid_api_key
(user)[source]¶ Return this most recent APIKey for this user or None if none have been created.
-
get_or_create_valid_api_key
(user)[source]¶ Return this most recent APIKey for this user or create one if none have been created.
Return a list of distinct ‘user_tname:user_value’ strings that the given user has used.
-
change_password
(trans, password=None, confirm=None, token=None, id=None, current=None)[source]¶ Allows to change a user password with a token.
-
send_activation_email
(trans, email, username)[source]¶ Send the verification email containing the activation link to the user’s email.
-
send_reset_email
(trans, payload, **kwd)[source]¶ Reset the user’s password. Send an email with token that allows a password change.
-
app
: galaxy.structured_app.BasicApp¶
-
-
class
galaxy.managers.users.
UserSerializer
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.base.ModelSerializer
,galaxy.managers.deletable.PurgableSerializerMixin
-
model_manager_class
¶ alias of
galaxy.managers.users.UserManager
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Convert a User and associated data to a dictionary representation.
-
-
class
galaxy.managers.users.
UserDeserializer
(app: galaxy.structured_app.MinimalManagerApp, validator=None, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelDeserializer
Service object for validating and deserializing dictionaries that update/alter users.
-
model_manager_class
¶ alias of
galaxy.managers.users.UserManager
-
-
class
galaxy.managers.users.
CurrentUserSerializer
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.users.UserSerializer
-
model_manager_class
¶ alias of
galaxy.managers.users.UserManager
-
-
class
galaxy.managers.users.
AdminUserFilterParser
(app: galaxy.structured_app.MinimalManagerApp, **kwargs)[source]¶ Bases:
galaxy.managers.base.ModelFilterParser
,galaxy.managers.deletable.PurgableFiltersMixin
-
model_manager_class
¶ alias of
galaxy.managers.users.UserManager
-
model_class
¶ alias of
galaxy.model.User
-
galaxy.managers.visualizations module¶
Manager and Serializers for Visualizations.
Visualizations are saved configurations/variables used to reproduce a specific view in a Galaxy visualization.
-
class
galaxy.managers.visualizations.
VisualizationManager
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.sharable.SharableModelManager
Handle operations outside and between visualizations and other models.
-
model_class
¶ alias of
galaxy.model.Visualization
-
tag_assoc
¶
-
annotation_assoc
¶
-
rating_assoc
¶
-
app
: BasicApp¶
-
-
class
galaxy.managers.visualizations.
VisualizationSerializer
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.managers.sharable.SharableModelSerializer
Interface/service object for serializing visualizations into dictionaries.
-
model_manager_class
¶ alias of
galaxy.managers.visualizations.VisualizationManager
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Set up serializer map, any additional serializable keys, and views here.
-
-
class
galaxy.managers.visualizations.
VisualizationDeserializer
(app)[source]¶ Bases:
galaxy.managers.sharable.SharableModelDeserializer
Interface/service object for validating and deserializing dictionaries into visualizations.
-
model_manager_class
¶ alias of
galaxy.managers.visualizations.VisualizationManager
-
-
class
galaxy.managers.visualizations.
VisualizationsService
(app: galaxy.structured_app.MinimalManagerApp, manager: galaxy.managers.visualizations.VisualizationManager, serializer: galaxy.managers.visualizations.VisualizationSerializer)[source]¶ Bases:
object
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__
(app: galaxy.structured_app.MinimalManagerApp, manager: galaxy.managers.visualizations.VisualizationManager, serializer: galaxy.managers.visualizations.VisualizationSerializer)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
galaxy.managers.workflows module¶
-
class
galaxy.managers.workflows.
WorkflowsManager
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
object
Handle CRUD type operations related to workflows. More interesting stuff regarding workflow execution, step sorting, etc… can be found in the galaxy.workflow module.
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
get_stored_workflow
(trans, workflow_id, by_stored_id=True)[source]¶ Use a supplied ID (UUID or encoded stored workflow ID) to find a workflow.
-
get_stored_accessible_workflow
(trans, workflow_id, by_stored_id=True)[source]¶ Get a stored workflow from a encoded stored workflow id and make sure it accessible to the user.
-
get_owned_workflow
(trans, encoded_workflow_id)[source]¶ Get a workflow (non-stored) from a encoded workflow id and make sure it accessible to the user.
-
check_security
(trans, has_workflow, check_ownership=True, check_accessible=True)[source]¶ check accessibility or ownership of workflows, storedworkflows, and workflowinvocations. Throw an exception or returns True if user has needed level of access.
-
-
class
galaxy.managers.workflows.
CreatedWorkflow
(stored_workflow, workflow, missing_tools)¶ Bases:
tuple
-
property
missing_tools
¶ Alias for field number 2
-
property
stored_workflow
¶ Alias for field number 0
-
property
workflow
¶ Alias for field number 1
-
property
-
class
galaxy.managers.workflows.
WorkflowContentsManager
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Bases:
galaxy.model.item_attrs.UsesAnnotations
-
__init__
(app: galaxy.structured_app.MinimalManagerApp)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
normalize_workflow_format
(trans, as_dict)[source]¶ Process incoming workflow descriptions for consumption by other methods.
Currently this mostly means converting format 2 workflows into standard Galaxy workflow JSON for consumption for the rest of this module. In the future we will want to be a lot more precise about this - preserve the original description along side the data model and apply updates in a way that largely preserves YAML structure so workflows can be extracted.
-
build_workflow_from_raw_description
(trans, raw_workflow_description, workflow_create_options, source=None, add_to_menu=False, hidden=False)[source]¶
-
update_workflow_from_raw_description
(trans, stored_workflow, raw_workflow_description, workflow_update_options)[source]¶
-
workflow_to_dict
(trans, stored, style='export', version=None, history=None)[source]¶ Export the workflow contents to a dictionary ready for JSON-ification and to be sent out via API for instance. There are three styles of export allowed ‘export’, ‘instance’, and ‘editor’. The Galaxy team will do its best to preserve the backward compatibility of the ‘export’ style - this is the export method meant to be portable across Galaxy instances and over time. The ‘editor’ style is subject to rapid and unannounced changes. The ‘instance’ export option describes the workflow in a context more tied to the current Galaxy instance and includes fields like ‘url’ and ‘url’ and actual unencoded step ids instead of ‘order_index’.
-
static
get_step_map_over
(current_step, steps)[source]¶ Given a tool step and its input steps guess that maximum level of mapping over. All data outputs of a step need to be mapped over to this level.
-
-
class
galaxy.managers.workflows.
RefactorRequest
(*, actions: List[galaxy.workflow.refactor.schema.Action], dry_run: bool = False, style: str = 'export')[source]¶
-
class
galaxy.managers.workflows.
RefactorResponse
(*, action_executions: List[galaxy.workflow.refactor.schema.RefactorActionExecution], workflow: dict, dry_run: bool)[source]¶ Bases:
pydantic.main.BaseModel
-
action_executions
: List[galaxy.workflow.refactor.schema.RefactorActionExecution]¶
-
-
class
galaxy.managers.workflows.
WorkflowStateResolutionOptions
(*, fill_defaults: bool = False, from_tool_form: bool = False, exact_tools: bool = True)[source]¶ Bases:
pydantic.main.BaseModel
-
class
galaxy.managers.workflows.
WorkflowUpdateOptions
(*, fill_defaults: bool = False, from_tool_form: bool = False, exact_tools: bool = True, update_stored_workflow_attributes: bool = True, allow_missing_tools: bool = False, dry_run: bool = False)[source]¶ Bases:
galaxy.managers.workflows.WorkflowStateResolutionOptions
-
class
galaxy.managers.workflows.
WorkflowCreateOptions
(*, fill_defaults: bool = False, from_tool_form: bool = False, exact_tools: bool = True, import_tools: bool = False, publish: bool = False, importable: bool = None, install_repository_dependencies: bool = False, install_resolver_dependencies: bool = False, install_tool_dependencies: bool = False, new_tool_panel_section_label: str = '', tool_panel_section_id: str = '', tool_panel_section_mapping: Dict = {}, shed_tool_conf: str = None)[source]¶ Bases:
galaxy.managers.workflows.WorkflowStateResolutionOptions
-
tool_panel_section_mapping
: Dict¶
-
property
is_importable
¶
-
property
install_options
¶
-