apache / apache/beam

Server-side Dataflow job idempotence

Open
#21,522 0 comments 0 reactions 0 assignees View on GitHub
dataflow improvement P2 runners
Dominant language
Java
Stars
8.7k
Forks
4.7k
Avg merge
1d 20h
Merged PRs (30d)
196

Description

*Issue*: when a job submission is retried, it may result in duplicate Dataflow jobs. The Dataflow job `name` only guarantees uniqueness for _active_ jobs \-- that is, if a job with the same name exists but is already completed, the same `name` is allowed again. What we would like is job uniqueness regardless of job status.

The Dataflow API provides a way to ensure unique jobs through the use of `clientRequestId`:
```

The client's unique identifier of the job, re-used
across retried attempts. If this field is set,
the service will ensure
its uniqueness. The request to create a job will fail if the service has

knowledge of a previously submitted job with the same client's ID and
job name. The caller may use
this field to ensure idempotence of job
creation across retried attempts to create a job. By default,
the field
is empty and, in that case, the service ignores it.
```

[https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.locations.jobs](https://cloud.google.com/dataflow/docs/reference/rest/v1b3/projects.locations.jobs)

In DataflowRunner.java, `clientRequestId` is set with [a randomized value](https://github.com/apache/beam/blob/v2.37.0/runners/google-cloud-dataflow-java/src/main/java/org/apache/beam/runners/dataflow/DataflowRunner.java#L1125).

*Proposed solution*: provide the ability to pass in a `clientRequestId` through `DataflowPipelineOptions` and set it on the `Job` when available, otherwise default to the randomized value.

Imported from Jira [BEAM-14284](https://issues.apache.org/jira/browse/BEAM-14284). Original Jira may contain additional context.
Reported by: toltol.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.