Examples of DuccProperties


Examples of org.apache.uima.ducc.common.utils.DuccProperties

  private String[] cps = null;
  private String getDuccClasspath(int type) {
      if (cps != null) {
          return cps[type];
      }
      DuccProperties props = new DuccProperties();
      try {
          props.load(IDuccEnv.DUCC_CLASSPATH_FILE);
      } catch (Exception e) {
          logger.error("getClasspath", null, "Using full classpath as failed to load " + IDuccEnv.DUCC_CLASSPATH_FILE);
          return System.getProperty("java.class.path");
      }
      // If reload specified don't cache the results (for ease of testing changes to the classpaths)
      if (props.getProperty("ducc.reload.file") != null) {
          return props.getProperty(type==0 ? "ducc.jobdriver.classpath" : "ducc.jobprocess.classpath");
      } else {
          cps = new String[2];
          cps[0] = props.getProperty("ducc.jobdriver.classpath");
          cps[1] = props.getProperty("ducc.jobprocess.classpath");
          return cps[type];
      }
  }
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

            resourceClasses.put(rc, rc);
            resourceClassesByName.put(rc.getName(), rc);
            logger.info(methodName, null, rc.toString());
        }

        DuccProperties dc = nc.getDefaultFairShareClass();
        if ( dc != null ) {
            defaultFairShareName = dc.getProperty("name");
        }

        dc = nc.getDefaultReserveClass();
        if ( dc != null ) {
            defaultReserveName = dc.getProperty("name");
        }

        // Instatntiate one scheduler per top-level nodepool
        try {
            schedImplName = SystemPropertyResolver.getStringProperty("ducc.rm.scheduler", "org.apache.uima.ducc.rm.ClassBasedScheduler");
            @SuppressWarnings("unchecked")
      Class<IScheduler> cl = (Class<IScheduler>) Class.forName(schedImplName);
            for ( int i = 0; i < nps.length; i++ ) {
                schedulers[i] = (IScheduler) cl.newInstance();
                schedulers[i].setEvictionPolicy(evictionPolicy);
            }

        } catch (ClassNotFoundException e) {
            throw new SchedulingException(null, "Cannot find class " + schedImplName);
        } catch (InstantiationException e) {
            throw new SchedulingException(null, "Cannot instantiate class " + schedImplName);           
        } catch (IllegalAccessException e) {
            throw new SchedulingException(null, "Cannot instantiate class " + schedImplName + ": can't access constructor.");           
        }

        // Here create the nodepool configuration
        for ( int i = 0; i < nps.length; i++ ) {
            DuccProperties np = nps[i];
            String id = np.getStringProperty("name");
            @SuppressWarnings("unchecked")
      Map<String, String> nodes = (Map<String, String>) np.get("nodes");
            nodepools[i] = new NodePool(null, id, nodes, evictionPolicy, 0, 0);
            schedulers[i].setNodePool(nodepools[i]);                    // set its top-level nodepool

            mapNodesToNodepool(nodes, nodepools[i]);
            logger.info(methodName, null, "Created top-level nodepool", id);

            @SuppressWarnings("unchecked")
      List<DuccProperties> children = (List<DuccProperties>) np.get("children");
            createSubpools(nodepools[i], children);

            Map<ResourceClass, ResourceClass> classesForNp = new HashMap<ResourceClass, ResourceClass>();
            getClassesForNodepool(np, classesForNp);           // all classes served by this heirarchy - fills in classesForNp
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

  private static String getDefaultFairShareClass() {
    String location = "getDefaultFairShareClass";
    String defaultReserveName = null;
    try {
      NodeConfiguration nc = getNodeConfiguration();
      DuccProperties rp = nc.getDefaultFairShareClass();
      defaultReserveName = rp.getProperty(name);
    }
    catch(Throwable t) {
      logger.error(location, jobid, t);
    }
    return defaultReserveName;
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

  private static String getDefaultFixedClass() {
    String location = "getDefaultFixedClass";
    String defaultFixedName = null;
    try {
      NodeConfiguration nc = getNodeConfiguration();
      DuccProperties rp = nc.getDefaultFixedClass();
      defaultFixedName = rp.getProperty(name);
    }
    catch(Throwable t) {
      logger.error(location, jobid, t);
    }
    return defaultFixedName;
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

      for ( String d : desclist) {
                if ( d.endsWith(".svc") ) {
                    int ndx = d.lastIndexOf(".");
                    String stem = d.substring(0, ndx);
                   
                    DuccProperties props = new DuccProperties();
                    String props_filename = serviceFileKey(d);
                    props.load(props_filename);

                   
                    DuccProperties metaprops = new DuccProperties();
                    String meta_filename = serviceFileKey(stem + ".meta");
                    metaprops.load(meta_filename);
                   
                    String sc = metaprops.getProperty("service-class");
                    if ( (sc != null) && ( sc.equals("Implicit") || sc.equals("Submitted") ) ) {
                        logger.info(methodName, null, "Scrubbing", sc, "service", stem);
                        deleteProperties(stem, meta_filename, metaprops, props_filename, props);
                        continue;
                    }
                   
                    int friendly = 0;
          String uuid = "";
          try {
            // these gets will throw if the requisite objects aren't found
            friendly = metaprops.getIntProperty("numeric_id");
            uuid = metaprops.getStringProperty("uuid");                       
          } catch (MissingPropertyException e1) {
            // Ugly, but shouldn't have to be fatal
            logger.error(methodName, null, "Cannot restore DuccId for", d, "Friendly id:", friendly, "uuid:", uuid);
            continue;
          }
                   
                    DuccId id = new DuccId(friendly);
                    id.setUUID(UUID.fromString(uuid));
                    logger.debug(methodName, id, "Unique:", id.getUnique());
                   
                    try {
                        handler.register(id, props_filename, meta_filename, props, metaprops);
                    } catch (IllegalStateException e ) {                 // happens on duplicate service
                        logger.error(methodName, id, e.getMessage())// message has all I need.
                    }
                       
                }
            }

    } catch (Throwable e) {
            // If we get here we aren't startable.
      logger.error(methodName, null, "Cannot initialize service manger: ", e.getMessage());
      System.exit(1);
    }

        state_dir = System.getProperty("DUCC_HOME") + "/state";
        state_file = state_dir + "/sm.properties";
        descriptor_dir = state_dir + "/services";
        File ddir = new File(descriptor_dir);
        if ( ddir.exists() ) {
            if ( ! ddir.isDirectory() ) {
                throw new IllegalStateException("Service descriptor location is not a directory: " + descriptor_dir);
            }
        } else {
            ddir.mkdirs();
        }

        sm_props = new DuccProperties();
        File sf = new File(state_file);
        int seq = 0;
        FileInputStream fos;
        if ( sf.exists() ) {
            fos = new FileInputStream(state_file);
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

    }

    public synchronized void register(ServiceRegisterEvent ev)
    {
        String methodName = "register";
        DuccProperties props = ev.getDescriptor();
        String endpoint = ev.getEndpoint();
        int instances = ev.getNinstances();
        Trinary autostart = ev.getAutostart();
        String user = ev.getUser();       
       
        if ( ! validate_user("Register", ev) ) return;   // necessary messages emitted in here

        DuccId id = null;
        try {
            id = newId();
        } catch ( Exception e ) {
            logger.error(methodName, null, e);
            ev.setReply(new ServiceReplyEvent(false, "Internal error; unable to generate id", endpoint, -1));
            return;
        }
        logger.debug(methodName, id, "Unique:", id.getUnique());
                   
        String logdir = props.getProperty(UiOption.LogDirectory.pname());
        if ( !logdir.endsWith("/") ) {
            logdir = logdir + "/";
        }
        logdir = logdir + "S-" + id.toString();
        props.put(UiOption.LogDirectory.pname(), logdir);

        DuccProperties meta = new DuccProperties();
        meta.setProperty("user", user);
        meta.setProperty("instances", ""+instances);
        meta.setProperty("endpoint", endpoint);
        meta.setProperty("numeric_id", id.toString());
        meta.setProperty("uuid", id.getUnique());
        if ( autostart == Trinary.True ) {           
            meta.setProperty("autostart", "true");
        } else {
            meta.setProperty("autostart", "false");
        }

        String desc_name = descriptor_dir + "/" + id + ".svc";
        String meta_name = descriptor_dir + "/" + id + ".meta";
        ServiceReplyEvent reply = handler.register(id, desc_name, meta_name, props, meta);
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

   * @param componentProperties
   *          - property file to read
   * @throws Exception
   */
  public void loadProperties(String componentProperties) throws Exception {
    DuccProperties duccProperties = new DuccProperties();
    duccProperties.load((String) System.getProperty(componentProperties));
    // resolve any placeholders
    enrichSystemPropertiesWith(duccProperties);
    // Compose Broker URL from parts defined in ducc.properties
    composeBrokerUrl();
    adjustEndpointsForSelectedTransport();
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

   
   
    PingDriver(ServiceSet sset)
    {       
        this.sset = sset;
        DuccProperties job_props = sset.getJobProperties();
        DuccProperties meta_props = sset.getMetaProperties();

        this.endpoint          = meta_props.getStringProperty("endpoint");
        this.user              = meta_props.getStringProperty("user");
        String jvm_args_str    = job_props.getStringProperty("service_ping_jvm_args", "");
        this.ping_class        = job_props.getStringProperty("service_ping_class", null);
        this.ping_arguments    = job_props.getStringProperty("service_ping_arguments", null);
       
        if ( (ping_class == null) || ping_class.equals(UimaAsPing.class.getName()) ) {
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

    /**
     * Test from main only
     */
    PingDriver(String props)
    {       
        DuccProperties dp = new DuccProperties();
        try {
      dp.load(props);
    } catch (Exception e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }

        this.endpoint = dp.getStringProperty("endpoint");
        String jvm_args_str = dp.getStringProperty("service_ping_jvm_args", "");
        this.ping_class = dp.getStringProperty("service_ping_class");
        this.classpath = dp.getStringProperty("service_ping_classpath");
        jvm_args = jvm_args_str.split(" ");
        this.test_mode = true;
    }
View Full Code Here

Examples of org.apache.uima.ducc.common.utils.DuccProperties

        if ( firstNodepool == null ) {
            firstNodepool = name;
        }

        DuccProperties ret = new DuccProperties();
        ret.put("type", "nodepool");
        ret.put("name", name);
        if ( parent != null ) {
            throw new IllegalConfigurationException("Illegal inheritance (inheritance not supported for nodepools) near line " + lineno + " in " + config_file_name);
        }

        parseInternal(ret);
        String dd = ret.getProperty("domain");
        if ( name.equals(firstNodepool) && (dd != null) ) {
            defaultDomain = dd;
        } else {
            if ( dd != null ) {
                throw new IllegalConfigurationException("Default domain specified in nodepool other than first nodepool \"" + firstNodepool + "\", not allowed, near line " + lineno + " in " + config_file_name);
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.