This module contains the ‘services’ layer in TVB application.
Most of the business logic happens here; which is agnostic of the UI.
Service layer, for executing computational steps in the application. Code related to launching/duplicating operations is placed here.
Bases: builtins.object
Service Layer for Algorithms manipulation (e.g. find all Uploaders, Filter algo by category, etc)
For a list of dataType IDs and a project id create all the required links.
Retrieve Algorithm entity by ID. Return None, if ID is not found in DB.
Get the db entry from the algorithm table for the given module and class.
Pass to DAO the retrieve of category by ID operation.
Parameters: | datatype_gid – Filter only algorithms compatible with this GUID |
---|---|
Returns: | dict(category_name: List AlgorithmTransientGroup) |
Count total number of operations started for current project.
Returns: | AlgorithmCategory list of entities that have results in RAW state (Creators/Uploaders) |
---|
Retrieved from DB saved selections for current project. If a certain selection doesn’t have all the labels between the labels of the given connectivity than this selection will not be returned. :returns: List of ConnectivitySelection entities.
Retrieve all Algorithm categories, with display capability
Remove the link from the datatype given by dt_id to project given by project_id.
Bases: builtins.object
Keycloak configuration class
Bases: builtins.type
Metaclass used to generate the singleton instance
Service for serializing a Burst (Simulator) configuration.
Bases: builtins.object
Constructs data types based on a burst configuration. Updates the burst configuration.
Bases: builtins.object
Mark Burst status field. Also compute ‘weight’ for current burst: no of operations inside, estimate time on disk...
Parameters: |
|
---|
Update Operation instance state. Store it in DB and on HDD/ :param operation: Operation instance :param operation_status: new status :param message: message in case of error :return: operation instance changed
Adds a disk_usage field to each burst object. The disk usage is computed as the sum of the datatypes generated by a burst
Rename the burst given by burst_id, setting it’s new name to burst_name.
Exceptions for services layer of the application.
Bases: tvb.core.services.exceptions.ServicesBaseException
Exception to be thrown in case of a problem at project import.
Bases: tvb.core.services.exceptions.ServicesBaseException
Exception to be thrown in case of a problem at project import.
Bases: tvb.core.services.exceptions.ServicesBaseException
Exception to be thrown in case of a problem at project import.
Bases: tvb.core.services.exceptions.ImportException
Exception to be thrown in case there are missing references when importing a H5 file.
Bases: tvb.core.services.exceptions.ServicesBaseException
Exception to be thrown in case of a problem related to Launching and Executing TVB specific Operations.
Bases: tvb.core.services.exceptions.ServicesBaseException
Exception to be thrown in case of a problem in the projectservice module.
Bases: tvb.core.services.exceptions.ServicesBaseException
Exception to be thrown in case some one tries to remove an entity that is used by other entities.
Bases: tvb.basic.exceptions.TVBException
Base Exception class for Services layer in the application.
Bases: tvb.core.services.exceptions.ServicesBaseException
Exception to be thrown in case of a problem related to Structure Storage.
Bases: tvb.core.services.exceptions.ServicesBaseException
Exception to be thrown in case of a problem related to creating or managing a user.
Service layer, for storing/retrieving Resulting Figures in TVB.
Bases: builtins.object
Service layer for Figure entities.
Bases: builtins.object
Service for importing TVB entities into system. It supports TVB exported H5 files as input, but it should also handle H5 files generated outside of TVB, as long as they respect the same structure.
Create Operation entity from metadata file.
This method scans provided folder and identify all operations that needs to be imported
Execute import operations:
check if ZIP or folder
find all project nodes
Service layer used for kubernetes calls.
Module in charge with Launching an operation (creating the Operation entity as well, based on gathered parameters).
Bases: builtins.object
Class responsible for preparing an operation launch. It will prepare parameters, and decide if the operation is to be executed immediately, or to be sent on the cluster.
Launch an operation, specified by AdapterInstance, for current_user and project with project_id.
Create and prepare the launch of a group of operations.
Gets the parameters of the computation from the previous inputs form, and launches a computation (on the cluster or locally).
Invoke custom method on an Adapter Instance. Make sure when the operation has finished that the correct results are stored into DB.
Public method. This should be the common point in calling an adapter- method.
Method exposed for Burst-Workflow related calls. It is used for cascading operation in the same workflow.
Retrieve previously stored Operation from DB, and load operation.burst attribute
Gather generic_metadata from submitted fields and current to be execute algorithm. Will populate STATE, GROUP, etc in generic_metadata
Do all the necessary preparations for storing an operation. If it’s the case of a range of values create an operation group and multiple operations for each possible instance from the range.
Stop (also named Cancel) the operation given by operation_id, and potentially also remove it after (with all linked data). In case the Operation has a linked Burst, remove that too. :param operation_id: ID for Operation (or OperationGroup) to be canceled/removed :param is_group: When true stop all the operations from that group. :param remove_after_stop: if True, also remove the operation(s) after stopping :returns True if the stop step was successfully
Service Layer for the Project entity.
Bases: builtins.object
Services layer for Project entities.
Pass to DAO counters for filtered operations
Returns all finished upload operations.
Returns: | an array. First entry in array is an instance of DataTypeOverlayDetails The second one contains all the possible states for the specified dataType. |
---|
Return all dataTypes that are the result of the same DTgroup.
Returns the DataTypeGroup with the specified gid.
Returns the DataTypeGroup with the specified id.
Retrieve all dataType which are part from the given dataType group.
Contains all the attributes by which the user can structure the tree of DataTypes
Find projects with are visible for current user, and in which current datatype hasn’t been linked yet.
Returns: | the file paths to the datatypes that are linked in project |
---|
Returns: | an entity OperationOverlayDetails filled with all information for current operation details. |
---|
Return all the operations from an operation group.
Find all DataTypes (including the linked ones and the groups) relevant for the current project. In case of a problem, will return an empty list.
Retrieve the DataTypes entities resulted after the execution of the given operation.
Used to check if the dataType with the specified GID is a DataTypeGroup.
Returns True only if the operation with the given GID is an upload operation.
Method used for removing a dataType. If the given dataType is a DatatypeGroup or a dataType from a DataTypeGroup than this method will remove the entire group. The operation(s) used for creating the dataType(s) will also be removed.
Return a list with all projects visible for current user, without pagination.
Return a Tuple with Project entity and Operations for current Project. :param project_id: Current Project Identifier :param applied_filters: Filters to apply on Operations :param current_page: Number for current page in operations
Return a list with all Projects visible for current user.
Sets the dataType visibility. If the given dataType is a dataType group or it is part of a dataType group than this method will set the visibility for each dataType from this group.
Sets the operation visibility.
If ‘is_operation_group’ is True than this method will change the visibility for all the operation from the OperationGroup with the GID field equal to ‘entity_gid’.
Service layer for saving/editing TVB settings.
Bases: builtins.object
Handle all TVB Setting related problems, at the service level.
Bases: builtins.object
In case the user copies a simulation and changes the Connectivity, we want to reset the Model and Noise parameters because they might not fit to the new Connectivity’s nr of regions.
Converts a color scheme texture image to json arrays
Parameters: |
|
---|---|
Returns: | A list of img_width/band_height color schemes. A scheme is a list of img_width colors |
Service layer for USER entities.
Bases: builtins.object
CRUD methods for USER entities are here.
Service layer to check if given UserName and Password are according to DB.
Service Layer for creating a new user.
Delete a user with a given ID. Return True when successfully, or False.
Retrieve a user by and id, then modify it’s role and validate status.
Retrieve system administrators. Will be used for sending emails, for example.
Return tuple: (All Users except the project administrator, Project Members). Parameter “user_name” is the current user. Parameter “user_name” is used for new projects (project_id is None). When “project_id” not None, parameter “user_name” is ignored.
Service layer for checking if a given UserName is unique or not.
Return all users from the database except the given users