コード例 #1
0
  /**
   * Adds already running runner.
   *
   * @param processDescriptor The descriptor of new runner
   * @return instance of new runner
   */
  @NotNull
  public Runner addRunner(@NotNull ApplicationProcessDescriptor processDescriptor) {
    RunOptions runOptions = dtoFactory.createDto(RunOptions.class);
    Runner runner = modelsFactory.createRunner(runOptions);

    String environmentId = processDescriptor.getEnvironmentId();

    if (environmentId != null && environmentId.startsWith(PROJECT_PREFIX)) {
      runner.setScope(PROJECT);
    }

    runnersId.add(processDescriptor.getProcessId());

    runner.setProcessDescriptor(processDescriptor);
    runner.setRAM(processDescriptor.getMemorySize());
    runner.setStatus(Runner.Status.DONE);
    runner.resetCreationTime();

    history.addRunner(runner);

    onSelectionChanged(RUNNER);

    runnerTimer.schedule(ONE_SEC.getValue());

    LaunchAction launchAction = actionFactory.createLaunch();
    runnerActions.put(runner, launchAction);

    launchAction.perform(runner);

    selectHistoryTab();

    return runner;
  }
コード例 #2
0
  @NotNull
  private Runner launchRunner(@NotNull Runner runner) {
    if (runActionPermit.isAllowed()) {

      CurrentProject currentProject = appContext.getCurrentProject();

      if (currentProject == null) {
        throw new IllegalStateException(
            "Can't launch runner for current project. Current project is absent...");
      }

      selectedEnvironment = null;

      panelState.setState(RUNNERS);
      view.showOtherButtons();

      history.addRunner(runner);

      runnerInQueueTimer.schedule(ONE_SEC.getValue());

      CheckRamAndRunAction checkRamAndRunAction = actionFactory.createCheckRamAndRun();
      checkRamAndRunAction.perform(runner);

      runnerActions.put(runner, checkRamAndRunAction);

      runner.resetCreationTime();
      runnerTimer.schedule(ONE_SEC.getValue());
    } else {
      runActionDenyAccessDialog.show();
    }
    return runner;
  }
コード例 #3
0
  /** {@inheritDoc} */
  @Override
  public void stopRunner(@NotNull Runner runner) {
    RunnerAction runnerAction = runnerActions.get(runner);
    if (runnerAction != null) {
      runnerAction.stop();
    }

    StopAction stopAction = actionFactory.createStop();
    stopAction.perform(runner);
  }
コード例 #4
0
  /** {@inheritDoc} */
  @Override
  public void onProjectReady(@NotNull ProjectActionEvent projectActionEvent) {
    view.setEnableReRunButton(false);
    view.setEnableStopButton(false);
    view.setEnableLogsButton(false);

    templateContainer.setVisible(true);

    getRunningProcessAction = actionFactory.createGetRunningProcess();

    boolean isRunOperationAvailable = runnerUtil.hasRunPermission();
    view.setEnableRunButton(isRunOperationAvailable);

    if (!isRunOperationAvailable) {
      return;
    }

    templateContainer.showEnvironments();

    getRunningProcessAction.perform();
    getSystemEnvironmentsAction.perform();

    runnerTimer.schedule(ONE_SEC.getValue());
  }