

기계 번역으로 제공되는 번역입니다. 제공된 번역과 원본 영어의 내용이 상충하는 경우에는 영어 버전이 우선합니다.

# Neptune openCypher 상태 서블릿 및 상태 엔드포인트
<a name="access-graph-opencypher-status"></a>

openCypher 상태 엔드포인트는 현재 서버에서 실행 중이거나 실행 대기 중인 쿼리 정보에 대한 액세스를 제공합니다. 또한 해당 쿼리를 취소할 수 있도록 지원합니다. 엔드포인트는 다음과 같습니다.

```
https://{{(the server)}}:{{(the port number)}}/openCypher/status
```

HTTP `GET` 및 `POST` 메서드를 사용하여 서버에서 현재 상태를 가져오거나 쿼리를 취소할 수 있습니다. `DELETE` 메서드를 사용하여 실행 중이거나 대기 중인 쿼리를 취소할 수도 있습니다.

## 상태 요청 파라미터
<a name="access-graph-opencypher-status-parameters"></a>

**상태 쿼리 파라미터**
+ **`includeWaiting`**(`true` 또는 `false`)   –   `true`로 설정되고 다른 파라미터가 없으면 대기 중인 쿼리와 실행 중인 쿼리에 대한 상태 정보가 반환됩니다.
+ **`cancelQuery`**   –   취소 요청임을 나타내기 위해 `GET` 및 `POST` 메서드와 함께 활용하는 경우에만 사용됩니다. `DELETE` 메서드에는 이 파라미터가 필요하지 않습니다.

  `cancelQuery` 파라미터 값은 사용되지 않지만, `cancelQuery`가 있는 경우 취소할 쿼리를 식별하는 데 `queryId` 파라미터가 필요합니다.
+ **`queryId`**   –   특정 쿼리의 ID를 포함합니다.

  `GET` 또는 `POST` 메서드와 함께 사용하고 `cancelQuery` 파라미터가 없으면 `queryId`는 식별한 특정 쿼리에 대한 상태 정보를 반환합니다. `cancelQuery` 파라미터가 있는 경우 `queryId`에서 식별하는 특정 쿼리가 취소됩니다.

  `DELETE` 메서드와 함께 사용할 경우 `queryId`는 항상 특정 쿼리를 취소해야 함을 나타냅니다.
+ **`silent`**   –   쿼리를 취소할 때만 사용됩니다. `true`로 설정하면 취소가 자동으로 수행됩니다.

## 상태 요청 응답 필드
<a name="access-graph-opencypher-status-response-fields"></a>

**상태 응답 필드(특정 쿼리의 ID가 제공되지 않은 경우)**
+ **acceptedQueryCount**   –   대기열에 있는 쿼리를 포함하여 수락되었지만 아직 완료되지 않은 쿼리 수입니다.
+ **runningQueryCount**   –   현재 실행 중인 openCypher 쿼리의 수입니다.
+ **queries**   –   현재 openCypher 쿼리 목록입니다.

**특정 쿼리의 상태 응답 필드**
+ **queryId**   –   쿼리의 GUID ID입니다. Neptune이 ID 값을 각 쿼리에 자동 할당하거나 사용자가 자체 ID를 할당할 수 있습니다([Neptune Gremlin 또는 SPARQL 쿼리에 사용자 지정 ID 주입](features-query-id.md) 참조).
+ **queryString**   –   제출된 쿼리입니다. 이보다 길면 1024자로 잘립니다.
+ **queryEvalStats**   –   이 쿼리에 대한 통계입니다.
  + **waited**   –   쿼리가 대기한 시간을 밀리초 단위로 나타냅니다.
  + **elapsed**   –   지금까지 쿼리가 실행된 시간(밀리초)입니다.
  + **cancelled**   –   `True`는 쿼리가 취소되었음을, `False`는 취소되지 않았음을 나타냅니다.

## 상태 요청 및 응답의 예
<a name="access-graph-opencypher-status-samples"></a>
+ **대기 중인 쿼리를 포함한 모든 쿼리의 상태 요청:**

------
#### [ AWS CLI ]

  ```
  aws neptunedata get-open-cypher-query-status \
    --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
    --include-waiting
  ```

  자세한 내용은 AWS CLI 명령 참조의 [get-open-cypher-query-status](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-open-cypher-query-status.html)를 참조하세요.

------
#### [ SDK ]

  ```
  import boto3
  from botocore.config import Config
  
  client = boto3.client(
      'neptunedata',
      endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
      config=Config(read_timeout=None, retries={'total_max_attempts': 1})
  )
  
  response = client.get_open_cypher_query_status(
      includeWaiting=True
  )
  
  print(response)
  ```

  다른 언어의 AWS SDK 예제는 섹션을 참조하세요[AWS SDK](access-graph-opencypher-sdk.md).

------
#### [ awscurl ]

  ```
  awscurl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --region {{us-east-1}} \
    --service neptune-db \
    -X POST \
    -d "includeWaiting=true"
  ```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. {{us-east-1}}을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

  ```
  curl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --data-urlencode "includeWaiting=true"
  ```

------

  *응답*:

  ```
  {
    "acceptedQueryCount" : 0,
    "runningQueryCount" : 0,
    "queries" : [ ]
  }
  ```
+ **실행 중인 쿼리의 상태 요청(대기 중인 쿼리 **제외**):**

------
#### [ AWS CLI ]

  ```
  aws neptunedata get-open-cypher-query-status \
    --endpoint-url https://{{your-neptune-endpoint}}:{{port}}
  ```

  자세한 내용은 AWS CLI 명령 참조의 [get-open-cypher-query-status](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-open-cypher-query-status.html)를 참조하세요.

------
#### [ SDK ]

  ```
  import boto3
  from botocore.config import Config
  
  client = boto3.client(
      'neptunedata',
      endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
      config=Config(read_timeout=None, retries={'total_max_attempts': 1})
  )
  
  response = client.get_open_cypher_query_status()
  
  print(response)
  ```

  다른 언어의 AWS SDK 예제는 섹션을 참조하세요[AWS SDK](access-graph-opencypher-sdk.md).

------
#### [ awscurl ]

  ```
  awscurl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --region {{us-east-1}} \
    --service neptune-db
  ```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. {{us-east-1}}을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

  ```
  curl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status
  ```

------

  *응답*:

  ```
  {
    "acceptedQueryCount" : 0,
    "runningQueryCount" : 0,
    "queries" : [ ]
  }
  ```
+ **단일 쿼리의 상태 요청:**

------
#### [ AWS CLI ]

  ```
  aws neptunedata get-open-cypher-query-status \
    --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
    --query-id {{eadc6eea-698b-4a2f-8554-5270ab17ebee}}
  ```

  자세한 내용은 AWS CLI 명령 참조의 [get-open-cypher-query-status](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/get-open-cypher-query-status.html)를 참조하세요.

------
#### [ SDK ]

  ```
  import boto3
  from botocore.config import Config
  
  client = boto3.client(
      'neptunedata',
      endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
      config=Config(read_timeout=None, retries={'total_max_attempts': 1})
  )
  
  response = client.get_open_cypher_query_status(
      queryId='{{eadc6eea-698b-4a2f-8554-5270ab17ebee}}'
  )
  
  print(response)
  ```

  다른 언어의 AWS SDK 예제는 섹션을 참조하세요[AWS SDK](access-graph-opencypher-sdk.md).

------
#### [ awscurl ]

  ```
  awscurl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --region {{us-east-1}} \
    --service neptune-db \
    -X POST \
    -d "queryId={{eadc6eea-698b-4a2f-8554-5270ab17ebee}}"
  ```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. {{us-east-1}}을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

  ```
  curl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --data-urlencode "queryId={{eadc6eea-698b-4a2f-8554-5270ab17ebee}}"
  ```

------

  *응답*:

  ```
  {
    "queryId" : "eadc6eea-698b-4a2f-8554-5270ab17ebee",
    "queryString" : "MATCH (n1)-[:knows]->(n2), (n2)-[:knows]->(n3), (n3)-[:knows]->(n4), (n4)-[:knows]->(n5), (n5)-[:knows]->(n6), (n6)-[:knows]->(n7), (n7)-[:knows]->(n8), (n8)-[:knows]->(n9), (n9)-[:knows]->(n10) RETURN COUNT(n1);",
    "queryEvalStats" : {
      "waited" : 0,
      "elapsed" : 23463,
      "cancelled" : false
    }
  }
  ```
+ **쿼리 취소 요청**

------
#### [ AWS CLI ]

  ```
  aws neptunedata cancel-open-cypher-query \
    --endpoint-url https://{{your-neptune-endpoint}}:{{port}} \
    --query-id {{f43ce17b-db01-4d37-a074-c76d1c26d7a9}}
  ```

  자세한 내용은 AWS CLI 명령 참조의 [cancel-open-cypher-query](https://docs.aws.amazon.com/cli/latest/reference/neptunedata/cancel-open-cypher-query.html)를 참조하세요.

------
#### [ SDK ]

  ```
  import boto3
  from botocore.config import Config
  
  client = boto3.client(
      'neptunedata',
      endpoint_url='https://{{your-neptune-endpoint}}:{{port}}',
      config=Config(read_timeout=None, retries={'total_max_attempts': 1})
  )
  
  response = client.cancel_open_cypher_query(
      queryId='{{f43ce17b-db01-4d37-a074-c76d1c26d7a9}}'
  )
  
  print(response)
  ```

  다른 언어의 AWS SDK 예제는 섹션을 참조하세요[AWS SDK](access-graph-opencypher-sdk.md).

------
#### [ awscurl ]

  ```
  awscurl https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --region {{us-east-1}} \
    --service neptune-db \
    -X POST \
    -d "cancelQuery" \
    -d "queryId={{f43ce17b-db01-4d37-a074-c76d1c26d7a9}}"
  ```

**참고**  
이 예제에서는 자격 AWS 증명이 환경에 구성되어 있다고 가정합니다. {{us-east-1}}을 Neptune 클러스터의 리전으로 바꿉니다.

------
#### [ curl ]

  1. `POST` 사용:

  ```
  curl -X POST https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --data-urlencode "cancelQuery" \
    --data-urlencode "queryId={{f43ce17b-db01-4d37-a074-c76d1c26d7a9}}"
  ```

  2. `GET` 사용:

  ```
  curl -X GET https://{{your-neptune-endpoint}}:{{port}}/openCypher/status \
    --data-urlencode "cancelQuery" \
    --data-urlencode "queryId={{588af350-cfde-4222-bee6-b9cedc87180d}}"
  ```

  3. `DELETE` 사용:

  ```
  curl -X DELETE \
    "https://{{your-neptune-endpoint}}:{{port}}/openCypher/status?queryId={{b9a516d1-d25c-4301-bb80-10b2743ecf0e}}"
  ```

------

  *응답*:

  ```
  {
    "status" : "200 OK",
    "payload" : true
  }
  ```