HsbcJone commented on code in PR #1386:
URL: https://github.com/apache/flink-agents/pull/1386#discussion_r4560470176
##########
docs/content/docs/operations/configuration.md:
##########
@@ -31,6 +31,14 @@ from YAML.
Environment settings apply to Agents added to that environment. YAML settings
apply
to jobs that load the same file.
+Framework durations use `java.time.Duration` in Java and `datetime.timedelta`
in
+Python. In YAML, write an integer and a unit, for example `30 s`, `5 min`, or
+`-1 ms`. A unit is required. Recognized units are `ns`, `us`, `ms`, `s`, `min`
+(`m` means minutes), `h`, and `d`, including longer forms such as `seconds` and
+`milliseconds`. The value must be a whole number of microseconds. The keys
+`async.batch.timeout.ms` and `short-term-memory.state-ttl.ms` are unsupported;
Review Comment:
Removed the previous key names from the parser, comments, tests, and
documentation, including the sentence that pointed at them. Unknown keys stay
ignored. The configuration page describes only `async.batch.timeout`,
`short-term-memory.state-ttl`, and `retry-wait-interval`.
857e5b683ce92604126b5d6802bfbfd9aac75337
##########
docs/content/docs/operations/configuration.md:
##########
@@ -219,7 +227,7 @@ for retry metrics.
| `decision.async` | true | boolean | Enable durable async execution for
built-in Decision Model calls. `false` selects synchronous execution. |
| `max-retries` | 0 | int | Maximum retries after the initial attempt of a
built-in Chat or Decision Model call, including routing judge calls.
Non-positive values disable retries. |
| `rag.async` | true | boolean | Enable durable async execution for
vector-store queries made by the built-in context retrieval Action. `false`
selects synchronous execution. |
-| `retry-wait-interval` | 1 | int | Base wait in seconds between retries
controlled by `max-retries`. The wait before retry N is `retry-wait-interval *
2^(N-1)`. Non-positive values retry without waiting. |
+| `retry-wait-interval` | `1 s` | duration | Base wait between retries
controlled by `max-retries`. The wait before retry N is this duration
multiplied by `2^(N-1)`. A zero or negative duration retries without waiting. |
Review Comment:
The parser still requires a whole number of microseconds and does not
truncate.
`short-term-memory.state-ttl` still rejects a positive value shorter than 1
ms with `must be at least 1 ms, got <formatted>`. A longer positive value that
is not a whole number of milliseconds, such as `1500 us`, now fails when the
option is read, including when keyed state is registered, with `must be a whole
number of milliseconds, or zero or negative to disable TTL, got <formatted>`.
`1 ms`, `1000 us`, and `1 min` still enable TTL. Zero and negative still
disable it.
`retry-wait-interval` is whole milliseconds on both languages. Java sleeps
with `Thread.sleep(long)` and Python sleeps that same length. A positive value
with a sub-millisecond remainder is rejected, with the option key and the
formatted value, instead of dropping the remainder. `retryWaitSec` and
`total_retry_wait_sec` still record only whole seconds of each sleep, so a
sub-second sleep can be undercounted. That is stated on the option and in the
configuration and monitoring docs.
`async.batch.timeout` keeps the full microsecond duration as the gather
deadline on both sides. It is not truncated to milliseconds.
857e5b683ce92604126b5d6802bfbfd9aac75337
##########
runtime/src/main/java/org/apache/flink/agents/runtime/operator/OperatorStateManager.java:
##########
@@ -141,15 +142,15 @@ void initializeKeyedStates(
}
/**
- * When {@link AgentExecutionOptions#SHORT_TERM_MEMORY_STATE_TTL_MS} is
positive, attaches Flink
+ * When {@link AgentExecutionOptions#SHORT_TERM_MEMORY_STATE_TTL} is
positive, attaches Flink
* {@link StateTtlConfig} to the short-term memory {@link
MapStateDescriptor}. Unset, null, or
* non-positive values disable TTL (Flink does not allow zero/negative
TTL).
*/
private void maybeEnableShortTermMemoryTTL(
MapStateDescriptor<String, MemoryObjectImpl.MemoryItem> descriptor,
AgentConfiguration agentConfiguration) {
- Long ttlMs =
agentConfiguration.get(AgentExecutionOptions.SHORT_TERM_MEMORY_STATE_TTL_MS);
- if (ttlMs == null || ttlMs <= 0) {
+ Duration ttl =
agentConfiguration.get(AgentExecutionOptions.SHORT_TERM_MEMORY_STATE_TTL);
+ if (!DurationFormat.isPositive(ttl)) {
return;
}
Review Comment:
Follow-up after the precision review: a positive TTL that is not a whole
number of milliseconds, such as `1500 us`, is now also rejected when the option
is read, including when keyed state is registered:
`short-term-memory.state-ttl must be a whole number of milliseconds, or zero
or negative to disable TTL, got 1500 us`
`1 ms` and `1000 us` still enable TTL. The value is not rounded or truncated.
857e5b683ce92604126b5d6802bfbfd9aac75337
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]