schrodinger.seam.testing.benchmarks module¶
Benchmarks for different parts of the SeamRunner or Seam transforms.
Usage:
$SCHRODINGER/run seam_benchmarks.py
- class schrodinger.seam.testing.benchmarks.BenchmarkResult(value: float, units: Optional[str] = None)¶
Bases:
object- Variables:
value – Current value of the metric
units – (optional) units of the value.
- value: float¶
- units: Optional[str] = None¶
- __init__(value: float, units: Optional[str] = None) None¶
- class schrodinger.seam.testing.benchmarks.Benchmark¶
Bases:
object- UNIT_TEST_N = 1¶
- PERFORMANCE_TEST_N = 500¶
- SKIP = False¶
- setup()¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- schrodinger.seam.testing.benchmarks.tmp_cwd()¶
- class schrodinger.seam.testing.benchmarks.WriteStructuresToFile_MaxSizeOfDirectory¶
Bases:
BenchmarkThis benchmark is to measure WriteStructuresToFile’s max shard directory size.
- UNIT_TEST_N = 5¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.WriteStructuresToFile_Runtime¶
Bases:
BenchmarkThis benchmark is to measure WriteStructuresToFile’s runtime.
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.GroupByKeyWithSlowCoder¶
Bases:
BenchmarkThis benchmark is to test the performance of GroupByKey when using keys and values that are slow to deserialize.
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.ExecStagesWithSlowCoder¶
Bases:
BenchmarkThis benchmark is to test the performance of ExecutableStages which have outputs that are slow to deserialize.
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.FlattenWithSlowCoder¶
Bases:
BenchmarkThis benchmark is to test the performance of Flatten when using elements that are slow to deserialize.
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.FlattenBenchmark¶
Bases:
Benchmark- UNIT_TEST_N = 3¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.GroupByKey¶
Bases:
Benchmark- property gbk_executor¶
Set up a GroupByKeyExecutor with an input and output EmbeddedPCollManager
Groups input type of (int, int) to output type of (int, Iterable[int])
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.MaxBundleMemUsage¶
Bases:
BenchmarkTest that that bundles that are loaded directly into memory to process never exceed the max bundle memory limit.
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.WriteStructuresToFileMemoryBenchmark¶
Bases:
BenchmarkTest that that bundles that are loaded directly into memory to process never exceed the max bundle memory limit.
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.LargeOutputPerBundleWithInProcessWorkerBenchmark¶
Bases:
BenchmarkTest that running a pipeline where the size of outputs generated per bundle is large doesn’t result in large memory consumption.
- UNIT_TEST_N = 5¶
- PERFORMANCE_TEST_N = 2000¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.LargeOutputPerBundleWithSubprocessWorkerBenchmark¶
Bases:
BenchmarkTest that running a pipeline where the size of outputs generated per bundle is large doesn’t result in large memory consumption.
- UNIT_TEST_N = 5¶
- PERFORMANCE_TEST_N = 8000¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.LargeOutputPerBundleWithLocalWorkerBenchmark¶
Bases:
BenchmarkTest that running a pipeline where the size of outputs generated per bundle is large doesn’t result in large memory consumption even when using a DoFn marked with
@requires_local_execution.- UNIT_TEST_N = 5¶
- PERFORMANCE_TEST_N = 8000¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.WorkerServerWithSortingBundleProcessingTime¶
Bases:
BenchmarkTest that running a pipeline where the size of outputs generated per bundle is large doesn’t result in large memory consumption even when using a DoFn marked with
@requires_local_execution.- UNIT_TEST_N = 1000¶
- PERFORMANCE_TEST_N = 1000000¶
- SKIP = True¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.WorkerServerBundleProcessingTime¶
Bases:
BenchmarkTest that running a pipeline where the size of outputs generated per bundle is large doesn’t result in large memory consumption even when using a DoFn marked with
@requires_local_execution.- UNIT_TEST_N = 1000¶
- PERFORMANCE_TEST_N = 100000¶
- SKIP = True¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.PCollFileManager_CreateReadersWithManyDataFiles¶
Bases:
Benchmark- static pcoll_mngr()¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.GroupByKeyLargeValues_runtime¶
Bases:
Benchmark- UNIT_TEST_N = 5¶
- static generate_1M_random_string()¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.GroupByKeyDiskSpaceWithLargeValues¶
Bases:
Benchmark- UNIT_TEST_N = 100¶
- static generate_1M_random_string()¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.GroupByKeyLargeElements_memory¶
Bases:
Benchmark- UNIT_TEST_N = 5¶
- PERFORMANCE_TEST_N = 1000¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.GBKCombineLargeCompElements_memory¶
Bases:
BenchmarkMeasure GBK combine memory while merging large compressed elements.
Each partition starts with a distinct key so the merge heap must retain one element from every partition without creating a large hot-key group.
- UNIT_TEST_N = 2¶
- PERFORMANCE_TEST_N = 100¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.GroupByKeyWithManyDataChunkFiles¶
Bases:
BenchmarkTest that running GroupByKey with many data chunk files that exceed the _MAX_OPEN_FILES limit does not lead to excessive memory usage
- UNIT_TEST_N = 5¶
- PERFORMANCE_TEST_N = 1000¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.RedistributingWithLargeElements¶
Bases:
BenchmarkTest that running a pipeline where the size of outputs generated per bundle is large doesn’t result in large memory consumption even when using a DoFn marked with
@requires_local_execution.- UNIT_TEST_N = 100¶
- PERFORMANCE_TEST_N = 1000¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.RedistributingRuntime¶
Bases:
Benchmark- UNIT_TEST_N = 1¶
- PERFORMANCE_TEST_N = 1000¶
- BUFFER_BYTES_THRESHOLD = 1024¶
- BLOB_SIZE = 256¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- runRedistribute(pcoll_mngr: FilePCollManager, n: int)¶
- class schrodinger.seam.testing.benchmarks.ParallelRedistributingRuntime¶
Bases:
RedistributingRuntime- runRedistribute(pcoll_mngr: FilePCollManager, n: int)¶
- class schrodinger.seam.testing.benchmarks.SeamRunnerOverheadBenchmark¶
Bases:
BenchmarkTest a basic Map transform with the SeamRunner to test the overhead of the SeamRunner itself.
- UNIT_TEST_N = 1¶
- PERFORMANCE_TEST_N = 1¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.WriteRandomLogs(message_size: int)¶
Bases:
DoFnWrite one fixed-size random message for each input element.
- __init__(message_size: int)¶
- process(log_number: int) Iterable[int]¶
Method to use for processing elements.
This is invoked by
DoFnRunnerfor each element of a inputPCollection.The following parameters can be used as default values on
processarguments to indicate that a DoFn accepts the corresponding parameters. For example, a DoFn might accept the element and its timestamp with the following signature:def process(element=DoFn.ElementParam, timestamp=DoFn.TimestampParam): ...
The full set of parameters is:
DoFn.ElementParam: element to be processed, should not be mutated.DoFn.SideInputParam: a side input that may be used when processing.DoFn.TimestampParam: timestamp of the input element.DoFn.WindowParam:Windowthe input element belongs to.DoFn.TimerParam: auserstate.RuntimeTimerobject defined by the spec of the parameter.DoFn.StateParam: auserstate.RuntimeStateobject defined by the spec of the parameter.DoFn.KeyParam: key associated with the element.DoFn.RestrictionParam: aniobase.RestrictionTrackerwill be provided here to allow treatment as a SplittableDoFn. The restriction tracker will be derived from the restriction provider in the parameter.DoFn.WatermarkEstimatorParam: a function that can be used to track output watermark of SplittableDoFnimplementations.DoFn.BundleContextParam: allows a shared context manager to be used per bundleDoFn.SetupContextParam: allows a shared context manager to be used per DoFn
- class schrodinger.seam.testing.benchmarks.SeamRunnerLogDiskUsageWithDBLoggingBenchmark¶
Bases:
_SeamRunnerLogDiskUsageBenchmarkBaseMeasure log disk usage with Database logging enabled.
- USE_DB_LOGGING = True¶
- class schrodinger.seam.testing.benchmarks.SeamRunnerLogDiskUsageWithoutDBLoggingBenchmark¶
Bases:
_SeamRunnerLogDiskUsageBenchmarkBaseMeasure log disk usage with file-only logging.
- class schrodinger.seam.testing.benchmarks.BatchElementsStreamingBenchmark¶
Bases:
BenchmarkBenchmark BatchElements performance with bundle-streaming enabled.
This benchmark processes elements through BatchElements with a 1-second sleep per batch. With bundle-streaming enabled, BatchElements accumulates elements into full-sized batches. Without bundle-streaming, it flushes at each bundle boundary, creating many small batches.
- UNIT_TEST_N = 128¶
- PERFORMANCE_TEST_N = 1024¶
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.StructureCompressionRatio¶
Bases:
_CompressionBenchmarkBaseCompression ratio for bare Structure objects.
- class schrodinger.seam.testing.benchmarks.AnnotatedStructureCompressionRatio¶
Bases:
_CompressionBenchmarkBaseCompression ratio for a dataclass with Structure + float fields.
- class schrodinger.seam.testing.benchmarks.PackingResultCompressionRatio¶
Bases:
_CompressionBenchmarkBaseCompression ratio for a dataclass with Structure + mixed metadata.
- class schrodinger.seam.testing.benchmarks.StructureEncodingSpeed¶
Bases:
StructureCompressionRatio,_EncodingSpeedBenchmarkBaseEncoding speed ratio for bare Structure objects.
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.AnnotatedStructureEncodingSpeed¶
Bases:
AnnotatedStructureCompressionRatio,_EncodingSpeedBenchmarkBaseEncoding speed ratio for AnnotatedStructure.
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- class schrodinger.seam.testing.benchmarks.PackingResultEncodingSpeed¶
Bases:
PackingResultCompressionRatio,_EncodingSpeedBenchmarkBaseEncoding speed ratio for PackingResult.
- run(n: int) BenchmarkResult¶
- Parameters:
n – The number of elements to process
- schrodinger.seam.testing.benchmarks.get_benchmarks()¶