gfw.common.beam.transforms.SampleAndLogElements#
- class SampleAndLogElements(sample_size=None, window_size=60, pretty_print=False, message='Element: {e}')[source]#
A Beam PTransform that logs elements of a PCollection.
- Parameters:
sample_size (int | None) – The number of elements to log. If not provided, logs all elements.
window_size (int) – The window duration in seconds used when sampling unbounded sources; only applicable when
sample_sizeis set.pretty_print (bool) – If True, formats each element as pretty-printed JSON when possible.
message (str) – A custom string format for the log message. Must contain the placeholder
{e}.
Methods
annotationsdefault_labeldefault_type_hintsReturns the display data associated to a pipeline component.
Log elements of a PCollection, optionally sampling a
sample_sizeelements.from_runner_apiget_resource_hintsGets and/or initializes type hints for this object.
Returns the window function to be associated with transform's output.
infer_output_typeregister_urnrunner_api_requires_keyed_inputto_runner_apito_runner_api_parameterto_runner_api_pickledtype_check_inputstype_check_inputs_or_outputstype_check_outputsAnnotates the input type of a
PTransformwith a type-hint.Annotates the output type of a
PTransformwith a type-hint.Adds resource hints to the
PTransform.Attributes
labelpipelineside_inputs