Record Class PythonPoolConfiguration

java.lang.Object
java.lang.Record
io.micronaut.context.python.PythonPoolConfiguration
Record Components:
enabled - Whether pooling is enabled.
size - The size of the pool. Defaults to the number of processors divided by four, at least 2 and at most 8. More contexts cost throughput on a route that reaches a Python bean that is not itself pooled, so raise this only for a workload measured to want it.
warnWait - The amount of time to wait for a pooled context before a warning is printed. Defaults to two seconds; zero or a negative duration turns the warning off.
maxEventLoopContexts - The most Netty event loops that get a dedicated asyncio context; 0, the default, gives every event loop one. Event loops beyond the cap run Python through the shared pool and block while a coroutine runs.
ignoreDependencies - The singleton Python dependencies of pooled types not to warn about, by simple or qualified type name; * warns about none. Read when the Python sources are processed, not at run time: Pyronaut passes it to the compiler as the micronaut.python.pool.ignoreDependencies annotation processor option.
prestart - The number of pooled contexts to create on a background thread once the application has started, so that the first requests find a context ready instead of waiting for one to initialize. Defaults to 1, or to 0 in the test environment; 0 turns it off. At most size contexts are created.

@ConfigurationProperties("micronaut.python.pool") public record PythonPoolConfiguration(boolean enabled, int size, @Nullable Duration warnWait, int maxEventLoopContexts, @Nullable List<String> ignoreDependencies, @Nullable Integer prestart) extends Record
Configuration for the PythonPool.
  • Field Details

  • Constructor Details

    • PythonPoolConfiguration

      public PythonPoolConfiguration(boolean enabled, int size, @Nullable Duration warnWait, int maxEventLoopContexts)
      The configuration without dependencies left unreported, which only Python processing reads.
      Parameters:
      enabled - Whether pooling is enabled
      size - The size of the pool
      warnWait - The amount of time to wait for a pooled context before a warning is printed
      maxEventLoopContexts - The most Netty event loops that get a dedicated asyncio context
    • PythonPoolConfiguration

      public PythonPoolConfiguration(boolean enabled, int size, @Nullable Duration warnWait, int maxEventLoopContexts, @Nullable List<String> ignoreDependencies)
      The configuration with the default number of contexts to pre-start.
      Parameters:
      enabled - Whether pooling is enabled
      size - The size of the pool
      warnWait - The amount of time to wait for a pooled context before a warning is printed
      maxEventLoopContexts - The most Netty event loops that get a dedicated asyncio context
      ignoreDependencies - The singleton Python dependencies of pooled types not to warn about
    • PythonPoolConfiguration

      public PythonPoolConfiguration(@Bindable(defaultValue="true") boolean enabled, @Bindable(defaultValue="0") int size, @Bindable(defaultValue="2s") @Nullable Duration warnWait, @Bindable(defaultValue="0") int maxEventLoopContexts, @Nullable List<String> ignoreDependencies, @Nullable Integer prestart)
      Creates an instance of a PythonPoolConfiguration record class.
      Parameters:
      enabled - the value for the enabled record component
      size - the value for the size record component
      warnWait - the value for the warnWait record component
      maxEventLoopContexts - the value for the maxEventLoopContexts record component
      ignoreDependencies - the value for the ignoreDependencies record component
      prestart - the value for the prestart record component
  • Method Details

    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with the compare method from their corresponding wrapper classes.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • enabled

      @Bindable(defaultValue="true") public boolean enabled()
      Returns the value of the enabled record component.
      Returns:
      the value of the enabled record component
    • size

      @Bindable(defaultValue="0") public int size()
      Returns the value of the size record component.
      Returns:
      the value of the size record component
    • warnWait

      @Bindable(defaultValue="2s") public @Nullable Duration warnWait()
      Returns the value of the warnWait record component.
      Returns:
      the value of the warnWait record component
    • maxEventLoopContexts

      @Bindable(defaultValue="0") public int maxEventLoopContexts()
      Returns the value of the maxEventLoopContexts record component.
      Returns:
      the value of the maxEventLoopContexts record component
    • ignoreDependencies

      public @Nullable List<String> ignoreDependencies()
      Returns the value of the ignoreDependencies record component.
      Returns:
      the value of the ignoreDependencies record component
    • prestart

      public @Nullable Integer prestart()
      Returns the value of the prestart record component.
      Returns:
      the value of the prestart record component