public interface JobTable extends AutoCloseable
JobTable's
task is to manage the lifecycle of a job on the TaskExecutor
.
There can always only be at most one job per JobID
. In order to create a JobTable.Job
one needs to provide a JobTable.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 respective JobTable.Connection
can be retrieved via its JobID
or via the ResourceID
of the leader. A
connection can be disconnected via JobTable.Connection.disconnect()
.
In order to clean up a JobTable.Job
one first needs to disconnect from the leading JobManager.
In order to completely remove the JobTable.Job
from the JobTable
, one needs to call JobTable.Job.close()
which also closes the associated JobTable.JobServices
instance.
Modifier and Type | Interface and 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.
|
Modifier and Type | Method and Description |
---|---|
Optional<JobTable.Connection> |
getConnection(JobID jobId)
Gets the connection registered under jobId.
|
Optional<JobTable.Connection> |
getConnection(ResourceID resourceId)
Gets the connection registered under resourceId.
|
Optional<JobTable.Job> |
getJob(JobID jobId)
Gets the job registered under jobId.
|
Collection<JobTable.Job> |
getJobs()
Gets all registered jobs.
|
<E extends Exception> |
getOrCreateJob(JobID jobId,
SupplierWithException<? extends JobTable.JobServices,E> jobServicesSupplier)
Gets a registered
JobTable.Job or creates one if not present. |
boolean |
isEmpty()
Returns
true if the job table does not contain any jobs. |
close
<E extends Exception> JobTable.Job getOrCreateJob(JobID jobId, SupplierWithException<? extends JobTable.JobServices,E> jobServicesSupplier) throws E extends Exception
JobTable.Job
or creates one if not present.jobId
- jobId identifies the job to getjobServicesSupplier
- jobServicesSupplier create new JobTable.JobServices
if a
new job needs to be createdE
- if the job services could not be createdE extends Exception
Optional<JobTable.Job> getJob(JobID jobId)
jobId
- jobId identifying the job to getOptional
containing the JobTable.Job
registered under jobId, or an empty
Optional
if no job has been registeredOptional<JobTable.Connection> getConnection(JobID jobId)
jobId
- jobId identifying the connection to getOptional
containing the JobTable.Connection
registered under jobId, or an
empty Optional
if no connection has been registered (this could also mean that a
job which has not been connected exists)Optional<JobTable.Connection> getConnection(ResourceID resourceId)
resourceId
- resourceId identifying the connection to getOptional
containing the JobTable.Connection
registered under resourceId, or
an empty Optional
if no connection has been registeredCollection<JobTable.Job> getJobs()
boolean isEmpty()
true
if the job table does not contain any jobs.true
if the job table does not contain any jobs, otherwise false
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.