Package org.apache.nemo.runtime.master
Class RuntimeMaster
- java.lang.Object
-
- org.apache.nemo.runtime.master.RuntimeMaster
-
public final class RuntimeMaster extends java.lang.Object
(WARNING) Use runtimeMasterThread for all public methods to avoid race conditions. See comments in theScheduler
for avoiding race conditions.Runtime Master is the central controller of Runtime. Compiler submits an
PhysicalPlan
to Runtime Master to execute a job. Runtime Master handles: a) Scheduling the plan withScheduler
. b) Managing resources withContainerManager
. c) Managing blocks withBlockManagerMaster
. d) Receiving and sending control messages withMessageEnvironment
. e) Metric usingMetricMessageHandler
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
RuntimeMaster.MasterControlMessageReceiver
Handler for control messages received by Master.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Pair<PlanStateManager,java.util.concurrent.ScheduledExecutorService>
execute(PhysicalPlan plan, int maxScheduleAttempt)
Submits thePhysicalPlan
to Runtime.void
flushMetrics()
Flush metrics.void
onContainerAllocated(java.lang.String executorId, org.apache.reef.driver.evaluator.AllocatedEvaluator allocatedEvaluator, org.apache.reef.tang.Configuration executorConfiguration)
Called when a container is allocated for this runtime.void
onExecutorFailed(org.apache.reef.driver.evaluator.FailedEvaluator failedEvaluator)
Called when an executor fails due to container failure on this runtime.boolean
onExecutorLaunched(org.apache.reef.driver.context.ActiveContext activeContext)
Called when an executor is launched on a container for this runtime.void
recordIRDAGMetrics(IRDAG irdag, java.lang.String planId)
Record IR DAG related metrics.void
requestContainer(java.lang.String resourceSpecificationString)
Requests a container with resource specification.void
terminate()
Terminates the RuntimeMaster.
-
-
-
Method Detail
-
recordIRDAGMetrics
public void recordIRDAGMetrics(IRDAG irdag, java.lang.String planId)
Record IR DAG related metrics.- Parameters:
irdag
- the IR DAG to record.planId
- the ID of the IR DAG Physical Plan.
-
flushMetrics
public void flushMetrics()
Flush metrics.
-
execute
public Pair<PlanStateManager,java.util.concurrent.ScheduledExecutorService> execute(PhysicalPlan plan, int maxScheduleAttempt)
Submits thePhysicalPlan
to Runtime. At now, we are assuming that a single job submit multiple plans.- Parameters:
plan
- to executemaxScheduleAttempt
- the max number of times this plan/sub-part of the plan should be attempted.- Returns:
- pair of
PlanStateManager
andScheduledExecutorService
-
terminate
public void terminate()
Terminates the RuntimeMaster.
-
requestContainer
public void requestContainer(java.lang.String resourceSpecificationString)
Requests a container with resource specification.- Parameters:
resourceSpecificationString
- the resource specification.
-
onContainerAllocated
public void onContainerAllocated(java.lang.String executorId, org.apache.reef.driver.evaluator.AllocatedEvaluator allocatedEvaluator, org.apache.reef.tang.Configuration executorConfiguration)
Called when a container is allocated for this runtime. A wrapper function forContainerManager
.- Parameters:
executorId
- to use for the executor to be launched on this container.allocatedEvaluator
- to be used as the container.executorConfiguration
- to use for the executor to be launched on this container.
-
onExecutorLaunched
public boolean onExecutorLaunched(org.apache.reef.driver.context.ActiveContext activeContext)
Called when an executor is launched on a container for this runtime.- Parameters:
activeContext
- of the launched executor.- Returns:
- true if all requested executors have been launched, false otherwise.
-
onExecutorFailed
public void onExecutorFailed(org.apache.reef.driver.evaluator.FailedEvaluator failedEvaluator)
Called when an executor fails due to container failure on this runtime.- Parameters:
failedEvaluator
- that failed.
-
-