Class AlgorithmManager
- All Implemented Interfaces:
com.google.common.util.concurrent.Service,ParameterProcessor,ParameterProvider,ProcessorService
Upon initialization it will scan all algorithms, and schedule any that are to be triggered periodically. OutputParameters of all algorithms will be indexed, so that AlgorithmManager knows what parameters it can provide to the ParameterRequestManager.
Algorithms and any needed algorithms that require earlier execution, will be activated as soon as a request for one of its output parameters is registered.
Algorithm executors are created by AlgorithmExecutorFactory which themselves are created by the
AlgorithmEngine. The algorithm engines are registered at server startup using the
registerAlgorithmEngine(String, AlgorithmEngine) method.
javascript will be automatically registered as well as python if available.
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.google.common.util.concurrent.Service
com.google.common.util.concurrent.Service.Listener, com.google.common.util.concurrent.Service.State -
Field Summary
Fields inherited from class org.yamcs.AbstractProcessorService
config, log, processor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionactivateAlgorithm(Algorithm algorithm, AlgorithmExecutionContext execCtx) Activate an algorithm in a context.voidbooleancanProvide(Yamcs.NamedObjectId itemId) Returns whether or not a given parameter can be provided by this providerbooleanvoidcreateContext(String name) Create a new algorithm execution context.voiddisableTracing(Algorithm algo) protected voiddoStart()protected voiddoStop()voidenableTracing(Algorithm algo) getAlgorithmStatus(Algorithm algo) getParameter(Yamcs.NamedObjectId paraId) Returns the parameterDefinition corresponding to the parameter idgetSpec()Returns the valid configuration of the input args of this service.voidinit(Processor processor, YConfiguration config, Object spec) voidoverrideAlgorithm(CustomAlgorithm calg, String text) Override the algorithmvoidprocess(ProcessingContext processingCtx) Called by PRM when new parameters are received.static voidregisterAlgorithmEngine(String name, AlgorithmEngine eng) voidvoidvoidsetParameterProcessor(ParameterProcessor parameterRequestManager) Send parameters to this processor.voidstartProviding(Parameter paramDef) Adds a new parameter to the list of parameters that have to providedvoidstart providing all known parametersvoidstopProviding(Parameter paramDef) Removes a parameter from the list of parameters that have to be providedMethods inherited from class org.yamcs.AbstractProcessorService
getConfig, getYamcsInstanceMethods inherited from class com.google.common.util.concurrent.AbstractService
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, doCancelStart, failureCause, isRunning, notifyFailed, notifyStarted, notifyStopped, startAsync, state, stopAsync, toStringMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.google.common.util.concurrent.Service
addListener, awaitRunning, awaitRunning, awaitRunning, awaitTerminated, awaitTerminated, awaitTerminated, failureCause, isRunning, startAsync, state, stopAsync
-
Constructor Details
-
AlgorithmManager
public AlgorithmManager()
-
-
Method Details
-
getSpec
Description copied from interface:ProcessorServiceReturns the valid configuration of the input args of this service.- Specified by:
getSpecin interfaceProcessorService- Returns:
- the argument specification, or
nullif the args should not be validated.
-
registerAlgorithmEngine
-
init
- Specified by:
initin interfaceProcessorService- Overrides:
initin classAbstractProcessorServiceconfig- service configuration as specified in processor.yamlspec- passed by the user when creating the processor (for instance via the REST API)
-
startProviding
Description copied from interface:ParameterProviderAdds a new parameter to the list of parameters that have to provided- Specified by:
startProvidingin interfaceParameterProvider
-
createContext
Create a new algorithm execution context.- Parameters:
name- - name of the context- Returns:
- the newly created context
-
removeContext
-
activateAlgorithm
public ActiveAlgorithm activateAlgorithm(Algorithm algorithm, AlgorithmExecutionContext execCtx) throws AlgorithmException Activate an algorithm in a context.If the algorithm cannot be activated (e.g. error compiling) returns null.
- Throws:
AlgorithmException
-
startProvidingAll
public void startProvidingAll()Description copied from interface:ParameterProviderstart providing all known parameters- Specified by:
startProvidingAllin interfaceParameterProvider
-
stopProviding
Description copied from interface:ParameterProviderRemoves a parameter from the list of parameters that have to be provided- Specified by:
stopProvidingin interfaceParameterProvider
-
canProvide
- Specified by:
canProvidein interfaceParameterProvider
-
canProvide
Description copied from interface:ParameterProviderReturns whether or not a given parameter can be provided by this provider- Specified by:
canProvidein interfaceParameterProvider- Returns:
-
getParameter
Description copied from interface:ParameterProviderReturns the parameterDefinition corresponding to the parameter id- Specified by:
getParameterin interfaceParameterProvider- Parameters:
paraId- - id of the parameter that is returned- Returns:
- Throws:
InvalidIdentification
-
process
Called by PRM when new parameters are received.- Specified by:
processin interfaceParameterProcessor
-
setParameterProcessor
Description copied from interface:ParameterProviderSend parameters to this processor.- Specified by:
setParameterProcessorin interfaceParameterProvider
-
doStart
protected void doStart()- Specified by:
doStartin classcom.google.common.util.concurrent.AbstractService
-
doStop
protected void doStop()- Specified by:
doStopin classcom.google.common.util.concurrent.AbstractService
-
getProcessor
-
addAlgorithmTextListener
-
removeAlgorithmTextListener
-
clearAlgorithmOverride
-
overrideAlgorithm
Override the algorithm- Parameters:
calg-text-
-
getAlgorithmOverrides
-
getAlgorithmOverride
-
enableTracing
-
disableTracing
-
getTrace
-
getAlgorithmStatus
-