Skip to content

/AWS1/IF_MWS=>GETTASKINSTANCE()

About GetTaskInstance

Retrieves detailed information about a specific task instance within a workflow run. Task instances represent individual tasks that are executed as part of a workflow in the Amazon Managed Workflows for Apache Airflow Serverless environment. Each task instance runs in an isolated ECS container with dedicated resources and security boundaries. The service tracks task execution state, retry attempts, and provides detailed timing and error information for troubleshooting and monitoring purposes.

Method Signature

METHODS /AWS1/IF_MWS~GETTASKINSTANCE
  IMPORTING
    !IV_WORKFLOWARN TYPE /AWS1/MWSWORKFLOWARN OPTIONAL
    !IV_TASKINSTANCEID TYPE /AWS1/MWSIDSTRING OPTIONAL
    !IV_RUNID TYPE /AWS1/MWSIDSTRING OPTIONAL
  RETURNING
    VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_mwsgettaskinstrsp
  RAISING
    /AWS1/CX_MWSACCESSDENIEDEX
    /AWS1/CX_MWSINTERNALSERVEREX
    /AWS1/CX_MWSOPERATIONTIMEOUTEX
    /AWS1/CX_MWSRESOURCENOTFOUNDEX
    /AWS1/CX_MWSTHROTTLINGEX
    /AWS1/CX_MWSVALIDATIONEX
    /AWS1/CX_MWSCLIENTEXC
    /AWS1/CX_MWSSERVEREXC
    /AWS1/CX_RT_TECHNICAL_GENERIC
    /AWS1/CX_RT_SERVICE_GENERIC.

IMPORTING

Required arguments:

iv_workflowarn TYPE /AWS1/MWSWORKFLOWARN /AWS1/MWSWORKFLOWARN

The Amazon Resource Name (ARN) of the workflow that contains the task instance.

iv_taskinstanceid TYPE /AWS1/MWSIDSTRING /AWS1/MWSIDSTRING

The unique identifier of the task instance to retrieve.

iv_runid TYPE /AWS1/MWSIDSTRING /AWS1/MWSIDSTRING

The unique identifier of the workflow run that contains the task instance.

RETURNING

oo_output TYPE REF TO /aws1/cl_mwsgettaskinstrsp /AWS1/CL_MWSGETTASKINSTRSP

Domain /AWS1/RT_ACCOUNT_ID
Primitive Type NUMC

Examples

Syntax Example

This is an example of the syntax for calling the method. It includes every possible argument and initializes every possible value. The data provided is not necessarily semantically accurate (for example the value "string" may be provided for something that is intended to be an instance ID, or in some cases two arguments may be mutually exclusive). The syntax shows the ABAP syntax for creating the various data structures.

DATA(lo_result) = lo_client->gettaskinstance(
  iv_runid = |string|
  iv_taskinstanceid = |string|
  iv_workflowarn = |string|
).

This is an example of reading all possible response values

lo_result = lo_result.
IF lo_result IS NOT INITIAL.
  lv_workflowarn = lo_result->get_workflowarn( ).
  lv_idstring = lo_result->get_runid( ).
  lv_idstring = lo_result->get_taskinstanceid( ).
  lv_versionid = lo_result->get_workflowversion( ).
  lv_taskinstancestatus = lo_result->get_status( ).
  lv_integer = lo_result->get_durationinseconds( ).
  lv_genericstring = lo_result->get_operatorname( ).
  lv_timestampvalue = lo_result->get_modifiedat( ).
  lv_timestampvalue = lo_result->get_endedat( ).
  lv_timestampvalue = lo_result->get_startedat( ).
  lv_integer = lo_result->get_attemptnumber( ).
  lv_genericstring = lo_result->get_errormessage( ).
  lv_idstring = lo_result->get_taskid( ).
  lv_idstring = lo_result->get_logstream( ).
  LOOP AT lo_result->get_xcom( ) into ls_row.
    lv_key = ls_row-key.
    lo_value = ls_row-value.
    IF lo_value IS NOT INITIAL.
      lv_genericstring = lo_value->get_value( ).
    ENDIF.
  ENDLOOP.
ENDIF.