From 3.4.2 to 3.5.0
Summary
Optimization Server 3.5.0 introduces deprecations in:
the Worker Java library
Optimization Server 3.5.0 introduces breaking change in:
Helm chart values file
Development of applications
Library | Backward compatibility | Deprecations |
---|---|---|
Master API client | Backward compatible | |
Worker (Java) | Break changes: adjust code | Deprecations |
Worker (Python) | Break changes: adjust code |
Deployment of Optimization Server
Chart | Backward compatibility | Deprecations |
---|---|---|
dbos-volume | Break changes: adjust code | |
dbos-secrets | Break changes: adjust code | |
dbos-infra | Break changes: adjust code | |
dbos | Break changes: adjust code | |
cplex | Break changes: adjust code | |
wod | Break changes: adjust code |
Worker (Java)
See this page for more details.
Get inputs
The usual way to get an input parameter in you task is using Parameter
object:
void execute(Parameter inputs, Parameter outputs, ExecutionContext context) {
byte[] inputData = inputs.get("inputName");
}
This method has been deprecated due to a high memory usage with large inputs.
Now you can read your input data through a Java InputStream
:
void execute(Parameter inputs, Parameter outputs, ExecutionContext context) {
ParameterData parameterData = context.getInputData("inputName");
try (InputStream inputStream = parameterData.open()) {
//Load your data with "inputStream" object
}
}
For small inputs, you can also use parameterData.loadAsString()
or parameterData.loadAsBytes()
.
You can check which input parameters are available using context.getInputNames()
and context.containsInput()
.
Save outputs
The usual way to save an output parameter in you task is using Parameter
object:
void execute(Parameter inputs, Parameter outputs, ExecutionContext context) {
inputs.emit("inputName", "value".getBytes());
}
This method has been deprecated due to a high memory usage with large inputs.
Now you can save your output data through a Java InputStream
:
void execute(Parameter inputs, Parameter outputs, ExecutionContext context) {
InputStream result = ...;
context.notifyOutput("outputName", ParameterData.of(result));
}
If it is more convenient, you can write the data to an OutputStream
:
void execute(Parameter inputs, Parameter outputs, ExecutionContext context) {
context.notifyOutput("outputName", ParameterData.of(outputStream -> {
//Write the result into "outputStream" object
}));
}
For small outputs, you can also use ParameterData.of(String)
or ParameterData.of(byte[])
.
Helm charts
The syntax for declaring root hostname and image pull secrets in values file has changed.
3.4.1:
global:
domain: mydomain.com
image:
imagePullSecrets:
- name: docker-registry.decisionbrain.loc-secret
3.5.0:
global:
host: mydomain.com
image:
imagePullSecrets:
- docker-registry.decisionbrain.loc-secret
The properties are migrated by calling the Python helper script. Make sure the output file complies with the description of the example above.