コード例 #1
0
ファイル: CabrinProcess.java プロジェクト: aba99/Stash
  private void deriveUprocVariables() throws Exception {
    if (isTempUprocSet) {

      Vector<Variable> varia = new Vector<Variable>();
      varia.addAll(templateCabrinUproc.getVariables());

      if (varia.size() == 3
          && varia.get(1).getName().equals("COMMAND_PART2")
          && varia.get(2).getName().equals("MAIN_JOB_TRIGGER")) {

        String command = varia.get(1).getValue();
        command = command.replace("-S00", "-S" + googleNumber);
        command = command.replace("<FILE>", fileName);
        varia.get(1).setValue(command);

        String main_job_trigger = varia.get(2).getValue();
        main_job_trigger = main_job_trigger.replace("<JOB>", relatedMainUproc);
        varia.get(2).setValue(main_job_trigger);
      }

      variables = varia;

      if (!duapi.doesUprocExist(relatedCabrinUproc)) {

        UprocId newDuplicatedUprocId = new UprocId(relatedCabrinUproc, "000");
        newDuplicatedUprocId.setId(relatedCabrinUproc);

        templateCabrinUproc.duplicate(newDuplicatedUprocId, "CABRIN");
        // duapi.duplicateUproc(templateCabrinUproc.getName(), relatedCabrinUproc,"CABRIN");
        System.out.println("Created uproc <" + relatedCabrinUproc + ">");
      }
    }
  }
コード例 #2
0
ファイル: CabrinProcess.java プロジェクト: aba99/Stash
  public static void fireAwayCabrinProcesses(
      CabrinProcess cabproc, String submissionUser, String muName) throws Exception {

    if (!CabrinProcess.publicboard.containsKey(cabproc.getCabrinJob())) {
      Queue<CabrinProcess> myQ = new LinkedList<CabrinProcess>();
      myQ.add(cabproc);
      CabrinProcess.publicboard.put(cabproc.getCabrinJob(), myQ);

    } else if (CabrinProcess.publicboard.get(cabproc.getCabrinJob()).isEmpty()) {
      CabrinProcess.publicboard.get(cabproc.getCabrinJob()).add(cabproc);
    }

    if (duapi.getExecutionList(cabproc.getCabrinJob(), array).size() == 0) {

      cabproc = CabrinProcess.publicboard.get(cabproc.getCabrinJob()).poll();

      Uproc cabupr = duapi.getUproc(cabproc.getCabrinJob());
      cabupr.setVariables(cabproc.getCabrinUprocVariables());
      cabupr.update();

      System.out.println(" Update uproc :" + cabupr.getName());
      System.out.println(
          "Variable_1 : "
              + cabupr.getVariables().get(0).getName()
              + "-"
              + cabupr.getVariables().get(0).getValue());
      System.out.println(
          "Variable_2 : "
              + cabupr.getVariables().get(1).getName()
              + "-"
              + cabupr.getVariables().get(1).getValue());
      System.out.println(
          "Variable_3 : "
              + cabupr.getVariables().get(2).getName()
              + "-"
              + cabupr.getVariables().get(2).getValue());

      System.out.println("Updated uproc <" + cabproc.getCabrinJob() + ">");

      Date launchDateTime = new Date();

      List<String> mus = duapi.getMus();
      List<String> users = duapi.getUsers();
      if (mus.size() == 0) throw new Exception("No MU found");
      if (users.size() == 0) throw new Exception("No user found");
      String aMu = mus.get(0);
      String aUser = users.get(0);
      if (users.contains(submissionUser)) aUser = submissionUser;

      if (mus.contains(muName)) aMu = muName;

      Launch l =
          new Launch(
              duapi.getContext(),
              LaunchId.createWithName("", "", cabproc.getCabrinJob(), "000", aMu, null));
      {
        l.setImpl(new OwlsLaunchImpl());
        l.getIdentifier().setSyntaxRules(OwlsSyntaxRules.getInstance());
      }
      l.setBasedOnTask(false);
      l.setBeginDate(launchDateTime);
      Date endDate = new Date();
      endDate.setTime(launchDateTime.getTime() + 100000000);
      l.setEndDate(endDate);
      l.setProcessingDate((new SimpleDateFormat("yyyyMMdd")).format(launchDateTime));
      l.setUserName(aUser);
      l.setQueue("SYS_BATCH");
      l.setPriority("100");
      l.setPrinter("IMPR");

      l.create();

      System.out.println(
          "Launch created for <" + cabproc.getCabrinJob() + "> with nmLanc =" + l.getNumlanc());
    }
  }