Beispiel #1
0
  private static Task createTask() {
    LibraryCacheManager libCache = mock(LibraryCacheManager.class);
    when(libCache.getClassLoader(any(JobID.class))).thenReturn(ClassLoader.getSystemClassLoader());

    ResultPartitionManager partitionManager = mock(ResultPartitionManager.class);
    ResultPartitionConsumableNotifier consumableNotifier =
        mock(ResultPartitionConsumableNotifier.class);
    NetworkEnvironment networkEnvironment = mock(NetworkEnvironment.class);
    when(networkEnvironment.getPartitionManager()).thenReturn(partitionManager);
    when(networkEnvironment.getPartitionConsumableNotifier()).thenReturn(consumableNotifier);
    when(networkEnvironment.getDefaultIOMode()).thenReturn(IOManager.IOMode.SYNC);

    TaskDeploymentDescriptor tdd =
        new TaskDeploymentDescriptor(
            new JobID(),
            new JobVertexID(),
            new ExecutionAttemptID(),
            "Test Task",
            0,
            1,
            new Configuration(),
            new Configuration(),
            CheckpointsInOrderInvokable.class.getName(),
            Collections.<ResultPartitionDeploymentDescriptor>emptyList(),
            Collections.<InputGateDeploymentDescriptor>emptyList(),
            Collections.<BlobKey>emptyList(),
            0);

    ActorGateway taskManagerGateway = DummyActorGateway.INSTANCE;
    return new Task(
        tdd,
        mock(MemoryManager.class),
        mock(IOManager.class),
        networkEnvironment,
        mock(BroadcastVariableManager.class),
        taskManagerGateway,
        DummyActorGateway.INSTANCE,
        new FiniteDuration(60, TimeUnit.SECONDS),
        libCache,
        mock(FileCache.class),
        new TaskManagerRuntimeInfo("localhost", new Configuration()));
  }