Class ResourceHints

java.lang.Object
org.apache.beam.sdk.transforms.resourcehints.ResourceHints

public class ResourceHints extends Object
Pipeline authors can use resource hints to provide additional information to runners about the desired aspects of the execution environment. Resource hints can be specified via PTransform#setResourceHints for parts of the pipeline, or globally via resourceHints pipeline option.

Interpretation of hints is provided by Beam runners.

  • Method Details

    • create

      public static ResourceHints create()
      Creates a ResourceHints instance with no hints.
    • fromOptions

      public static ResourceHints fromOptions(PipelineOptions options)
      Creates a ResourceHints instance with hints supplied in options.
    • withMinRam

      public ResourceHints withMinRam(long ramBytes)
      Sets desired minimal available RAM size to have in transform's execution environment.
      Parameters:
      ramBytes - specifies a positive RAM size in bytes. A number greater than 2G (Integer.MAX_VALUE) is typical.
    • withMinRam

      public ResourceHints withMinRam(String ramBytes)
      Sets desired minimal available RAM size to have in transform's execution environment.
      Parameters:
      ramBytes - specifies a human-friendly size string, for example: '10.5 GiB', '4096 MiB', etc.
    • withAccelerator

      public ResourceHints withAccelerator(String accelerator)
      Declares hardware accelerators that are desired to have in the execution environment.
    • withHint

      public ResourceHints withHint(String urn, ResourceHint hint)
      Declares a custom resource hint that has a specified URN.
    • withCPUCount

      public ResourceHints withCPUCount(int cpuCount)
      Sets desired minimal CPU or vCPU count to have in transform's execution environment.
      Parameters:
      cpuCount - specifies a positive CPU count.
    • withMaxActiveBundlesPerWorker

      public ResourceHints withMaxActiveBundlesPerWorker(int maxActiveBundlesPerWorker)
    • hints

      public Map<String,ResourceHint> hints()
    • mergeWithOuter

      public ResourceHints mergeWithOuter(ResourceHints outer)
    • equals

      public boolean equals(@Nullable Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object