feat: Create profile set custom seed - #2665
diogodanielsoaresferreira wants to merge 24 commits into
Conversation
…eira/timefold-solver into execution_profiles
…e service loader instead
…e_profile_set_custom_seed
| if (seed == null) { | ||
| return Map.of(); | ||
| } | ||
| return Map.of(ENV_QUARKUS_RANDOM_SEED, seed); |
There was a problem hiding this comment.
so the expectation is that gateway will call this method before scheduling pod and set these variables on pod spec?
Maybe we could consider a custom implementation of ConfigSource that we could back it by the configuration from storage - that way we could load execution profile and the options in that config source which would then deliver anything that quarkus config properties might expect.
There was a problem hiding this comment.
The idea is good, and we could read it from storage, but the problem is that ConfigSources initialize very early in the lifecycle, and the storage clients are configured via CDI, so we would have to connect to the storages manually, which would be fickly.
Another option would be to rely on a configurations file mounted by the gateway that could be read by the pod. But that would again increase the complexity.
As I think that this options works for now and it's easier to maintain, I would keep it as is for now.
| /** | ||
| * Runs the solver with a fixed random seed, making a run reproducible. | ||
| * <p> | ||
| * The seed is an optional {@code seed} parameter; when it is not supplied, a random seed is generated and persisted with |
There was a problem hiding this comment.
Note that the seed generation depends on the environment mode. By default, we use the PHASE_ASSERT mode, which has a seed value of 0. In contrast, the NON_REPRODUCIBLE mode uses a random number as its seed.
There was a problem hiding this comment.
So that means that for this to be useful, we also need to set the environment mode to NON_REPRODUCIBLE?
There was a problem hiding this comment.
No, it just means the seed 0 will be used with the default environment. But I see you already updated the documentation, which makes more sense to me now. I believe we want to keep the runs reproducible wherever possible, and we can now change the seed if necessary. Using NON_REPRODUCIBLE does not seem necessary.
| @JsonInclude(JsonInclude.Include.NON_NULL) @Schema( | ||
| description = "Optional tags to be assigned to the dataset.") @Size(max = 100) Set<String> tags) { | ||
| description = "Optional tags to be assigned to the dataset.") @Size(max = 100) Set<String> tags, | ||
| @JsonInclude(JsonInclude.Include.NON_NULL) @Schema(hidden = true) Map<String, String> options) { |
There was a problem hiding this comment.
Can we pass arbitrary values to options?
There was a problem hiding this comment.
Yes, but only the needed values will be used by the Execution Profile; other ones will be discarded
| assertThat(runNode.isObject()).as("run configuration should be serialized as an object").isTrue(); | ||
| ((ObjectNode) runNode).put("notARealOption", "boom"); | ||
|
|
||
| // Permitting unknown properties in the schema must not weaken the strict Jackson mapping. |
There was a problem hiding this comment.
I think this test answers my previous question in RunConfiguration.
Fixes: https://github.com/TimefoldAI/timefold-platform/issues/5335