Updated on 2024-12-03 GMT+08:00

Listing Jobs (2.2.13)

Function

After the ID of an asynchronous job is returned, if the job ID at the service layer is lost and cannot be obtained through the API, a new API is provided to query all asynchronous jobs stored in the engine. The job ID, job status, and original request of each job are returned.

URI

GET /ges/v1.0/{project_id}/graphs/{graph_name}/jobs/status?limit={limit}&offset={offset}
Table 1 URI parameters

Parameter

Mandatory

Type

Description

project_id

Yes

String

Project ID. For details about how to obtain the project ID, see Obtaining a Project ID.

offset

No

Integer

Offset of a query. The default value is 0.

job_id

Yes

String

ID of the job corresponding to the response

limit

No

Integer

Maximum number of records that can be queried. The default value is 100000.

Request Parameters

For details, see the URI parameters.

Response Parameters

Table 2 Response body parameters

Parameter

Type

Description

errorMessage

String

System prompt.

  • If the execution succeeds, this parameter may be left blank.
  • If the execution fails, this parameter is used to display the error message.

errorCode

String

System prompt.

  • If the execution succeeds, this parameter may be left blank.
  • If the execution fails, this parameter is used to display the error code.

result

String

Query result. The value is success for a successful query and failed for a failed query.

jobs

Object

Job status list stored in the system. If the execution succeeds, this parameter is returned. Table 3 describes the structure of a single job.

Table 3 Job status structure

Parameter

Type

Description

jobId

String

Job name.

rawRequest

String

Original request body

taskType

String

Job type

canStop

Boolean

Whether the job can be stopped

progress

Integer

Job progress. The value range is [0, 100].

startTime

String

Start time, which is a string of the date type or a timestamp

endTime

String

End time, which is a string of the date type or a timestamp

status

String

Job status when the query is successful. The options are:

  • pending
  • running
  • success
  • failed

This parameter is left blank when the query fails.

failReason

String

Failure cause. This parameter is returned only when status is failed.

files

Object

List of imported files. This parameter is returned only when taskType is ImportGraph.

Example Request

Query the job list and return the job ID and status of each job.

GET /ges/v1.0/{project_id}/graphs/movie/jobs/status?limit=2&offset=0

Example Response

Status code: 200

Example response for a successful request

{
    "jobs": [
        {
            "jobId": "b236a002-6acb-40cd-acca-bc3eb96b807d001680206",
            "rawRequest": "{\"algorithmName\":\"shortest_path\",\"parameters\":{\"source\":\"0000\",\"target\":\"38\"}}",
            "taskType": "Algorithm",
            "canStop": false,
            "progress": "100",
            "startTime": "2024-05-23 09:54:00",
            "failReason": "Running algorithm [shortest_path] error: parameter [source] is invalid!",
            "endTime": "2024-05-23 09:54:00",
            "status": "failed"
        },
        {
            "jobId": "5a39d9f6-e955-4294-8ec6-2fe18eee98c7001680206",
            "rawRequest": "{\"algorithmName\":\"shortest_path\",\"parameters\":{\"source\":\"46\",\"target\":\"38\"}}",
            "taskType": "Algorithm",
            "canStop": false,
            "progress": "100",
            "startTime": "2024-05-23 09:41:40",
            "endTime": "2024-05-23 09:41:40",
            "status": "success"
        },
        {
            "jobId": "cef6ae30-f21b-4a2a-a83c-cf91bee679d9001680206",
            "rawRequest": "",
            "taskType": "ImportGraph",
            "canStop": false,
            "progress": "100",
            "files": [
                {
                    "edgeFiles": [
                        {
                            "fileName": "/root/ges-install/auDatas/ranking_edge.csv",
                            "totalLines": 1659,
                            "startTime": 1716428001745772,
                            "successfulLines": 1659,
                            "endTime": 1716428001757920,
                            "status": "success",
                            "failedLines": 0
                        }
                    ]
                },
                {
                    "vertexFiles": [
                        {
                            "fileName": "/root/ges-install/auDatas/movies_vertex_new.csv",
                            "totalLines": 146,
                            "startTime": 1716428001656072,
                            "successfulLines": 146,
                            "endTime": 1716428001659352,
                            "status": "success",
                            "failedLines": 0
                        }
                    ]
                },
                {
                    "schemaFiles": [
                        {
                            "totalLabels": 49,
                            "fileName": "/root/ges-install/auDatas/schema.xml.bak",
                            "failedLabels": 0,
                            "startTime": 1716428001563921,
                            "successfulLabels": 49,
                            "endTime": 1716428001655884,
                            "status": "success"
                        }
                    ]
                }
            ],
            "startTime": "2024-05-23 09:33:21",
            "endTime": "2024-05-23 09:33:21",
            "status": "success"
        }
    ],
    "jobCount": 3
}

Status code: 400

Example response for a failed request

Http Status Code: 400 
 { 
     "errorMessage": "graph : movidde not exist",
    "errorCode": "GES.8000",
    "result": "failed"
}

Status Codes

Return Value

Description

400 Bad Request

Request error.

401 Unauthorized

Authorization failed.

403 Forbidden

No operation permissions.

404 Not Found

No resources found.

500 Internal Server Error

Internal server error.

503 Service Unavailable

Service unavailable.

Error Codes

See Error Codes.