IDAX.APP_STATUS - Retrieve the status of a Spark application

Use this stored procedure to retrieve the status of an application that is asynchronously submitted to the Spark cluster manager. Moreover, you can retrieve the application status of all applications launched by you which the Spark cluster manager knows about.

Authorization

The privileges held by the authorization ID of the statement must include the IDAX_USER role.

Syntax

IDAX.APP_STATUS(in submission_id varchar(1024) default NULL)

Parameter descriptions

submission_id
Optional.
The submission ID of the Spark application that was started in the cluster.
Other allowed values are NULL and 'all'.
If no argument (or NULL) is specified, the status of the latest application that was submitted in this database session is retrieved.
If 'all' is specified, the application status of all applications submitted by you is retrieved.
Data type: VARCHAR(1024)

Returned information

The information about the status of one or more Spark applications as an SQL result set.

Typically, an application is in one of the following statuses:

Running
An application is running when it was successfully submitted and has not yet completed.
Not running
An application is not running when a wrong submission ID is specified, or when the Spark cluster manager has already deleted all information about the application.
Ended with or without failure
An application has ended when it stops with or without an error, or when the Spark cluster manager still stores the information about the application.

After an application A is submitted asynchronously, you can use APP_STATUS(), that is, call it without an argument, in the same session to retrieve the status of application A. If application A is submitted in a different session, or if an application B is afterwards submitted in the same session as application A, you must specify the submission ID of application A to APP_STATUS() to retrieve its status.

Example

$ db2 "call idax.glm('intable=iris, model=iris_model, id=id, target=petal')"
SQL0438N  Application raised error or warning with diagnostic text: 
"CDFAA0802E Spark application error: Target column "PETAL" specified do".  
SQLSTATE=38A00

$ db2 "call idax.glm('intable=iris, model=iris_model_2, id=id, target=petallength', false)" # false : asynchronous execution
  Return Status = 0

$ db2 "call idax.app_status()"
  Result set 1
  --------------
  SUBMISSION_ID        STATUS  RC MESSAGE
  -------------------- ------- -- -------
  20190204151322043000 running           
  1 record(s) selected.
  Return Status = 0
$ db2 "call idax.app_status()"
  Result set 1
  --------------
  SUBMISSION_ID        STATUS RC MESSAGE
  -------------------- ------ -- -------
  20190204151322043000 ended  0         
  1 record(s) selected.
  Return Status = 0
$ db2 "call idax.app_status('20190204151322043000')"
  Result set 1
  --------------
  SUBMISSION_ID        STATUS RC MESSAGE
  -------------------- ------ -- -------
  20190204151322043000 ended  0         
  1 record(s) selected.
  Return Status = 0
$ db2 "call idax.app_status('all')"
  Result set 1
  --------------
  SUBMISSION_ID        STATUS RC MESSAGE                                                                    
  -------------------- ------ -- ---------------------------------------------------------------------------
  20190204151145767000 ended  1  Target column "PETAL" specified does not exist in intable "BLUADMIN"."IRIS"
  20190204151322043000 ended  0       
  2 record(s) selected.
  Return Status = 0