/AWS1/IF_BTC=>LISTJOBS()¶
About ListJobs¶
Returns a list of Batch jobs.
You must specify only one of the following items:
-
A job queue ID to return a list of jobs in that job queue
-
A multi-node parallel job ID to return a list of nodes for that job
-
An array job ID to return a list of the children for that job
You can filter the results by job status with the jobStatus parameter. If you
don't specify a status, only RUNNING jobs are returned.
Method Signature¶
METHODS /AWS1/IF_BTC~LISTJOBS
IMPORTING
!IV_JOBQUEUE TYPE /AWS1/BTCSTRING OPTIONAL
!IV_ARRAYJOBID TYPE /AWS1/BTCSTRING OPTIONAL
!IV_MULTINODEJOBID TYPE /AWS1/BTCSTRING OPTIONAL
!IV_JOBSTATUS TYPE /AWS1/BTCJOBSTATUS OPTIONAL
!IV_MAXRESULTS TYPE /AWS1/BTCINTEGER OPTIONAL
!IV_NEXTTOKEN TYPE /AWS1/BTCSTRING OPTIONAL
!IT_FILTERS TYPE /AWS1/CL_BTCKEYVALUESPAIR=>TT_LISTJOBSFILTERLIST OPTIONAL
RETURNING
VALUE(OO_OUTPUT) TYPE REF TO /aws1/cl_btclistjobsresponse
RAISING
/AWS1/CX_BTCCLIENTEXCEPTION
/AWS1/CX_BTCSERVEREXCEPTION
/AWS1/CX_BTCCLIENTEXC
/AWS1/CX_BTCSERVEREXC
/AWS1/CX_RT_TECHNICAL_GENERIC
/AWS1/CX_RT_SERVICE_GENERIC.
IMPORTING¶
Optional arguments:¶
iv_jobqueue TYPE /AWS1/BTCSTRING /AWS1/BTCSTRING¶
The name or full Amazon Resource Name (ARN) of the job queue used to list jobs.
iv_arrayjobid TYPE /AWS1/BTCSTRING /AWS1/BTCSTRING¶
The job ID for an array job. Specifying an array job ID with this parameter lists all child jobs from within the specified array.
iv_multinodejobid TYPE /AWS1/BTCSTRING /AWS1/BTCSTRING¶
The job ID for a multi-node parallel job. Specifying a multi-node parallel job ID with this parameter lists all nodes that are associated with the specified job.
iv_jobstatus TYPE /AWS1/BTCJOBSTATUS /AWS1/BTCJOBSTATUS¶
The job status used to filter jobs in the specified queue. If the
filtersparameter is specified, thejobStatusparameter is ignored and jobs with any status are returned. If you don't specify a status, onlyRUNNINGjobs are returned.
iv_maxresults TYPE /AWS1/BTCINTEGER /AWS1/BTCINTEGER¶
The maximum number of results returned by
ListJobsin a paginated output. When this parameter is used,ListJobsreturns up tomaxResultsresults in a single page and anextTokenresponse element, if applicable. The remaining results of the initial request can be seen by sending anotherListJobsrequest with the returnednextTokenvalue.The following outlines key parameters and limitations:
The minimum value is 1.
When
--job-statusis used, Batch returns up to 1000 values.When
--filtersis used, Batch returns up to 100 values.If neither parameter is used, then
ListJobsreturns up to 1000 results (jobs that are in theRUNNINGstatus) and anextTokenvalue, if applicable.
iv_nexttoken TYPE /AWS1/BTCSTRING /AWS1/BTCSTRING¶
The
nextTokenvalue returned from a previous paginatedListJobsrequest wheremaxResultswas used and the results exceeded the value of that parameter. Pagination continues from the end of the previous results that returned thenextTokenvalue. This value isnullwhen there are no more results to return.Treat this token as an opaque identifier that's only used to retrieve the next items in a list and not for other programmatic purposes.
it_filters TYPE /AWS1/CL_BTCKEYVALUESPAIR=>TT_LISTJOBSFILTERLIST TT_LISTJOBSFILTERLIST¶
The filter to apply to the query. Only one filter can be used at a time. When the filter is used,
jobStatusis ignored. The filter doesn't apply to child jobs in an array or multi-node parallel (MNP) jobs. The results are sorted by thecreatedAtfield, with the most recent jobs being first.
- JOB_NAME
The value of the filter is a case-insensitive match for the job name. If the value ends with an asterisk (), the filter matches any job name that begins with the string before the ''. This corresponds to the
jobNamevalue. For example,test1matches bothTest1andtest1, andtest1matches bothtest1andTest10. When theJOB_NAMEfilter is used, the results are grouped by the job name and version.- JOB_DEFINITION
The value for the filter is the name or Amazon Resource Name (ARN) of the job definition. This corresponds to the
jobDefinitionvalue. The value is case sensitive. When the value for the filter is the job definition name, the results include all the jobs that used any revision of that job definition name. If the value ends with an asterisk (), the filter matches any job definition name that begins with the string before the ''. For example,jd1matches onlyjd1, andjd1matches bothjd1andjd1A. The version of the job definition that's used doesn't affect the sort order. When theJOB_DEFINITIONfilter is used and the ARN is used (which is in the formarn:${Partition}:batch:${Region}:${Account}:job-definition/${JobDefinitionName}:${Revision}), the results include jobs that used the specified revision of the job definition. Asterisk (*) isn't supported when the ARN is used.- BEFORE_CREATED_AT
The value for the filter is the time that's before the job was created. This corresponds to the
createdAtvalue. The value is a string representation of the number of milliseconds since 00:00:00 UTC (midnight) on January 1, 1970.- AFTER_CREATED_AT
The value for the filter is the time that's after the job was created. This corresponds to the
createdAtvalue. The value is a string representation of the number of milliseconds since 00:00:00 UTC (midnight) on January 1, 1970.
RETURNING¶
oo_output TYPE REF TO /aws1/cl_btclistjobsresponse /AWS1/CL_BTCLISTJOBSRESPONSE¶
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->listjobs(
it_filters = VALUE /aws1/cl_btckeyvaluespair=>tt_listjobsfilterlist(
(
new /aws1/cl_btckeyvaluespair(
it_values = VALUE /aws1/cl_btcstringlist_w=>tt_stringlist(
( new /aws1/cl_btcstringlist_w( |string| ) )
)
iv_name = |string|
)
)
)
iv_arrayjobid = |string|
iv_jobqueue = |string|
iv_jobstatus = |string|
iv_maxresults = 123
iv_multinodejobid = |string|
iv_nexttoken = |string|
).
This is an example of reading all possible response values
lo_result = lo_result.
IF lo_result IS NOT INITIAL.
LOOP AT lo_result->get_jobsummarylist( ) into lo_row.
lo_row_1 = lo_row.
IF lo_row_1 IS NOT INITIAL.
lv_string = lo_row_1->get_jobarn( ).
lv_string = lo_row_1->get_jobid( ).
lv_string = lo_row_1->get_jobname( ).
lv_long = lo_row_1->get_createdat( ).
lv_jobstatus = lo_row_1->get_status( ).
lv_string = lo_row_1->get_statusreason( ).
lv_long = lo_row_1->get_startedat( ).
lv_long = lo_row_1->get_stoppedat( ).
lo_containersummary = lo_row_1->get_container( ).
IF lo_containersummary IS NOT INITIAL.
lv_integer = lo_containersummary->get_exitcode( ).
lv_string = lo_containersummary->get_reason( ).
ENDIF.
lo_arraypropertiessummary = lo_row_1->get_arrayproperties( ).
IF lo_arraypropertiessummary IS NOT INITIAL.
lv_integer = lo_arraypropertiessummary->get_size( ).
lv_integer = lo_arraypropertiessummary->get_index( ).
ENDIF.
lo_nodepropertiessummary = lo_row_1->get_nodeproperties( ).
IF lo_nodepropertiessummary IS NOT INITIAL.
lv_boolean = lo_nodepropertiessummary->get_ismainnode( ).
lv_integer = lo_nodepropertiessummary->get_numnodes( ).
lv_integer = lo_nodepropertiessummary->get_nodeindex( ).
ENDIF.
lv_string = lo_row_1->get_jobdefinition( ).
ENDIF.
ENDLOOP.
lv_string = lo_result->get_nexttoken( ).
ENDIF.
To list running jobs¶
This example lists the running jobs in the HighPriority job queue.
DATA(lo_result) = lo_client->listjobs( iv_jobqueue = |HighPriority| ) .
To list submitted jobs¶
This example lists jobs in the HighPriority job queue that are in the SUBMITTED job status.
DATA(lo_result) = lo_client->listjobs(
iv_jobqueue = |HighPriority|
iv_jobstatus = |SUBMITTED|
).