Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,20 @@
*/
public final class DatasetComputedEvent extends SolverWorkerEvent {

public DatasetComputedEvent(Metadata metadata, SolverModel solverModel, String planName, String tenantName) {
/**
* Indicates whether a solving operation was requested.
* When {@code true}, computation is followed by solving, which progresses the dataset to the next state.
* When {@code false}, {@code COMPUTED} is the final state and no solving takes place.
*/
private final boolean solveRequested;

public DatasetComputedEvent(Metadata metadata, SolverModel solverModel, String planName, String tenantName,

Check warning on line 19 in service/definition/src/main/java/ai/timefold/solver/service/definition/internal/events/DatasetComputedEvent.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Provide the parametrized type for this generic.

See more on https://sonarcloud.io/project/issues?id=ai.timefold%3Atimefold-solver&issues=AZ6tDv54TPd3RIRE3xW1&open=AZ6tDv54TPd3RIRE3xW1&pullRequest=2345

Check warning on line 19 in service/definition/src/main/java/ai/timefold/solver/service/definition/internal/events/DatasetComputedEvent.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Provide the parametrized type for this generic.

See more on https://sonarcloud.io/project/issues?id=ai.timefold%3Atimefold-solver&issues=AZ6tDv54TPd3RIRE3xW0&open=AZ6tDv54TPd3RIRE3xW0&pullRequest=2345
boolean solveRequested) {
Comment thread
cristianonicolai marked this conversation as resolved.
super(metadata, solverModel, null, planName, tenantName, null);
Comment thread
cristianonicolai marked this conversation as resolved.
this.solveRequested = solveRequested;
}
Comment thread
cristianonicolai marked this conversation as resolved.
Comment thread
cristianonicolai marked this conversation as resolved.
Comment thread
cristianonicolai marked this conversation as resolved.

Comment thread
cristianonicolai marked this conversation as resolved.
public boolean isSolveRequested() {
return solveRequested;
Comment thread
cristianonicolai marked this conversation as resolved.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ private void startIdle() {
shutdownExecutor.scheduleShutdown(shutdownDelay, 0);
}

private void computeOutputs(String id) {
private void computeOutputs(String id, boolean solveRequested) {
Comment thread
cristianonicolai marked this conversation as resolved.
Comment thread
cristianonicolai marked this conversation as resolved.
LOGGER.info("Requesting solver for id {} to compute outputs...", id);
Comment thread
cristianonicolai marked this conversation as resolved.
try {
var metadata = storageService.getMetadata(id);
Expand All @@ -363,7 +363,8 @@ private void computeOutputs(String id) {

postProcessOutput(id, modelOutput, solverModel);

sendEvent(datasetOutputsComputedEmitter, new DatasetComputedEvent(metadata, solverModel, planName, tenantName));
sendEvent(datasetOutputsComputedEmitter,
new DatasetComputedEvent(metadata, solverModel, planName, tenantName, solveRequested));
Comment thread
cristianonicolai marked this conversation as resolved.
Comment thread
cristianonicolai marked this conversation as resolved.
} catch (Throwable e) {
notifyOnFailure(id, e);
}
Expand Down Expand Up @@ -495,7 +496,7 @@ public void onDatasetValidateComputeCommand(DatasetValidateComputeCommand comman
return;
}

computeOutputs(id);
computeOutputs(id, command.solve());
Comment thread
cristianonicolai marked this conversation as resolved.

if (command.solve()) {
onSolveStartCommand(new SolveStartCommand(id));
Expand Down
Loading