Quintiq file version 2.0
|
#parent: #root
|
MethodOverride Operation (LibOpt_Task task) as stream[JSON]
|
{
|
TextBody:
|
[*
|
start_init := OS::PrecisionCounter();
|
|
stream_json := null( stream[JSON] );
|
|
this.HasRetrievedAlgorithmFromStore( false );
|
program := this.DoConstructAlgorithm();
|
this.AlgorithmStoreWriteProgram( &program );
|
|
if( this.InOneTransaction() )
|
{
|
this.DoInitialize( task, program );
|
|
LibOpt_AlgorithmStopwatch::Add( program, LibOpt_SnapshotAlgorithm::FrameworkInitialize(), LibOpt_Utility::TimeSince( start_init ) );
|
|
stream_json := this.DoExecute( program, task );
|
}
|
else
|
{
|
init_stream := this.DoInitializeReactive( task, program );
|
// Correctly calculate the init time, without blocking the dataset
|
stream_json := init_stream->AsVoid()->() { // Note: this is several times faster than 'init_stream->( unused_object ) {'
|
// We have to use a reactive code block here to ensure that LibOpt_Utility::TimeSince( start_init ) is called after init_stream.
|
LibOpt_AlgorithmStopwatch::Add( program, LibOpt_SnapshotAlgorithm::FrameworkInitialize(), LibOpt_Utility::TimeSince( start_init ) );
|
}->|this->DoExecuteReactive( program, task );
|
}
|
|
return stream_json;
|
*]
|
}
|