IEtlTaskExecutionEvents.OnEndBlock

Syntax

OnEndBlock(Task: IEtlTask; Object: IEtlObject; Duration: Integer; InRec: IDictionary; OutRec: IDictionary; ErrorRec: IDictionary);

Parameters

Task. ETL task.

Object. ETL task object.

Duration. Block execution time in milliseconds.

InRec. Dictionary with information about records loaded to object inputs.

OutRec. Dictionary with information about records loaded to object outputs.

ErrorRec. Dictionary with information about error (skipped) records.

Description

The OnEndBlock method implements the event that occurs on ETL task block finish.

Comments

ETL task block is a set of two objects and a link between them in the ETL task.

In the InRec, OutRec, ErrorRec dictionaries each element will contain the following information:

Example

The example describes a class that can be used as ETL task event handler.

Add links to the Collections, Etl, and Metabase system assemblies.

Class EventsClass: EtlTaskExecutionEvents
    // Event that occurs on ETL task start
    Public Sub OnStartTask(Task: IEtlTask);
    Var
        MObj: IMetabaseObject;
    Begin
        MObj := (Task As IMetabaseObjectInstance).Object;
        Debug.WriteLine("The OnStartTask event for ETL task:" + #13 + #10 +
            "   Name: " + MObj.Name + ". Identifier: " + MObj.Id + '.');
    End Sub OnStartTask;
    // Event that occurs on ETL task finish
    Public Sub OnEndTask(Task: IEtlTask; Duration, TotalRec, ErrorRec: Integer);
    Begin
        Debug.WriteLine("The OnEndTask event:" + #13 + #10 +
            "   Number of ETL task objects = " + Task.Count.ToString + #13 + #10 +
            "   Execution time = " + Duration.ToString + "ms" + #13 + #10 +
            "   Total number of processed records = " + TotalRec.ToString + #13 + #10 +
            "   Total number of error (skipped) records = " + ErrorRec.ToString);
    End Sub OnEndTask;
    // Event that occurs on ETL task block start
    Public Sub OnStartBlock(Task: IEtlTask; Object: IEtlObject);
    Begin
        Debug.WriteLine("The OnStartBlock event for object:" + #13 + #10 +
            "   " + Object.Name + '(' + Object.Id + ')');
    End Sub OnStartBlock;
    // Event that occurs on ETL task block finish
    Public Sub OnEndBlock(Task: IEtlTask; Object: IEtlObject; Duration: Integer; InRec, OutRec, ErrorRec: IDictionary);
    Begin
        Debug.WriteLine("The OnEndBlock event:" + #13 + #10 +
            "   ETL task object: " + Object.Name + '(' + Object.Id + ')' + #13 + #10 +
            "   Execution time = " + Duration.ToString + "ms" + #13 + #10 +
            "   Inputs = " + InRec.Count.ToString +
            "   Outputs = " + OutRec.Count.ToString +
            "   Outputs with error records = " + ErrorRec.Count.ToString);
        If InRec.Count > 0 Then ShowDict("   Input", InRec); End If;
        If OutRec.Count > 0 Then ShowDict("   Output", OutRec); End If;
        If ErrorRec.Count > 0 Then ShowDict("   Output with error record", ErrorRec); End If;
    End Sub OnEndBlock;
    // Event that occurs during ETL task execution
    Public Sub OnProgress(Task: IEtlTask; Progress: Integer);
    Begin
        Debug.WriteLine("The OnProgress event:" + #13 + #10 +
            "   Task execution progress = " + Progress.ToString + '%');
    End Sub OnProgress;
    // Event that occurs in case of ETL task block error
    Public Sub OnError(Task: IEtlTask; Object: IEtlObject; Exception: IException);
    Begin
        Debug.WriteLine("The OnError event:" + #13 + #10 +
            "   ETL task object: " + Object.Name + '(' + Object.Id + ')' + #13 + #10 +
            "   Error text - " + Exception.Message);
    End Sub OnError;
    // Procedure for viewing dictionary contents
    Sub ShowDict(Text: String; Dict: IDictionary);
    Var
        v: Variant;
    Begin
        For Each v In Dict.Keys Do
            Debug.Write(Text + ' ' + v + ", records: " + Dict.Item(v) + '.');
        End For;
        Debug.WriteLine("");
    End Sub ShowDict;
End Class EventsClass;

When events occur during ETL task execution, the corresponding information will be displayed in the development environment console.

See also:

IEtlTaskExecutionEvents