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 themicronaut.python.pool.ignoreDependenciesannotation 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 to1, or to0in thetestenvironment;0turns it off. At mostsizecontexts are created.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPythonPoolConfiguration(boolean enabled, int size, @Nullable Duration warnWait, int maxEventLoopContexts) The configuration without dependencies left unreported, which only Python processing reads.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.PythonPoolConfiguration(boolean enabled, int size, @Nullable Duration warnWait, int maxEventLoopContexts, @Nullable List<String> ignoreDependencies, @Nullable Integer prestart) Creates an instance of aPythonPoolConfigurationrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbooleanenabled()Returns the value of theenabledrecord component.final booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.Returns the value of theignoreDependenciesrecord component.intReturns the value of themaxEventLoopContextsrecord component.@Nullable Integerprestart()Returns the value of theprestartrecord component.intsize()Returns the value of thesizerecord component.final StringtoString()Returns a string representation of this record class.@Nullable DurationwarnWait()Returns the value of thewarnWaitrecord component.
-
Field Details
-
PREFIX
-
-
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 enabledsize- The size of the poolwarnWait- The amount of time to wait for a pooled context before a warning is printedmaxEventLoopContexts- 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 enabledsize- The size of the poolwarnWait- The amount of time to wait for a pooled context before a warning is printedmaxEventLoopContexts- The most Netty event loops that get a dedicated asyncio contextignoreDependencies- 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 aPythonPoolConfigurationrecord class.- Parameters:
enabled- the value for theenabledrecord componentsize- the value for thesizerecord componentwarnWait- the value for thewarnWaitrecord componentmaxEventLoopContexts- the value for themaxEventLoopContextsrecord componentignoreDependencies- the value for theignoreDependenciesrecord componentprestart- the value for theprestartrecord component
-
-
Method Details
-
toString
-
hashCode
-
equals
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 withObjects::equals(Object,Object); primitive components are compared with thecomparemethod from their corresponding wrapper classes. -
enabled
-
size
-
warnWait
-
maxEventLoopContexts
Returns the value of themaxEventLoopContextsrecord component.- Returns:
- the value of the
maxEventLoopContextsrecord component
-
ignoreDependencies
Returns the value of theignoreDependenciesrecord component.- Returns:
- the value of the
ignoreDependenciesrecord component
-
prestart
-