Interface JobTable
-
- All Superinterfaces:
AutoCloseable
- All Known Implementing Classes:
DefaultJobTable
public interface JobTable extends AutoCloseable
AJobTable's
task is to manage the lifecycle of a job on theTaskExecutor
.There can always only be at most one job per
JobID
. In order to create aJobTable.Job
one needs to provide aJobTable.JobServices
instance which is owned by the job.A job can be connected to a leading JobManager or can be disconnected. In order to establish a connection, one needs to call
JobTable.Job.connect(org.apache.flink.runtime.clusterframework.types.ResourceID, org.apache.flink.runtime.jobmaster.JobMasterGateway, org.apache.flink.runtime.taskmanager.TaskManagerActions, org.apache.flink.runtime.taskmanager.CheckpointResponder, org.apache.flink.runtime.taskexecutor.GlobalAggregateManager, org.apache.flink.runtime.taskexecutor.PartitionProducerStateChecker)
. Once a job is connected, the respectiveJobTable.Connection
can be retrieved via itsJobID
or via theResourceID
of the leader. A connection can be disconnected viaJobTable.Connection.disconnect()
.In order to clean up a
JobTable.Job
one first needs to disconnect from the leading JobManager. In order to completely remove theJobTable.Job
from theJobTable
, one needs to callJobTable.Job.close()
which also closes the associatedJobTable.JobServices
instance.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
JobTable.Connection
A connection contains services bound to the lifetime of a connection with a JobManager.static interface
JobTable.Job
A job contains services which are bound to the lifetime of a Flink job.static interface
JobTable.JobServices
Services associated with a job.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Optional<JobTable.Connection>
getConnection(org.apache.flink.api.common.JobID jobId)
Gets the connection registered under jobId.Optional<JobTable.Connection>
getConnection(ResourceID resourceId)
Gets the connection registered under resourceId.Optional<JobTable.Job>
getJob(org.apache.flink.api.common.JobID jobId)
Gets the job registered under jobId.Collection<JobTable.Job>
getJobs()
Gets all registered jobs.<E extends Exception>
JobTable.JobgetOrCreateJob(org.apache.flink.api.common.JobID jobId, org.apache.flink.util.function.SupplierWithException<? extends JobTable.JobServices,E> jobServicesSupplier)
Gets a registeredJobTable.Job
or creates one if not present.boolean
isEmpty()
Returnstrue
if the job table does not contain any jobs.-
Methods inherited from interface java.lang.AutoCloseable
close
-
-
-
-
Method Detail
-
getOrCreateJob
<E extends Exception> JobTable.Job getOrCreateJob(org.apache.flink.api.common.JobID jobId, org.apache.flink.util.function.SupplierWithException<? extends JobTable.JobServices,E> jobServicesSupplier) throws E extends Exception
Gets a registeredJobTable.Job
or creates one if not present.- Parameters:
jobId
- jobId identifies the job to getjobServicesSupplier
- jobServicesSupplier create newJobTable.JobServices
if a new job needs to be created- Returns:
- the current job (existing or created) registered under jobId
- Throws:
E
- if the job services could not be createdE extends Exception
-
getJob
Optional<JobTable.Job> getJob(org.apache.flink.api.common.JobID jobId)
Gets the job registered under jobId.- Parameters:
jobId
- jobId identifying the job to get- Returns:
- an
Optional
containing theJobTable.Job
registered under jobId, or an emptyOptional
if no job has been registered
-
getConnection
Optional<JobTable.Connection> getConnection(org.apache.flink.api.common.JobID jobId)
Gets the connection registered under jobId.- Parameters:
jobId
- jobId identifying the connection to get- Returns:
- an
Optional
containing theJobTable.Connection
registered under jobId, or an emptyOptional
if no connection has been registered (this could also mean that a job which has not been connected exists)
-
getConnection
Optional<JobTable.Connection> getConnection(ResourceID resourceId)
Gets the connection registered under resourceId.- Parameters:
resourceId
- resourceId identifying the connection to get- Returns:
- an
Optional
containing theJobTable.Connection
registered under resourceId, or an emptyOptional
if no connection has been registered
-
getJobs
Collection<JobTable.Job> getJobs()
Gets all registered jobs.- Returns:
- collection of registered jobs
-
isEmpty
boolean isEmpty()
Returnstrue
if the job table does not contain any jobs.- Returns:
true
if the job table does not contain any jobs, otherwisefalse
-
-