Package org.apache.uima.ducc.transport.cmdline

Examples of org.apache.uima.ducc.transport.cmdline.JavaCommandLine


    }
    // Exception handler
    String processExceptionHandler = jobRequestProperties.getProperty(JobRequestProperties.key_driver_exception_handler);
    // Command line
    DuccWorkPopDriver driver = new DuccWorkPopDriver(job.getjobBroker(), job.getjobQueue(), crxml, crcfg, meta_time, lost_time, wi_time, processExceptionHandler);
    JavaCommandLine driverCommandLine = new JavaCommandLine(javaCmd);
    driverCommandLine.setClassName(IDuccCommand.main);
    driverCommandLine.addOption(IDuccCommand.arg_ducc_deploy_configruation);
    driverCommandLine.addOption(IDuccCommand.arg_ducc_deploy_components);
    driverCommandLine.addOption(IDuccCommand.arg_ducc_job_id+job.getDuccId().toString());
    // classpath
    String java_classpath = getDuccClasspath(0)// for driver 
    String driverClasspath = jobRequestProperties.getProperty(JobSpecificationProperties.key_classpath);
    logger.debug(methodName, job.getDuccId(), "driver CP (spec):"+driverClasspath);
    logger.debug(methodName, job.getDuccId(), "java CP:"+java_classpath);
    if(driverClasspath != null) {
      if(isClasspathOrderUserBeforeDucc(jobRequestProperties.getProperty(JobSpecificationProperties.key_classpath_order),job.getDuccId())) {
        logger.info(methodName, job.getDuccId(), "driver:OrderUserBeforeDucc");
        driverClasspath=driverClasspath+File.pathSeparator+java_classpath;
      }
      else {
        logger.info(methodName, job.getDuccId(), "driver:OrderDuccBeforeUser");
        driverClasspath=java_classpath+File.pathSeparator+driverClasspath;
      }
    }
    else {
      logger.info(methodName, job.getDuccId(), "driver:OrderDefault");
      driverClasspath=java_classpath;
    }
    logger.debug(methodName, job.getDuccId(), "driver CP (combined):"+driverClasspath);
    driverCommandLine.setClasspath(driverClasspath);
    // Add the user-provided JVM args
    boolean haveXmx = false;
    String driver_jvm_args = jobRequestProperties.getProperty(JobSpecificationProperties.key_driver_jvm_args);
    ArrayList<String> dTokens = QuotedOptions.tokenizeList(driver_jvm_args, true);
    for(String token : dTokens) {
      driverCommandLine.addOption(token);
      if (!haveXmx) {
          haveXmx = token.startsWith("-Xmx");
      }
    }
    // Add any site-provided JVM args, but not -Xmx if the user has provided one
    String siteJvmArgs = DuccPropertiesResolver.get(DuccPropertiesResolver.ducc_driver_jvm_args);
    dTokens = QuotedOptions.tokenizeList(siteJvmArgs, true);    // a null arg is acceptable
    for (String token : dTokens) {
        if (!haveXmx || !token.startsWith("-Xmx")) {
            driverCommandLine.addOption(token);
        }
    }
   
    // Name the log config file explicitly - the default of searching the user-provided classpath is dangerous
    driverCommandLine.addOption("-Dlog4j.configuration=file://" + Utils.findDuccHome() + "/resources/log4j.xml");
    // Environment
    String driverEnvironmentVariables = jobRequestProperties.getProperty(JobSpecificationProperties.key_environment);
    int envCountDriver = addEnvironment(job, "driver", driverCommandLine, driverEnvironmentVariables);
    logger.info(methodName, job.getDuccId(), "driver env vars: "+envCountDriver);
    logger.debug(methodName, job.getDuccId(), "driver: "+driverCommandLine.getCommand());
    // Log directory
    driverCommandLine.setLogDirectory(jobRequestProperties.getProperty(JobSpecificationProperties.key_log_directory));
    driver.setCommandLine(driverCommandLine);
    //
    NodeIdentity nodeIdentity = hostManager.getNode();
    DuccId duccId = jdIdFactory.next();
    duccId.setFriendly(0);
View Full Code Here


        IDuccUimaAggregate uimaAggregate = new DuccUimaAggregate(name,description,threadCount,brokerURL,endpoint,components);
        job.setUimaDeployableConfiguration(uimaAggregate);
        dump(job, uimaAggregate);
      }
      // pipelines
      JavaCommandLine pipelineCommandLine = new JavaCommandLine(javaCmd);
      pipelineCommandLine.setClassName("main:provided-by-Process-Manager");
      pipelineCommandLine.setClasspath(processClasspath);
      String process_jvm_args = jobRequestProperties.getProperty(JobSpecificationProperties.key_process_jvm_args);
      ArrayList<String> pTokens = QuotedOptions.tokenizeList(process_jvm_args, true);
      for(String token : pTokens) {
        pipelineCommandLine.addOption(token);
      }
        // Add any site-provided JVM args
          String siteJvmArgs = DuccPropertiesResolver.get(DuccPropertiesResolver.ducc_process_jvm_args);
          pTokens = QuotedOptions.tokenizeList(siteJvmArgs, true);   // a null arg is acceptable
          for(String token : pTokens) {
              pipelineCommandLine.addOption(token);
          }
     
      String processEnvironmentVariables = jobRequestProperties.getProperty(JobSpecificationProperties.key_environment);
      int envCountProcess = addEnvironment(job, "process", pipelineCommandLine, processEnvironmentVariables);
      logger.info(methodName, job.getDuccId(), "process env vars: "+envCountProcess);
      logger.debug(methodName, job.getDuccId(), "pipeline: "+pipelineCommandLine.getCommand());
      pipelineCommandLine.setLogDirectory(jobRequestProperties.getProperty(JobSpecificationProperties.key_log_directory));
      job.setCommandLine(pipelineCommandLine);
    }
    else {
      // ducclet (sometimes known as arbitrary process)
      String process_executable = jobRequestProperties.getProperty(JobSpecificationProperties.key_process_executable);
View Full Code Here

        try {
            int howMany = Integer.parseInt(args[0]);   // how many agent processes to launch
            String ip = System.getProperty("IP");
            String nodeName = InetAddress.getLocalHost().getHostName();
            Launcher launcher = new Launcher();
            JavaCommandLine cmdLine = new JavaCommandLine("java");
            String duccHome = Utils.findDuccHome();
            cmdLine.addOption("-Dducc.deploy.configuration="+duccHome+"/resources/ducc.properties");
            cmdLine.addOption("-Dducc.deploy.components=agent");
            cmdLine.addOption("-Djava.library.path=" + duccHome +"/lib/sigar");
            cmdLine.addOption("-DDUCC_HOME=" + duccHome);
     
            // System.out.println("Spawning with classpath: \n" + System.getProperty("java.class.path"));
            // cmdLine.setClasspath(duccHome+"/lib/*:" +
            //                      duccHome+"/lib/apache-activemq-5.5.0/*:" +
            //                      duccHome+"/lib/apache-camel-2.7.1/*:" +
            //                      duccHome+"/lib/commons-collections-3.2.1/*:" +
            //                      duccHome+"/lib/apache-commons-lang-2.6/*:" +
            //                      duccHome+"/lib/apache-log4j-1.2.16/*:" +
            //                      duccHome+"/lib/guava-r09/*:" +
            //                      duccHome+"/lib/joda-time-1.6/*:" +
            //                      duccHome+"/lib/sigar/*:" +
            //                      duccHome+"/lib/springframework-3.0.5/*:");

            cmdLine.setClasspath(System.getProperty("java.class.path"));
            cmdLine.setClassName("org.apache.uima.ducc.agent.common.main.DuccService");
            launcher.start(cmdLine, howMany, ip, nodeName);
        } catch( Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.uima.ducc.transport.cmdline.JavaCommandLine

Copyright © 2018 www.massapicom. 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.