Klasse DUUIPipelineController
java.lang.Object
org.texttechnologylab.duui.api.controllers.pipelines.DUUIPipelineController
A Controller for database operations related to the pipelines collection.
- Autor:
- Cedric Borkowski
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic void
Delete all pipelines associated with a user when that user account is deleted.static boolean
Delete one pipeline and return if the deletion succeeded.static org.bson.Document
findMany
(MongoDBFilters filters, boolean getComponents) Retrieve one or more pipelines from the database given aMongoDBFilters
object.static org.bson.Document
findOneById
(String id) Retrieve one pipeline given its id.static org.bson.Document
findOneById
(String id, boolean getComponents) Retrieve one pipeline given its id.static org.texttechnologylab.DockerUnifiedUIMAInterface.driver.DUUIPipelineComponent
getComponent
(org.bson.Document component) Creates aDUUIPipelineComponent
from a settingsDocument
static org.texttechnologylab.DockerUnifiedUIMAInterface.driver.IDUUIDriverInterface
getDriverFromString
(String driver) Construct aIDUUIDriverInterface
from a string holding its name.static org.bson.Document
getPipelineStatistics
(String pipelineId) This function performs a set of Aggregations to generate statistics for the usage of a pipeline.Get the map of reusable/instantiated pipelines.static boolean
instantiate
(String id) Instantiate a pipeline and store it as a reusable one.static org.texttechnologylab.DockerUnifiedUIMAInterface.DUUIComposer
instantiatePipeline
(org.bson.Document pipeline) Instantiate a pipeline from aDocument
.static void
Cancel all active processes using the pipeline with the given id.static void
Set the status of a pipeline given an id and the status name.static void
setupComponents
(org.texttechnologylab.DockerUnifiedUIMAInterface.DUUIComposer composer, org.bson.Document pipeline) Set up the components for a pipeline in a composer.static void
setupDrivers
(org.texttechnologylab.DockerUnifiedUIMAInterface.DUUIComposer composer, org.bson.Document pipeline) Loops over all components in the pipeline and add their respective driver to the composer.static boolean
Shut down a pipeline and remove it from the map of reusable pipelines.static void
shutdownPipeline
(String pipelineId) Shutdown a reusable pipeline and cancel all active processes using the pipeline.static void
Update a pipeline given its id and a Document of updates.static void
Increment the times_used property of a pipeline and update the last_used time.
-
Konstruktordetails
-
DUUIPipelineController
public DUUIPipelineController()
-
-
Methodendetails
-
findOneById
Retrieve one pipeline given its id.- Parameter:
id
- A unique 24 character identifier generated by MongoDB.- Gibt zurück:
- A
Document
containing the pipeline data or null if nothing matched.
-
findOneById
Retrieve one pipeline given its id.- Parameter:
id
- A unique 24 character identifier generated by MongoDB.getComponents
- Wether to include the pipeline's components or not.- Gibt zurück:
- A document containing the pipeline data or null if nothing matched.
-
findMany
Retrieve one or more pipelines from the database given aMongoDBFilters
object.- Parameter:
filters
- AMongoDBFilters
object that contains filter options.getComponents
- Wether to include components in the pipeline data.- Gibt zurück:
- A Document containing a list of matched pipelines.
-
updateOne
Update a pipeline given its id and a Document of updates.- Parameter:
id
- The id of the pipeline to update.updates
- ADocument
of key value pairs that define updates.
-
instantiate
Instantiate a pipeline and store it as a reusable one. This pipeline can be passed to a composer to skip the instantiation for every process.- Parameter:
id
- The id of the pipeline to instantiate.- Gibt zurück:
- if the instantiation was successfull.
-
shutdown
Shut down a pipeline and remove it from the map of reusable pipelines.- Parameter:
id
- The id of the pipeline to shut down.- Gibt zurück:
- if the shut-down was successfull
-
updateTimesUsed
Increment the times_used property of a pipeline and update the last_used time.- Parameter:
id
- The pipeline id.
-
getReusablePipelines
public static Map<String,org.texttechnologylab.DockerUnifiedUIMAInterface.DUUIComposer> getReusablePipelines()Get the map of reusable/instantiated pipelines.- Gibt zurück:
- the map of pipelines that are reusable.
-
deleteOne
Delete one pipeline and return if the deletion succeeded. Also delete all components and processes referencing the pipeline.- Parameter:
id
- The id of the pipeline to delete- Gibt zurück:
- if the number of deleted pipelines is greater than 0.
-
interruptIfRunning
Cancel all active processes using the pipeline with the given id.- Parameter:
id
- The id of the pipeline.
-
shutdownPipeline
Shutdown a reusable pipeline and cancel all active processes using the pipeline.- Parameter:
pipelineId
- The id of the pipeline to shut down.
-
setStatus
Set the status of a pipeline given an id and the status name.- Parameter:
id
- The pipeline's id.status
- The status to set. SeeDUUIStatus
-
getPipelineStatistics
This function performs a set of Aggregations to generate statistics for the usage of a pipeline. These Aggregations include - a grouping by status (Completed, Failed, etc.) - a grouping by errors - a grouping by input provider - a grouping by output provider - a grouping by usage per month - a sum of the total number documents procesed.- Parameter:
pipelineId
- The identifier for the pipeline- Gibt zurück:
- A BSON Document with the aggregation result.
-
instantiatePipeline
public static org.texttechnologylab.DockerUnifiedUIMAInterface.DUUIComposer instantiatePipeline(org.bson.Document pipeline) throws Exception Instantiate a pipeline from aDocument
. This function is used to instantiate a pipeline and return its composer for future use.- Parameter:
pipeline
- The pipeline to instantiate (MongoDBDocument
).- Gibt zurück:
- the composer containing the instantiated pipeline.
- Löst aus:
Exception
-
setupComponents
public static void setupComponents(org.texttechnologylab.DockerUnifiedUIMAInterface.DUUIComposer composer, org.bson.Document pipeline) throws IOException, org.apache.uima.UIMAException, SAXException, URISyntaxException, org.apache.commons.compress.compressors.CompressorException Set up the components for a pipeline in a composer.- Parameter:
composer
- The composer to add components to.pipeline
- ADocument
containing all component settings.- Löst aus:
IOException
org.apache.uima.UIMAException
SAXException
URISyntaxException
org.apache.commons.compress.compressors.CompressorException
-
setupDrivers
public static void setupDrivers(org.texttechnologylab.DockerUnifiedUIMAInterface.DUUIComposer composer, org.bson.Document pipeline) Loops over all components in the pipeline and add their respective driver to the composer.- Parameter:
composer
- The composer that is being setup.pipeline
- The pipeline (MongoDBDocument
) containing all relevant components.
-
getDriverFromString
public static org.texttechnologylab.DockerUnifiedUIMAInterface.driver.IDUUIDriverInterface getDriverFromString(String driver) throws IOException, org.apache.uima.UIMAException, SAXException Construct aIDUUIDriverInterface
from a string holding its name.- Parameter:
driver
- The name of the driver to construct.- Gibt zurück:
- A driver object or null if no driver matched the name.
- Löst aus:
IOException
org.apache.uima.UIMAException
SAXException
-
getComponent
public static org.texttechnologylab.DockerUnifiedUIMAInterface.driver.DUUIPipelineComponent getComponent(org.bson.Document component) throws URISyntaxException, IOException, org.apache.uima.util.InvalidXMLException, SAXException Creates aDUUIPipelineComponent
from a settingsDocument
- Parameter:
component
- the settings for the component.- Gibt zurück:
- the new pipeline component.
- Löst aus:
URISyntaxException
IOException
org.apache.uima.util.InvalidXMLException
SAXException
-
cascade
Delete all pipelines associated with a user when that user account is deleted.- Parameter:
userId
- the id of the user that has been deleted.
-