Skip to content

Commit 1c7efa5

Browse files
committed
Document Fn Execution API protos
Add documentation comments to previously undocumented messages and fields in the Beam Fn API protos: beam_fn_api.proto: ProcessBundleResponse, ProcessBundleProgressResponse, FinalizeBundleRequest/Response, Elements.DrainMode, StateRequest/Response, BeamFnState service, StateKey, StateAppendResponse, StateClearRequest/Response, OrderedListRange, LogControl, StartWorkerRequest/Response, StopWorkerRequest/Response, BeamFnExternalWorkerPool service. beam_provision_api.proto: Consistency fix on dependencies field.
1 parent 01b0972 commit 1c7efa5

2 files changed

Lines changed: 62 additions & 5 deletions

File tree

model/fn-execution/src/main/proto/org/apache/beam/model/fn_execution/v1/beam_fn_api.proto

Lines changed: 61 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ service BeamFnControl {
136136

137137
// Requests the ProcessBundleDescriptor with the given id.
138138
message GetProcessBundleDescriptorRequest {
139+
// (Required) The id of the ProcessBundleDescriptor to retrieve.
139140
string process_bundle_descriptor_id = 1;
140141
}
141142

@@ -426,6 +427,8 @@ message ProcessBundleRequest {
426427
bool only_bundle_for_keys = 5;
427428
}
428429

430+
// The response to a ProcessBundleRequest, returned by the SDK harness after
431+
// bundle processing completes (or is partially completed with residual roots).
429432
message ProcessBundleResponse {
430433
// (Optional) Specifies that the bundle has not been completed and the
431434
// following applications need to be scheduled and executed in the future.
@@ -495,6 +498,8 @@ message MonitoringInfosMetadataRequest {
495498
repeated string monitoring_info_id = 1;
496499
}
497500

501+
// A response containing progress information for a currently active bundle.
502+
// This is returned in response to a ProcessBundleProgressRequest.
498503
message ProcessBundleProgressResponse {
499504
// DEPRECATED (Required) The list of metrics or other MonitoredState
500505
// collected while processing this bundle.
@@ -705,12 +710,17 @@ message ProcessBundleSplitResponse {
705710
}
706711

707712

713+
// A request sent by the runner to finalize a bundle that previously indicated
714+
// it requires finalization (via requires_finalization in ProcessBundleResponse).
715+
// This is sent after the runner has committed the output of the bundle, allowing
716+
// the SDK to perform any post-commit cleanup.
708717
message FinalizeBundleRequest {
709718
// (Required) A reference to a completed process bundle request with the given
710719
// instruction id.
711720
string instruction_id = 1;
712721
}
713722

723+
// A response to a FinalizeBundleRequest, indicating that finalization is complete.
714724
message FinalizeBundleResponse {
715725
// Empty
716726
}
@@ -749,10 +759,16 @@ message Elements {
749759
bool is_last = 4;
750760
}
751761

762+
// Indicates whether the bundle is being drained. When draining, sources
763+
// should stop producing new data and the SDK should finish processing
764+
// in-flight elements.
752765
message DrainMode {
753766
enum Enum {
767+
// Drain mode has not been specified.
754768
UNSPECIFIED = 0;
769+
// The bundle is not being drained; normal processing continues.
755770
NOT_DRAINING = 1;
771+
// The bundle is being drained; sources should stop producing new data.
756772
DRAINING = 2;
757773
}
758774
}
@@ -783,6 +799,8 @@ message Elements {
783799
// Element metadata passed as part of WindowedValue to make WindowedValue
784800
// extensible and backward compatible
785801
message ElementMetadata {
802+
// (Optional) Indicates whether the bundle is being drained, allowing the
803+
// SDK to handle drain semantics for this element.
786804
optional DrainMode.Enum drain = 1;
787805
// (Optional) As part of https://www.w3.org/TR/trace-context/ we are forwarding a trace and participating in it.
788806
// Traceparent header represents the incoming request in a tracing system in a common format.
@@ -847,6 +865,9 @@ service BeamFnData {
847865
* State API
848866
*/
849867

868+
// A request sent by the SDK harness to the runner to get, append, or clear
869+
// state associated with a particular StateKey. State requests are scoped to
870+
// the instruction (bundle) that is currently being processed.
850871
message StateRequest {
851872
// (Required) A unique identifier provided by the SDK which represents this
852873
// requests execution. The StateResponse corresponding with this request
@@ -874,6 +895,8 @@ message StateRequest {
874895
}
875896
}
876897

898+
// A response from the runner to a StateRequest, containing the result of
899+
// the requested state operation.
877900
message StateResponse {
878901
// (Required) A reference provided by the SDK which represents a requests
879902
// execution. The StateResponse must have the matching id when responding
@@ -898,6 +921,10 @@ message StateResponse {
898921
}
899922
}
900923

924+
// An API for the SDK harness to access state stored by the runner on behalf
925+
// of the SDK. State is scoped to the currently processing bundle and can be
926+
// used for user state, side inputs, and runner-managed references.
927+
// Stable
901928
service BeamFnState {
902929
// Used to get/append/clear state stored by the runner on behalf of the SDK.
903930
rpc State(
@@ -909,6 +936,9 @@ service BeamFnState {
909936
stream StateResponse) {}
910937
}
911938

939+
// A key identifying which state to access. Exactly one of the oneof type
940+
// fields must be set, determining the kind of state being requested
941+
// (e.g. side input data, user state, or runner-managed references).
912942
message StateKey {
913943
message Runner {
914944
// (Required) Opaque information supplied by the runner. Used to support
@@ -1184,18 +1214,24 @@ message StateAppendRequest {
11841214
bytes data = 1;
11851215
}
11861216

1187-
// A response to append state.
1217+
// A response to a StateAppendRequest. Currently empty as append operations
1218+
// do not return data.
11881219
message StateAppendResponse {}
11891220

1190-
// A request to clear state.
1221+
// A request to clear all state associated with the given StateKey.
11911222
message StateClearRequest {}
11921223

1193-
// A response to clear state.
1224+
// A response to a StateClearRequest. Currently empty as clear operations
1225+
// do not return data.
11941226
message StateClearResponse {}
11951227

1196-
// A message describes a sort key range [start, end).
1228+
// A message describing a sort key range [start, end) for ordered list state.
1229+
// Used in OrderedListUserState to specify which portion of the ordered list
1230+
// to retrieve.
11971231
message OrderedListRange {
1232+
// (Required) The inclusive start of the sort key range.
11981233
int64 start = 1;
1234+
// (Required) The exclusive end of the sort key range.
11991235
int64 end = 2;
12001236
}
12011237

@@ -1289,6 +1325,8 @@ message LogEntry {
12891325
google.protobuf.Struct custom_data = 9;
12901326
}
12911327

1328+
// A control message sent from the runner to the SDK harness to configure
1329+
// logging behavior. Currently empty, reserved for future log-level control.
12921330
message LogControl {}
12931331

12941332
// Stable
@@ -1303,27 +1341,46 @@ service BeamFnLogging {
13031341
stream LogControl) {}
13041342
}
13051343

1344+
// A request from the runner to start a new SDK worker process with the given
1345+
// configuration, including endpoint addresses and parameters.
13061346
message StartWorkerRequest {
1347+
// (Required) A unique identifier for the worker to start.
13071348
string worker_id = 1;
1349+
// (Required) The control endpoint the worker should connect to.
13081350
org.apache.beam.model.pipeline.v1.ApiServiceDescriptor control_endpoint = 2;
1351+
// (Optional) The logging endpoint the worker should use.
13091352
org.apache.beam.model.pipeline.v1.ApiServiceDescriptor logging_endpoint = 3;
1353+
// (Optional) The artifact retrieval endpoint the worker should use.
13101354
org.apache.beam.model.pipeline.v1.ApiServiceDescriptor artifact_endpoint = 4;
1355+
// (Optional) The provisioning endpoint the worker should use.
13111356
org.apache.beam.model.pipeline.v1.ApiServiceDescriptor provision_endpoint = 5;
1357+
// (Optional) Additional runner-specific parameters to pass to the worker.
13121358
map<string, string> params = 10;
13131359
}
13141360

1361+
// A response from a StartWorkerRequest. If the worker failed to start,
1362+
// the error field will contain a human-readable error message.
13151363
message StartWorkerResponse {
1364+
// (Optional) Error message if the worker failed to start.
13161365
string error = 1;
13171366
}
13181367

1368+
// A request from the runner to stop a running SDK worker process.
13191369
message StopWorkerRequest {
1370+
// (Required) The unique identifier of the worker to stop.
13201371
string worker_id = 1;
13211372
}
13221373

1374+
// A response from a StopWorkerRequest. If the worker failed to stop
1375+
// cleanly, the error field will contain a human-readable error message.
13231376
message StopWorkerResponse {
1377+
// (Optional) Error message if the worker failed to stop.
13241378
string error = 1;
13251379
}
13261380

1381+
// An API for the runner to manage external SDK worker processes.
1382+
// Allows the runner to start and stop SDK worker instances, typically used
1383+
// for containerized or process-based execution environments.
13271384
service BeamFnExternalWorkerPool {
13281385
// Start the SDK worker with the given ID.
13291386
rpc StartWorker (StartWorkerRequest) returns (StartWorkerResponse) {}

model/fn-execution/src/main/proto/org/apache/beam/model/fn_execution/v1/beam_provision_api.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ message ProvisionInfo {
7575
// (optional) The control endpoint this SDK should use.
7676
org.apache.beam.model.pipeline.v1.ApiServiceDescriptor control_endpoint = 10;
7777

78-
// The set of dependencies that should be staged into this environment.
78+
// (optional) The set of dependencies that should be staged into this environment.
7979
repeated org.apache.beam.model.pipeline.v1.ArtifactInformation dependencies = 11;
8080

8181
// (optional) A set of capabilities that this SDK is allowed to use in its

0 commit comments

Comments
 (0)