Package org.apache.beam.runners.dataflow
Class DataflowPipelineJob
java.lang.Object
org.apache.beam.runners.dataflow.DataflowPipelineJob
- All Implemented Interfaces:
PipelineResult
- Direct Known Subclasses:
DataflowTemplateJob
A DataflowPipelineJob represents a job submitted to Dataflow using
DataflowRunner
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.apache.beam.sdk.PipelineResult
PipelineResult.State
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final org.apache.beam.sdk.util.FluentBackoff
-
Constructor Summary
ConstructorsConstructorDescriptionDataflowPipelineJob
(DataflowClient dataflowClient, String jobId, DataflowPipelineOptions dataflowOptions, Map<org.apache.beam.sdk.runners.AppliedPTransform<?, ?, ?>, String> transformStepNames) Constructs the job.DataflowPipelineJob
(DataflowClient dataflowClient, String jobId, DataflowPipelineOptions dataflowOptions, Map<org.apache.beam.sdk.runners.AppliedPTransform<?, ?, ?>, String> transformStepNames, @Nullable org.apache.beam.model.pipeline.v1.RunnerApi.Pipeline pipelineProto) Constructs the job. -
Method Summary
Modifier and TypeMethodDescriptioncancel()
Cancels the pipeline execution.getJobId()
Get the id of this job.@Nullable org.apache.beam.model.pipeline.v1.RunnerApi.Pipeline
Get the Runner API pipeline proto if available.Get the project this job exists in.Get the region this job exists in.Returns a newDataflowPipelineJob
for the job that replaced this one, if applicable.getState()
Retrieves the current state of the pipeline execution.protected @Nullable org.apache.beam.vendor.guava.v32_1_2_jre.com.google.common.collect.BiMap
<org.apache.beam.sdk.runners.AppliedPTransform<?, ?, ?>, String> metrics()
Returns the object to access metrics from the pipeline.Waits until the pipeline finishes and returns the final status.waitUntilFinish
(Duration duration) Waits until the pipeline finishes and returns the final status.waitUntilFinish
(Duration duration, MonitoringUtil.JobMessagesHandler messageHandler) Waits until the pipeline finishes and returns the final status.
-
Field Details
-
STATUS_BACKOFF_FACTORY
protected static final org.apache.beam.sdk.util.FluentBackoff STATUS_BACKOFF_FACTORY
-
-
Constructor Details
-
DataflowPipelineJob
public DataflowPipelineJob(DataflowClient dataflowClient, String jobId, DataflowPipelineOptions dataflowOptions, Map<org.apache.beam.sdk.runners.AppliedPTransform<?, ?, ?>, String> transformStepNames, @Nullable org.apache.beam.model.pipeline.v1.RunnerApi.Pipeline pipelineProto) Constructs the job.- Parameters:
jobId
- the job iddataflowOptions
- used to configure the client for the Dataflow ServicetransformStepNames
- a mapping from AppliedPTransforms to Step NamespipelineProto
- Runner API pipeline proto.
-
DataflowPipelineJob
public DataflowPipelineJob(DataflowClient dataflowClient, String jobId, DataflowPipelineOptions dataflowOptions, Map<org.apache.beam.sdk.runners.AppliedPTransform<?, ?, ?>, String> transformStepNames) Constructs the job.- Parameters:
jobId
- the job iddataflowOptions
- used to configure the client for the Dataflow ServicetransformStepNames
- a mapping from AppliedPTransforms to Step Names
-
-
Method Details
-
getJobId
Get the id of this job. -
getProjectId
Get the project this job exists in. -
getDataflowOptions
-
getPipelineProto
Get the Runner API pipeline proto if available. -
getRegion
Get the region this job exists in. -
getTransformStepNames
-
getReplacedByJob
Returns a newDataflowPipelineJob
for the job that replaced this one, if applicable.- Throws:
IllegalStateException
- if called before the job has terminated or if the job terminated but was not updated
-
waitUntilFinish
Description copied from interface:PipelineResult
Waits until the pipeline finishes and returns the final status.- Specified by:
waitUntilFinish
in interfacePipelineResult
- Returns:
- The final state of the pipeline.
-
waitUntilFinish
Description copied from interface:PipelineResult
Waits until the pipeline finishes and returns the final status. It times out after the given duration.- Specified by:
waitUntilFinish
in interfacePipelineResult
- Parameters:
duration
- The time to wait for the pipeline to finish. Provide a value less than 1 ms for an infinite wait.- Returns:
- The final state of the pipeline or null on timeout.
-
waitUntilFinish
public @Nullable PipelineResult.State waitUntilFinish(Duration duration, MonitoringUtil.JobMessagesHandler messageHandler) throws IOException, InterruptedException Waits until the pipeline finishes and returns the final status.- Parameters:
duration
- The time to wait for the job to finish. Provide a value less than 1 ms for an infinite wait.messageHandler
- If non null this handler will be invoked for each batch of messages received.- Returns:
- The final state of the job or null on timeout or if the thread is interrupted.
- Throws:
IOException
- If there is a persistent problem getting job information.InterruptedException
-
cancel
Description copied from interface:PipelineResult
Cancels the pipeline execution.- Specified by:
cancel
in interfacePipelineResult
- Throws:
IOException
- if there is a problem executing the cancel request.
-
getState
Description copied from interface:PipelineResult
Retrieves the current state of the pipeline execution.- Specified by:
getState
in interfacePipelineResult
- Returns:
- the
PipelineResult.State
representing the state of this pipeline.
-
metrics
Description copied from interface:PipelineResult
Returns the object to access metrics from the pipeline.- Specified by:
metrics
in interfacePipelineResult
-