Package org.apache.flink.runtime.instance

Examples of org.apache.flink.runtime.instance.AllocatedSlot


    String host = null;
    Execution execution = graph.getRegisteredExecutions().get(executionAttempt);
    if(execution == null) {
      LOG.error("Can not find Execution for attempt " + executionAttempt);
    } else {
      AllocatedSlot slot = execution.getAssignedResource();
      if(slot != null) {
        host = slot.getInstance().getInstanceConnectionInfo().getHostname();
      }
    }
   
    return splitAssigner.getNextInputSplit(host);
  }
View Full Code Here


   
    try {
      // a slot than cannot be deployed to
      final TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      final Instance instance = getInstance(taskManager);
      final AllocatedSlot slot = instance.allocateSlot(new JobID());
      slot.cancel();
      assertFalse(slot.isReleased());
     
      final ExecutionJobVertex ejv = getJobVertexNotExecuting(new JobVertexID());
      final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
     
      Scheduler scheduler = mock(Scheduler.class);
      when(scheduler.scheduleImmediately(Matchers.any(ScheduledUnit.class))).thenReturn(slot);
     
      assertEquals(ExecutionState.CREATED, vertex.getExecutionState());
      // try to deploy to the slot
      vertex.scheduleForExecution(scheduler, false);
     
      // will have failed
      assertEquals(ExecutionState.FAILED, vertex.getExecutionState());
      assertTrue(slot.isReleased());
     
      verify(taskManager, times(0)).submitTask(Matchers.any(TaskDeploymentDescriptor.class));
    }
    catch (Exception e) {
      e.printStackTrace();
View Full Code Here

    try {
      // a slot than cannot be deployed to
      final TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      final Instance instance = getInstance(taskManager);
      final AllocatedSlot slot = instance.allocateSlot(new JobID());
      slot.cancel();
      assertFalse(slot.isReleased());
     
      final SlotAllocationFuture future = new SlotAllocationFuture();
     
      final ExecutionJobVertex ejv = getJobVertexNotExecuting(new JobVertexID());
      final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
     
      Scheduler scheduler = mock(Scheduler.class);
      when(scheduler.scheduleQueued(Matchers.any(ScheduledUnit.class))).thenReturn(future);
     
      assertEquals(ExecutionState.CREATED, vertex.getExecutionState());
      // try to deploy to the slot
      vertex.scheduleForExecution(scheduler, true);
     
      // future has not yet a slot
      assertEquals(ExecutionState.SCHEDULED, vertex.getExecutionState());
     
      future.setSlot(slot);
     
      // will have failed
      assertEquals(ExecutionState.FAILED, vertex.getExecutionState());
      assertTrue(slot.isReleased());
     
      verify(taskManager, times(0)).submitTask(Matchers.any(TaskDeploymentDescriptor.class));
    }
    catch (Exception e) {
      e.printStackTrace();
View Full Code Here

  public void testScheduleToDeploy() {
    try {
      // a slot than cannot be deployed to
      final TaskOperationProtocol taskManager = mock(TaskOperationProtocol.class);
      final Instance instance = getInstance(taskManager);
      final AllocatedSlot slot = instance.allocateSlot(new JobID());
     
      final ExecutionJobVertex ejv = getJobVertexNotExecuting(new JobVertexID());
      final ExecutionVertex vertex = new ExecutionVertex(ejv, 0, new IntermediateResult[0]);
     
      Scheduler scheduler = mock(Scheduler.class);
View Full Code Here

    json.append("{");
    json.append("\"vertexid\": \"" + vertex.getCurrentExecutionAttempt().getAttemptId() + "\",");
    json.append("\"vertexname\": \"" + StringUtils.escapeHtml(vertex.getSimpleName()) + "\",");
    json.append("\"vertexstatus\": \"" + vertex.getExecutionState() + "\",");
   
    AllocatedSlot slot = vertex.getCurrentAssignedResource();
    String instanceName = slot == null ? "(null)" : slot.getInstance().getInstanceConnectionInfo().getFQDNHostname();
   
    json.append("\"vertexinstancename\": \"" + instanceName + "\"");
    json.append("}");
    return json.toString();
  }
View Full Code Here

      if (jobEvent.getJobStatus() == JobStatus.FAILED) {
        wrt.write("\"failednodes\": [");
        boolean first = true;
        for (ExecutionVertex vertex : graph.getAllExecutionVertices()) {
          if (vertex.getExecutionState() == ExecutionState.FAILED) {
            AllocatedSlot slot = vertex.getCurrentAssignedResource();
            Throwable failureCause = vertex.getFailureCause();
            if (slot != null || failureCause != null) {
              if (first) {
                first = false;
              } else {
                wrt.write(",");
              }
              wrt.write("{");
              wrt.write("\"node\": \"" + (slot == null ? "(none)" : slot.getInstance().getInstanceConnectionInfo().getFQDNHostname()) + "\",");
              wrt.write("\"message\": \"" + (failureCause == null ? "" : StringUtils.escapeHtml(ExceptionUtils.stringifyException(failureCause))) + "\"");
              wrt.write("}");
            }
          }
        }
View Full Code Here

TOP

Related Classes of org.apache.flink.runtime.instance.AllocatedSlot

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.