flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tillrohrmann <...@git.apache.org>
Subject [GitHub] flink pull request #4985: [FLINK-8027] Generalize existing rest handlers to ...
Date Wed, 29 Nov 2017 17:06:07 GMT
Github user tillrohrmann commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4985#discussion_r153852356
  
    --- Diff: flink-runtime/src/test/java/org/apache/flink/runtime/taskexecutor/TestingTaskExecutorGateway.java
---
    @@ -0,0 +1,124 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one
    + * or more contributor license agreements.  See the NOTICE file
    + * distributed with this work for additional information
    + * regarding copyright ownership.  The ASF licenses this file
    + * to you under the Apache License, Version 2.0 (the
    + * "License"); you may not use this file except in compliance
    + * with the License.  You may obtain a copy of the License at
    + *
    + *     http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +package org.apache.flink.runtime.taskexecutor;
    +
    +import org.apache.flink.api.common.JobID;
    +import org.apache.flink.api.common.time.Time;
    +import org.apache.flink.runtime.checkpoint.CheckpointOptions;
    +import org.apache.flink.runtime.clusterframework.types.AllocationID;
    +import org.apache.flink.runtime.clusterframework.types.ResourceID;
    +import org.apache.flink.runtime.clusterframework.types.SlotID;
    +import org.apache.flink.runtime.deployment.TaskDeploymentDescriptor;
    +import org.apache.flink.runtime.executiongraph.ExecutionAttemptID;
    +import org.apache.flink.runtime.executiongraph.PartitionInfo;
    +import org.apache.flink.runtime.jobmaster.JobMasterId;
    +import org.apache.flink.runtime.messages.Acknowledge;
    +import org.apache.flink.runtime.resourcemanager.ResourceManagerId;
    +import org.apache.flink.util.Preconditions;
    +
    +import java.util.concurrent.CompletableFuture;
    +
    +/**
    + * Simple {@link TaskExecutorGateway} implementation for testing purposes.
    + */
    +public class TestingTaskExecutorGateway implements TaskExecutorGateway {
    +
    +	private final String address;
    +
    +	private final String hostname;
    +
    +	public TestingTaskExecutorGateway() {
    +		this("foobar:1234", "foobar");
    +	}
    +
    +	public TestingTaskExecutorGateway(String address, String hostname) {
    +		this.address = Preconditions.checkNotNull(address);
    +		this.hostname = Preconditions.checkNotNull(hostname);
    +	}
    +
    +	@Override
    +	public CompletableFuture<Acknowledge> requestSlot(SlotID slotId, JobID jobId,
AllocationID allocationId, String targetAddress, ResourceManagerId resourceManagerId, Time
timeout) {
    +		return CompletableFuture.completedFuture(Acknowledge.get());
    +	}
    +
    +	@Override
    +	public CompletableFuture<Acknowledge> submitTask(TaskDeploymentDescriptor tdd,
JobMasterId jobMasterId, Time timeout) {
    +		return CompletableFuture.completedFuture(Acknowledge.get());
    +	}
    +
    +	@Override
    +	public CompletableFuture<Acknowledge> updatePartitions(ExecutionAttemptID executionAttemptID,
Iterable<PartitionInfo> partitionInfos, Time timeout) {
    +		return CompletableFuture.completedFuture(Acknowledge.get());
    +	}
    +
    +	@Override
    +	public void failPartition(ExecutionAttemptID executionAttemptID) {
    +		// noop
    +	}
    +
    +	@Override
    +	public CompletableFuture<Acknowledge> triggerCheckpoint(ExecutionAttemptID executionAttemptID,
long checkpointID, long checkpointTimestamp, CheckpointOptions checkpointOptions) {
    +		return CompletableFuture.completedFuture(Acknowledge.get());
    +	}
    +
    +	@Override
    +	public CompletableFuture<Acknowledge> confirmCheckpoint(ExecutionAttemptID executionAttemptID,
long checkpointId, long checkpointTimestamp) {
    +		return CompletableFuture.completedFuture(Acknowledge.get());
    +	}
    +
    +	@Override
    +	public CompletableFuture<Acknowledge> stopTask(ExecutionAttemptID executionAttemptID,
Time timeout) {
    +		return CompletableFuture.completedFuture(Acknowledge.get());
    +	}
    +
    +	@Override
    +	public CompletableFuture<Acknowledge> cancelTask(ExecutionAttemptID executionAttemptID,
Time timeout) {
    +		return CompletableFuture.completedFuture(Acknowledge.get());
    +	}
    +
    +	@Override
    +	public void heartbeatFromJobManager(ResourceID heartbeatOrigin) {
    +		// noop
    +	}
    +
    +	@Override
    +	public void heartbeatFromResourceManager(ResourceID heartbeatOrigin) {
    +		// noop
    +	}
    +
    +	@Override
    +	public void disconnectJobManager(JobID jobId, Exception cause) {
    +		// nooop
    --- End diff --
    
    Good point. Will fix it.


---

Mime
View raw message