blob: e8183441c5e8089d93b8c942723c15167322c503 [file] [log] [blame]
/*
* 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.wayang.core.platform;
import org.apache.wayang.core.api.Job;
import org.apache.wayang.core.optimizer.OptimizationContext;
import org.apache.wayang.core.plan.executionplan.ExecutionStage;
import org.apache.wayang.core.plan.wayangplan.ExecutionOperator;
/**
* An executor executes {@link ExecutionOperator}s.
*/
public interface Executor extends CompositeExecutionResource {
/**
* Executes the given {@code stage}.
*
* @param stage should be executed; must be executable by this instance, though
* @param optimizationContext
*@param executionState provides and accepts execution-related objects @return collected metadata from instrumentation
*/
void execute(ExecutionStage stage, OptimizationContext optimizationContext, ExecutionState executionState);
/**
* Releases any instances acquired by this instance to execute {@link ExecutionStage}s.
*/
void dispose();
/**
* @return the {@link Platform} this instance belongs to
*/
Platform getPlatform();
/**
* If this instance is instrumented by a {@link CrossPlatformExecutor}, this method provides the latter.
*
* @return the instrumenting {@link CrossPlatformExecutor} or {@code null} if none
*/
CrossPlatformExecutor getCrossPlatformExecutor();
/**
* Factory for {@link Executor}s.
*/
interface Factory {
/**
* @return a new {@link Executor}
*/
Executor create(Job job);
}
}