Examples of LocalAssignment


Examples of com.alibaba.jstorm.task.LocalAssignment

      // a port must be assigned one storm
      for (Entry<Integer, LocalAssignment> entry : portTasks.entrySet()) {

        Integer port = entry.getKey();

        LocalAssignment la = entry.getValue();

        if (!portLA.containsKey(port)) {
          portLA.put(port, la);
        } else {
          throw new RuntimeException(
View Full Code Here

Examples of com.alibaba.jstorm.task.LocalAssignment

    for (ResourceWorkerSlot worker : workers) {
      if (!supervisorId.equals(worker.getNodeId()))
        continue;
      portTasks.put(worker.getPort(),
          new LocalAssignment(topologyId, worker.getTasks(),
              stormBase.getStormName(), worker.getMemSize(),
              worker.getCpu(), worker.getJvm()));
    }

    return portTasks;
View Full Code Here

Examples of com.alibaba.jstorm.task.LocalAssignment

   */
  public boolean matchesAssignment(WorkerHeartbeat whb,
      Map<Integer, LocalAssignment> assignedTasks) {

    boolean isMatch = true;
    LocalAssignment localAssignment = assignedTasks.get(whb.getPort());

    if (localAssignment == null) {
      isMatch = false;
    } else if (!whb.getTopologyId().equals(localAssignment.getTopologyId())) {
      // topology id not equal
      LOG.info("topology id not equal whb=" + whb.getTopologyId()
          + ",localAssignment=" + localAssignment.getTopologyId());
      isMatch = false;
    } else if (!(whb.getTaskIds().equals(localAssignment.getTaskIds()))) {
      // task-id isn't equal
      LOG.info("task-id isn't equal whb=" + whb.getTaskIds()
          + ",localAssignment=" + localAssignment.getTaskIds());
      isMatch = false;
    }

    return isMatch;
  }
View Full Code Here

Examples of com.alibaba.jstorm.task.LocalAssignment

     */
    Map<Integer, String> newWorkerIds = new HashMap<Integer, String>();

    for (Entry<Integer, LocalAssignment> entry : newWorkers.entrySet()) {
      Integer port = entry.getKey();
      LocalAssignment assignment = entry.getValue();

      String workerId = UUID.randomUUID().toString();

      newWorkerIds.put(port, workerId);

      // create new worker Id directory
      // LOCALDIR/workers/newworkid/pids
      try {
        StormConfig.worker_pids_root(conf, workerId);
      } catch (IOException e1) {
        LOG.error("Failed to create " + workerId + " localdir", e1);
        throw e1;
      }

      StringBuilder sb = new StringBuilder();
      sb.append("Launching worker with assiangment ");
      sb.append(assignment.toString());
      sb.append(" for the supervisor ");
      sb.append(supervisorId);
      sb.append(" on port ");
      sb.append(port);
      sb.append(" with id ");
      sb.append(workerId);
      LOG.info(sb);

      try {
        String clusterMode = StormConfig.cluster_mode(conf);

        if (clusterMode.equals("distributed")) {
          launchWorker(conf, sharedContext,
              assignment.getTopologyId(), supervisorId, port,
              workerId, assignment);
        } else if (clusterMode.equals("local")) {
          launchWorker(conf, sharedContext,
              assignment.getTopologyId(), supervisorId, port,
              workerId, workerThreadPids);
        }
      } catch (Exception e) {
        String errorMsg = "Failed to launchWorker workerId:" + workerId
            + ":" + port;
View Full Code Here

Examples of com.alipay.bluewhale.core.task.LocalAssignment

      Set<Entry<Integer, LocalAssignment>> reassignTasksEntrySet = reassignTasks
          .entrySet();
      for (Entry<Integer, LocalAssignment> entry : reassignTasksEntrySet) {

        Integer port = entry.getKey();
        LocalAssignment assignment = entry.getValue();

        String workerId = newWorkerIds.get(port);

        StringBuilder sb = new StringBuilder();
        sb.append("Launching worker with assiangment ");
        sb.append(assignment.toString());
        sb.append(" for the supervisor ");
        sb.append(supervisorId);
        sb.append(" on port ");
        sb.append(port);
        sb.append(" with id ");
        sb.append(workerId);
        LOG.info(sb);

        try {
          String clusterMode = StormConfig.cluster_mode(conf);

          if (clusterMode.equals("distributed")) {
            launchWorker(conf, sharedContext,
                assignment.getTopologyId(), supervisorId, port,
                workerId);
          } else if (clusterMode.equals("local")) {
            // in fact, this is no use
            launchWorker(conf, sharedContext,
                assignment.getTopologyId(), supervisorId, port,
                workerId, workerThreadPids);
          }
        } catch (Exception e) {
          String errorMsg = "Failed to launchWorker workerId:"
              + workerId + ":" + port;
View Full Code Here

Examples of com.alipay.bluewhale.core.task.LocalAssignment

   */
  public boolean matchesAssignment(WorkerHeartbeat whb,
      Map<Integer, LocalAssignment> assignedTasks) {

    boolean isMatch = true;
    LocalAssignment localAssignment = assignedTasks.get(whb.getPort());

    if (localAssignment == null) {
      isMatch = false;
    } else if (!whb.getTopologyId().equals(localAssignment.getTopologyId())) {
      // topology id not equal
      LOG.info("topology id not equal whb=" + whb.getTopologyId()
          + ",localAssignment=" + localAssignment.getTopologyId());
      isMatch = false;
    } else if (!(whb.getTaskIds().equals(localAssignment.getTaskIds()))) {
      // task-id isn't equal
      LOG.info("task-id isn't equal whb=" + whb.getTaskIds()
          + ",localAssignment=" + localAssignment.getTaskIds());
      isMatch = false;
    }

    return isMatch;
  }
View Full Code Here

Examples of com.alipay.bluewhale.core.task.LocalAssignment

            .entrySet();
        for (Entry<Integer, LocalAssignment> entry : entrySet) {

          Integer port = entry.getKey();

          LocalAssignment la = entry.getValue();

          if (!portLA.containsKey(port)) {
            portLA.put(port, la);
          } else {
            throw new RuntimeException(
View Full Code Here

Examples of com.alipay.bluewhale.core.task.LocalAssignment

            continue;
          }

          if (portTasks.containsKey(port)) {

            LocalAssignment la = portTasks.get(port);

            Set<Integer> taskIds = la.getTaskIds();

            taskIds.add(taskId);

          } else {

            Set<Integer> taskIds = new HashSet<Integer>();

            taskIds.add(taskId);

            LocalAssignment la = new LocalAssignment(topologyId,
                taskIds);

            portTasks.put(port, la);
          }
        }
View Full Code Here

Examples of com.google.test.metric.method.op.turing.LocalAssignment

          FieldInfo fieldInfo = new FieldInfo(classInfo, leftDeclaration
              .getName(), fieldType, false, false, false);
          operations.add(new FieldAssignment(assignmentExpression
              .getLineNumber(), leftVar, fieldInfo, rightVar));
        } else {
          operations.add(new LocalAssignment(assignmentExpression
              .getLineNumber(), leftVar, rightVar));
        }
      }
    }
View Full Code Here

Examples of com.google.test.metric.method.op.turing.LocalAssignment

    return JavaType.isDoubleSlot(variable.getType()) ? 2 : 1;
  }

  @Override
  public Operation toOperation(List<Variable> input) {
    return new LocalAssignment(lineNumber, variable, input.get(0));
  }
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.