Ejemplo n.º 1
0
  private void suggestJobname() {

    if (userTypedInTextField) {
      return;
    }

    if (lastCalculatedExecutable == null || "".equals(lastCalculatedExecutable)) {
      getJobnameTextField().setValue("");
      return;
    }

    if (UserEnvironment.getInstance()
        .getAllJobnames()
        .contains(lastCalculatedExecutable + "_job")) {
      int i = 1;

      while (UserEnvironment.getInstance()
          .getAllJobnames()
          .contains(lastCalculatedExecutable + "_job_" + i)) {
        i = i + 1;
      }
      getJobnameTextField().setValue(lastCalculatedExecutable + "_job_" + i);

    } else {
      getJobnameTextField().setValue(lastCalculatedExecutable + "_job");
    }
  }
Ejemplo n.º 2
0
  private SimpleComboBox<String> getVoComboBox() {
    if (voComboBox == null) {
      voComboBox = new SimpleComboBox<String>();
      voComboBox.setAllowBlank(false);
      voComboBox.setForceSelection(true);
      voComboBox.setEditable(false);
      voComboBox.setFieldLabel("Submit as");
      voComboBox.addListener(
          Events.Valid,
          new Listener<BaseEvent>() {

            public void handleEvent(BaseEvent be) {

              //					xxx

              fillVersionsComboBox();
              String fqan = voComboBox.getSimpleValue();
              if (fqan != null && !"".equals(fqan)) {
                UserEnvironment.getInstance().setUserProperty(Constants.DEFAULT_FQAN, fqan);
              }
            }
          });

      String lastFqan = UserEnvironment.getInstance().getUserProperty(Constants.DEFAULT_FQAN);
      boolean useLastFqan = false;
      String firstValue = null;
      for (String vo : UserEnvironment.getInstance().getAllFqans()) {

        // I know, I know.
        if ("/ARCS".equals(vo)) {
          continue;
        }
        if (firstValue == null) {
          firstValue = vo;
        }
        if (vo.equals(lastFqan)) {
          useLastFqan = true;
        }
        voComboBox.add(vo);
      }

      //			if (useLastFqan) {
      //				voComboBox.setSimpleValue(lastFqan);
      //			} else {
      //				voComboBox.setSimpleValue(firstValue);
      //			}
    }
    return voComboBox;
  }
Ejemplo n.º 3
0
  private HorizontalPanel getWallTimeFormPanel() {
    if (WallTimeFormPanel == null) {
      WallTimeFormPanel = new HorizontalPanel();
      WallTimeFormPanel.setHeight("66px");
      WallTimeFormPanel.setVerticalAlign(VerticalAlignment.BOTTOM);
      WallTimeFormPanel.setSpacing(10);
      TableData tableData = new TableData();
      tableData.setVerticalAlign(VerticalAlignment.BOTTOM);
      WallTimeFormPanel.add(getDaysContainer(), tableData);
      TableData tableData_1 = new TableData();
      tableData_1.setVerticalAlign(VerticalAlignment.BOTTOM);
      WallTimeFormPanel.add(getHoursContainer(), tableData_1);
      TableData tableData_2 = new TableData();
      tableData_2.setVerticalAlign(VerticalAlignment.BOTTOM);
      WallTimeFormPanel.add(getMinutesContainer(), tableData_2);

      // setting last walltime
      int walltimeInMinutes = -1;
      try {
        String wtString =
            UserEnvironment.getInstance()
                .getUserProperty(Constants.GENERIC_JOB_LAST_WALLTIME_IN_MINUTES);
        walltimeInMinutes = Integer.parseInt(wtString);
        if (walltimeInMinutes > 0) {
          int days = walltimeInMinutes / (60 * 24);
          int hours = (walltimeInMinutes - (days * 60 * 24)) / 3600;
          int minutes = (walltimeInMinutes - ((days * 60 * 24) + (hours * 3600))) / 60;

          getMinutesComboBox().setSimpleValue(minutes);
          getHoursComboBox().setSimpleValue(hours);
          getDaysComboBox().setSimpleValue(days);
        }

      } catch (Exception e) {
        // do nothing
      }
    }
    return WallTimeFormPanel;
  }
Ejemplo n.º 4
0
  private void submitJob() {

    mask();

    final Map<String, String> jobProperties;
    try {
      jobProperties = calculateJobProperties();
    } catch (JobCreationException e) {
      unmask();
      e.printStackTrace();
      Window.alert(e.getLocalizedMessage());
      return;
    }

    final MessageBox box =
        MessageBox.progress(
            "Please wait",
            "Submitting job " + jobProperties.get(Constants.JOBNAME_KEY) + "...",
            "Initializing...");
    final ProgressBar bar = box.getProgressBar();
    final Timer t =
        new Timer() {
          float i;

          @Override
          public void run() {

            GrisuClientService.Util.getInstance()
                .getCurrentStatus(
                    jobProperties.get(Constants.JOBNAME_KEY),
                    new AsyncCallback<DtoActionStatus>() {

                      public void onFailure(Throwable arg0) {

                        box.close();
                        unmask();

                        cancel();
                        arg0.printStackTrace();
                      }

                      public void onSuccess(DtoActionStatus arg0) {

                        try {

                          if (arg0 != null && arg0.getFinished()) {

                            box.close();
                            unmask();

                            cancel();

                            if (!arg0.getFailed()) {
                              UserEnvironment.getInstance()
                                  .setUserProperty(
                                      Constants.DEFAULT_VERSION + lastCalculatedExecutable,
                                      jobProperties.get(Constants.APPLICATIONVERSION_KEY));
                            }
                          }

                          if (arg0 == null) {
                            bar.updateProgress(0, "Contacting...");
                            return;
                          }
                          double current = arg0.getCurrentElements();
                          double total = arg0.getTotalElements();

                          bar.updateProgress(
                              current / total,
                              arg0.getLog().get(arg0.getLog().size() - 1).getLogMessage());

                        } catch (Exception e) {
                          e.printStackTrace();
                        }
                      }
                    });
          }
        };
    t.scheduleRepeating(500);

    UserEnvironment.getInstance().submitJob(jobProperties);
  }