ilog.rules.dvs.core

Interface IlrScenarioSuiteExecutionContext



  • public interface IlrScenarioSuiteExecutionContext
    A scenario suite execution context is created by the SSP runtime for each scenario suite execution request. This context provides access to all the relevant information regarding the execution, and provides a way to share this data between the different components involved in the execution of the scenario suite (scenario provider, trace value provider, KPI...). All IlrInitializable components receive an instance of the scenario suite execution context when they are initialized.

    During a parallel execution of a simulation, data is shared through the scenario suite execution context. The context is created when the first instance of the parallel scenario provider is initialized, and its method IlrParallelScenarioProvider.getScenarioSuiteParts() is called by the SSP to retrieve the simulation parts. After that, a new instance of the parallel scenario provider is created and initialized for each part of the simulation. When the first instance of the parallel scenario provider is initialized, the getCurrentScenarioSuitePart() method of the scenario suite execution context returns null because this initialization is not related to a part of the simulation. The parallel scenario provider can use this first initialization step to store data in the execution context, so that the parallel scenario provider instances in charge of executing each simulation part can retrieve it when they are initialized.

    Example

    The following code sample provides an example of this use case:

     public class MyParallelScenarioProvider implements IlrParallelScenarioProvider {
      
         public void initialize(IlrScenarioSuiteExecutionContext context) throws IlrScenarioProviderException {
               IlrScenarioSuitePart currentScenarioSuitePart = context.getCurrentScenarioSuitePart();
             if (currentScenarioSuitePart == null) {
                 // This is the initialization of the first parallel scenario provider instance.
                 // It is in charge of providing the scenario parts and the total number of scenarios.
                 Serializable sharedData = ...
                 context.setCustomData(sharedData);
             } else {
                 // This is the initialization of a parallel scenario provider instance in charge of providing scenarios for a part.
                 Serialization sharedData = context.getCustomData();
                 ...
             }
         }
         
         ...
     }
     
    Since:
    7.0
    • Method Detail

      • getRulesetSignature

        IlrRulesetSignature getRulesetSignature()
        Returns the signature of the ruleset the scenario suite is run against.
        Returns:
        The signature of the ruleset the scenario suite is run against.
      • getObjectModelServices

        IlrObjectModelServices getObjectModelServices()
        Returns the services for the object model the tested ruleset is based on.
        Returns:
        The services for the object model the tested ruleset is based on.
      • getSessionFactory

        IlrSessionFactory getSessionFactory()
        Returns the rule session factory.
        Returns:
        The rule session factory.
      • getScenarioSuiteDescriptor

        IlrScenarioSuiteDescriptor getScenarioSuiteDescriptor()
        Returns the scenario suite descriptor used for initialization.
        Returns:
        The scenario suite descriptor used for initialization.
      • getKPIs

        java.util.List<IlrKPI> getKPIs()
        Returns the list of KPIs to be applied.
        Returns:
        The list of KPIs to be applied.
      • getRuleAppDeployer

        IlrRuleAppDeployer getRuleAppDeployer()
        Deprecated. since 8.0 this information is no longer valid, null is returned by this method.
        Returns the RuleApp deployer used in the run.
        Returns:
        The RuleApp deployer used in the run.
      • getRulesetPath

        IlrPath getRulesetPath()
        Returns the path to the ruleset to be tested.
        Returns:
        The path to the ruleset to be tested
      • getObjectModelServicesFactory

        IlrObjectModelServicesFactory getObjectModelServicesFactory()
        Gets an object model services factory.
        Since:
        7.5
        Returns:
        An object model services factory.
      • getScenarioProvider

        IlrScenarioProvider getScenarioProvider()
        Returns the scenario provider.
        Returns:
        The scenario provider.
      • getScenarioSuiteTestResult

        IlrScenarioSuiteTestResult getScenarioSuiteTestResult()
        Returns the scenario suite test result.
        Returns:
        The scenario suite test result.
      • getCurrentScenarioSuitePart

        IlrParallelScenarioProvider.IlrScenarioSuitePart getCurrentScenarioSuitePart()
        During the parallel execution of a simulation, this method returns the current part that is executed. If the scenario suite is not executed in parallel, or if the current execution step does not involve a scenario suite part (for example during the first initialization of the parallel scenario provider, or during the initialization of a KPI result aggregator), this method returns null.
        Since:
        8.0
        Returns:
        The current scenario suite part that is executed, if any.
      • setCustomData

        void setCustomData(java.io.Serializable customData)
        Stores custom data into a context. The context is shared between all components involved in the execution of a scenario suite (scenario provider, KPI, ...). This method can be used by one component to make data available to the other components. A common use case is during parallel execution of a simulation. In this case, data is stored in the context during the initialisation of the first scenario provider instance so that this information can be retrieved later by all the scenario provider instances that are in charge of executing a part of the simulation. This method is not synchronized, so in the case of a parallel simulation it is required to make sure that the stored object itself supports multithreaded access.
        Since:
        8.0
        Parameters:
        customData - the custom data to be stored in the context.
      • getCustomData

        java.io.Serializable getCustomData()
        Retrieves custom data previously stored in a context.
        Since:
        8.0
        Returns:
        Custom data previously stored in a context with the method setCustomData(Serializable).

© Copyright IBM Corp. 1987, 2017