Examples of ISimulationRun


Examples of org.jamesii.core.simulationrun.ISimulationRun

  /** The Constant SIMEND. */
  public static final String SIMEND = "SIMEND";

  @Override
  public IComputationTaskStopPolicy<ISimulationRun> create(ParameterBlock paramBlock, Context context) {
    ISimulationRun run = ParameterBlocks.getSubBlockValue(paramBlock, COMPTASK);
    Number endTime = ParameterBlocks.getSubBlockValue(paramBlock, SIMEND);
    if (endTime == null) {
      endTime = Double.POSITIVE_INFINITY;
    }
    return new SimTimeStop(endTime.doubleValue());
View Full Code Here

Examples of org.jamesii.core.simulationrun.ISimulationRun

   * @return the list of simulation run stop policies
   */
  protected static List<IComputationTaskStopPolicy<IComputationTask>> createSubPolicies(
      ParameterBlock parameters) {

    ISimulationRun simRun =
        ParameterBlocks.getSubBlockValue(parameters, COMPTASK);
    List<IComputationTaskStopPolicy<IComputationTask>> policies =
        new ArrayList<>();
    List<Pair<ComputationTaskStopPolicyFactory<IComputationTask>, ParameterBlock>> policyFactories =
        ParameterBlocks.getSubBlockValue(parameters, POLICY_FACTORY_LIST);
View Full Code Here

Examples of org.jamesii.core.simulationrun.ISimulationRun

  private static final long serialVersionUID = -1587165003419760852L;

  @Override
  public IComputationTaskStopPolicy<IComputationTask> create(
      ParameterBlock paramBlock, Context context) {
    ISimulationRun run = ParameterBlocks.getSubBlockValue(paramBlock, COMPTASK);
    List<IComputationTaskStopPolicy<IComputationTask>> policies =
        createSubPolicies(paramBlock);
    return new DisjunctiveSimRunStopPolicy<>(run, policies);
  }
View Full Code Here

Examples of org.jamesii.core.simulationrun.ISimulationRun

  public RunInformation initializeSimulationRun(
      SimulationRunConfiguration config, String simName,
      List<ISimulationHost> bookedResources) throws RemoteException {

    RunInformation result = new RunInformation(config);
    ISimulationRun simulation;
    // create the model reader
    IModelReader modelReader = null;
    ModelReaderFactory modelReaderFactory =
        SimSystem.getRegistry().getFactory(AbstractModelReaderFactory.class,
            config.getAbsModelReaderFactoryParams());
    modelReader = modelReaderFactory.create(config.getModelReaderParams(), SimSystem.getRegistry().createContext());

    // IDataStorage ds = config.createDataStorage(simID.id);

    // Create list of all available resources (including this one)
    // FIXME: Ensure that all bookedResources are instances of ISimulationServer
    List<ISimulationServer> simResources = new ArrayList<>();
    simResources.add(this);
    if (bookedResources != null) {
      for (ISimulationHost simHost : bookedResources) {
        simResources.add((ISimulationServer) simHost);
      }
    }

    IInitializedComputationTask initTask =
        ComputationTaskHandler.initComputationTask(config, modelReader, result,
            simResources.size() == 1 ? null : simResources);

    // FIXME (the cast should not be here, i.e., the server needs to maintain a
    // list of tasks and not of simruns!)
    simulation = (ISimulationRun) initTask.getComputationTask();
    simulation.setName(simName);
    getTaskManager().addComputationTask(simulation, config);

    // result.setSimulationUID(simulation.getUid());

    return result;
View Full Code Here

Examples of org.jamesii.core.simulationrun.ISimulationRun

    }
  }

  @Override
  public void stopProc(ComputationTaskIDObject uid) {
    ISimulationRun simulation = getSimulationByUID(uid);
    if (simulation != null) {
      simulation.stopProcessor();
      removeSimulation(simulation);
    } else {
      SimSystem.report(Level.INFO, "Attempted to stop Simulation '" + uid
          + "'. Simulation not found on Server.");
      throw new UnknownComputationTaskException("Simulation with UID: " + uid
View Full Code Here

Examples of org.jamesii.core.simulationrun.ISimulationRun

    }
  }

  @Override
  public Partition getPartition(ComputationTaskIDObject uid) {
    ISimulationRun simulation = getSimulationByUID(uid);
    Partition partition = null;

    if (simulation != null) {
      partition = simulation.getPartition();
    } else {
      // addEvent("Simulation " + uid + " not found on Server.");
      throw new UnknownComputationTaskException(
          "Simulation not located on this server");
    }
View Full Code Here

Examples of org.jamesii.core.simulationrun.ISimulationRun

  }

  @Override
  public void startSimulationRun(ComputationTaskIDObject uid)
      throws RemoteException {
    ISimulationRun computation = getSimulationByUID(uid);
    if (computation != null) {

      computation.start();

      // clear the resource
      getTaskManager().removeComputationTask(computation);
    } else {
      SimSystem.report(Level.INFO,
View Full Code Here

Examples of org.jamesii.core.simulationrun.ISimulationRun

  @SuppressWarnings("unchecked")
  @Override
  public <D> D executeRunnableCommand(ComputationTaskIDObject simulationID,
      String command, Object[] args) {
    // the simulation run has to be a local simulation run object
    ISimulationRun simulation = getSimulationByUID(simulationID);

    if (simulation != null) {

      IRunnable runnable = (IRunnable) simulation.getProcessorInfo().getLocal();

      Object result =
          org.jamesii.core.util.Reflect.executeMethod(runnable, command, args);

      // special case: stop => we have to remove the simulation
View Full Code Here

Examples of org.jamesii.core.simulationrun.ISimulationRun

  @Override
  public <D> D getSimulationRunProperty(ComputationTaskIDObject simulationID,
      String property) throws RemoteException {
    // the simulation run has to be a local simulation run object
    ISimulationRun simulation = getSimulationByUID(simulationID);
    return simulation.getProperty(property);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.