세션
세션 작성
세션 작성
권한 부여
이 메소드를 호출하려면 다음 조치를 포함하는 하나 이상의 IAM 액세스 역할이 지정되어야 합니다. 다음으로 이동하여 액세스 권한을 확인할 수 있습니다. Users > User > Access
quantum-computing.session.create
감사
이 메소드를 호출하면 다음과 같은 감사 이벤트가 생성됩니다.
quantum-computing.session.create
입력
이름, 유형 | 설명 |
|---|---|
max_ttl integer | 세션이 실행되는 최대 시간(초)으로, 요금제 제한에 따라 달라질 수 있습니다. 기본값: 28800최소값: 1최대값: 2147483647 |
mode string | 세션을 실행할 실행 모드 가능한 값: batchdedicated |
backend string | 백엔드 이름 |
backend_name string | 백엔드 이름(대체) |
인스턴스가 eu-de 리전에 있는 경우, 대신 URL 를 사용하세요: https://eu-de.quantum.cloud.ibm.com/api/v1/sessions
curl -X POST \
'https://quantum.cloud.ibm.com/api/v1/sessions' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Service-CRN: YOUR-SERVICE-CRN' \
-H 'IBM-API-Version: 2024-01-01' 인스턴스가 eu-de 리전에 있는 경우, 대신 URL 를 사용하세요: https://eu-de.quantum.cloud.ibm.com/api/v1/sessions
import requests
response = requests.request(
"POST",
"https://quantum.cloud.ibm.com/api/v1/sessions",
headers={
"Accept": "application/json",
"IBM-API-Version": "2024-01-01",
"Authorization": "Bearer YOUR-TOKEN",
"Service-CRN": "YOUR-SERVICE-CRN"
},
)
print(response.json())출력
상태 코드 | 설명 |
|---|---|
| 200 | 확인 |
| 400 | 잘못된 요청 |
| 401 | 권한 없음 |
| 500 | 내부 오류 |
{
"id": "example",
"backend_name": "example",
"started_at": "example",
"activated_at": "example",
"closed_at": "example",
"last_job_started": "example",
"last_job_completed": "example",
"interactive_ttl": 1,
"max_ttl": 1,
"active_ttl": 1,
"state": "open",
"state_reason": "example",
"accepting_jobs": true,
"mode": "batch",
"timestamps": [
{
"status": "open",
"timestamp": "example"
}
],
"user_id": "example",
"elapsed_time": 1.432
}{
"type": "object",
"description": "작업 세션",
"properties": {
"id": {
"type": "string",
"description": "작업 ID"
},
"backend_name": {
"type": "string",
"description": "백엔드 이름. '열기' 상태에서는 설정할 수 없습니다.",
"nullable": true
},
"started_at": {
"type": "string",
"format": "date-time",
"description": "세션이 시작된 시점의 타임스탬프"
},
"activated_at": {
"type": "string",
"format": "date-time",
"description": "세션 상태가 활성으로 변경된 시점의 타임스탬프"
},
"closed_at": {
"type": "string",
"format": "date-time",
"description": "세션이 종료된 시점의 타임스탬프"
},
"last_job_started": {
"type": "string",
"format": "date-time",
"description": "세션의 마지막 작업이 시작된 시점의 타임스탬프"
},
"last_job_completed": {
"type": "string",
"format": "date-time",
"description": "세션의 마지막 작업이 완료된 시점의 타임스탬프"
},
"interactive_ttl": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 2147483647,
"description": "세션을 활성 상태로 유지하기 위한 작업 간 최대 시간(초)"
},
"max_ttl": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 2147483647,
"description": "세션이 실행되는 최대 시간(초)으로, 요금제 제한에 따라 달라질 수 있습니다"
},
"active_ttl": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 2147483647,
"description": "작업이 실행되는 동안 세션이 활성 상태로 유지되는 남은 시간(초)입니다."
},
"state": {
"type": "string",
"enum": [
"open",
"active",
"inactive",
"closed"
],
"description": "세션의 상태\n\n* 열립니다: 세션이 작업 실행을 대기 중입니다.\n* 활성 상태입니다: 세션이 백엔드에서 작업을 실행할 우선 순위가 있으며 작업을 실행 중이거나 더 많은 작업이 실행되기를 기다리는 중입니다.\n* 비활성 상태입니다: 세션에 우선 순위가 없으며 어떤 작업도 실행하고 있지 않습니다.\n* 닫혔습니다: 세션이 작업을 실행하고 있지 않으며 새 작업을 수락/실행하지 않습니다."
},
"state_reason": {
"type": "string",
"description": "상태 변경에 대한 이유입니다."
},
"accepting_jobs": {
"type": "boolean",
"description": "참이면 세션이 대기열에 추가할 새 작업을 적극적으로 수락하는 것입니다. 거짓이면 작업 생성 시 작업이 거부되고 세션에 더 이상 실행할 작업이 없으면 세션이 즉시 닫힙니다."
},
"mode": {
"type": "string",
"description": "세션을 실행할 실행 모드",
"enum": [
"batch",
"dedicated"
]
},
"timestamps": {
"type": "array",
"items": {
"type": "object",
"description": "특정 상태 전환이 발생한 시간에 대한 정보를 포함합니다",
"properties": {
"status": {
"type": "string",
"enum": [
"open",
"active",
"inactive",
"closed"
],
"description": "세션의 상태\n\n* 열립니다: 세션이 작업 실행을 대기 중입니다.\n* 활성 상태입니다: 세션이 백엔드에서 작업을 실행할 우선 순위가 있으며 작업을 실행 중이거나 더 많은 작업이 실행되기를 기다리는 중입니다.\n* 비활성 상태입니다: 세션에 우선 순위가 없으며 어떤 작업도 실행하고 있지 않습니다.\n* 닫혔습니다: 세션이 작업을 실행하고 있지 않으며 새 작업을 수락/실행하지 않습니다."
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "세션이 지정된 상태로 전환된 시점의 타임스탬프"
}
},
"required": [
"status",
"timestamp"
]
}
},
"user_id": {
"type": "string",
"description": "세션을 생성한 사용자의 아이디입니다."
},
"elapsed_time": {
"type": "number",
"description": "몇 초 만에 사용 가능. 진행 중인 세션의 경우 무효화할 수 있습니다.",
"example": 1.432
}
},
"required": [
"id",
"backend_name",
"mode"
]
}세션 받기
세션 받기
권한 부여
이 메소드를 호출하려면 다음 조치를 포함하는 하나 이상의 IAM 액세스 역할이 지정되어야 합니다. 다음으로 이동하여 액세스 권한을 확인할 수 있습니다. Users > User > Access
quantum-computing.session.read
감사
이 메소드를 호출하면 다음과 같은 감사 이벤트가 생성됩니다.
quantum-computing.session.read
입력
이름, 유형 | 설명 |
|---|---|
id 필수 string | 작업 세션 ID |
인스턴스가 eu-de 리전에 있는 경우, 대신 URL 를 사용하세요: https://eu-de.quantum.cloud.ibm.com/api/v1/sessions/{id}
curl -X GET \
'https://quantum.cloud.ibm.com/api/v1/sessions/{id}' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Service-CRN: YOUR-SERVICE-CRN' \
-H 'IBM-API-Version: 2024-01-01' 인스턴스가 eu-de 리전에 있는 경우, 대신 URL 를 사용하세요: https://eu-de.quantum.cloud.ibm.com/api/v1/sessions/{id}
import requests
response = requests.request(
"GET",
"https://quantum.cloud.ibm.com/api/v1/sessions/{id}",
headers={
"Accept": "application/json",
"IBM-API-Version": "2024-01-01",
"Authorization": "Bearer YOUR-TOKEN",
"Service-CRN": "YOUR-SERVICE-CRN"
},
)
print(response.json())출력
상태 코드 | 설명 |
|---|---|
| 200 | 확인 |
| 401 | 권한 없음 |
| 404 | 찾을 수 없음 |
| 500 | 내부 오류 |
{
"id": "example",
"backend_name": "example",
"started_at": "example",
"activated_at": "example",
"closed_at": "example",
"last_job_started": "example",
"last_job_completed": "example",
"interactive_ttl": 1,
"max_ttl": 1,
"active_ttl": 1,
"state": "open",
"state_reason": "example",
"accepting_jobs": true,
"mode": "batch",
"timestamps": [
{
"status": "open",
"timestamp": "example"
}
],
"user_id": "example",
"elapsed_time": 1.432
}{
"type": "object",
"description": "작업 세션",
"properties": {
"id": {
"type": "string",
"description": "작업 ID"
},
"backend_name": {
"type": "string",
"description": "백엔드 이름. '열기' 상태에서는 설정할 수 없습니다.",
"nullable": true
},
"started_at": {
"type": "string",
"format": "date-time",
"description": "세션이 시작된 시점의 타임스탬프"
},
"activated_at": {
"type": "string",
"format": "date-time",
"description": "세션 상태가 활성으로 변경된 시점의 타임스탬프"
},
"closed_at": {
"type": "string",
"format": "date-time",
"description": "세션이 종료된 시점의 타임스탬프"
},
"last_job_started": {
"type": "string",
"format": "date-time",
"description": "세션의 마지막 작업이 시작된 시점의 타임스탬프"
},
"last_job_completed": {
"type": "string",
"format": "date-time",
"description": "세션의 마지막 작업이 완료된 시점의 타임스탬프"
},
"interactive_ttl": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 2147483647,
"description": "세션을 활성 상태로 유지하기 위한 작업 간 최대 시간(초)"
},
"max_ttl": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 2147483647,
"description": "세션이 실행되는 최대 시간(초)으로, 요금제 제한에 따라 달라질 수 있습니다"
},
"active_ttl": {
"type": "integer",
"format": "int32",
"minimum": 1,
"maximum": 2147483647,
"description": "작업이 실행되는 동안 세션이 활성 상태로 유지되는 남은 시간(초)입니다."
},
"state": {
"type": "string",
"enum": [
"open",
"active",
"inactive",
"closed"
],
"description": "세션의 상태\n\n* 열립니다: 세션이 작업 실행을 대기 중입니다.\n* 활성 상태입니다: 세션이 백엔드에서 작업을 실행할 우선 순위가 있으며 작업을 실행 중이거나 더 많은 작업이 실행되기를 기다리는 중입니다.\n* 비활성 상태입니다: 세션에 우선 순위가 없으며 어떤 작업도 실행하고 있지 않습니다.\n* 닫혔습니다: 세션이 작업을 실행하고 있지 않으며 새 작업을 수락/실행하지 않습니다."
},
"state_reason": {
"type": "string",
"description": "상태 변경에 대한 이유입니다."
},
"accepting_jobs": {
"type": "boolean",
"description": "참이면 세션이 대기열에 추가할 새 작업을 적극적으로 수락하는 것입니다. 거짓이면 작업 생성 시 작업이 거부되고 세션에 더 이상 실행할 작업이 없으면 세션이 즉시 닫힙니다."
},
"mode": {
"type": "string",
"description": "세션을 실행할 실행 모드",
"enum": [
"batch",
"dedicated"
]
},
"timestamps": {
"type": "array",
"items": {
"type": "object",
"description": "특정 상태 전환이 발생한 시간에 대한 정보를 포함합니다",
"properties": {
"status": {
"type": "string",
"enum": [
"open",
"active",
"inactive",
"closed"
],
"description": "세션의 상태\n\n* 열립니다: 세션이 작업 실행을 대기 중입니다.\n* 활성 상태입니다: 세션이 백엔드에서 작업을 실행할 우선 순위가 있으며 작업을 실행 중이거나 더 많은 작업이 실행되기를 기다리는 중입니다.\n* 비활성 상태입니다: 세션에 우선 순위가 없으며 어떤 작업도 실행하고 있지 않습니다.\n* 닫혔습니다: 세션이 작업을 실행하고 있지 않으며 새 작업을 수락/실행하지 않습니다."
},
"timestamp": {
"type": "string",
"format": "date-time",
"description": "세션이 지정된 상태로 전환된 시점의 타임스탬프"
}
},
"required": [
"status",
"timestamp"
]
}
},
"user_id": {
"type": "string",
"description": "세션을 생성한 사용자의 아이디입니다."
},
"elapsed_time": {
"type": "number",
"description": "몇 초 만에 사용 가능. 진행 중인 세션의 경우 무효화할 수 있습니다.",
"example": 1.432
}
},
"required": [
"id",
"backend_name",
"mode"
]
}세션 업데이트
세션 업데이트
권한 부여
이 메소드를 호출하려면 다음 조치를 포함하는 하나 이상의 IAM 액세스 역할이 지정되어야 합니다. 다음으로 이동하여 액세스 권한을 확인할 수 있습니다. Users > User > Access
quantum-computing.session.update
감사
이 메소드를 호출하면 다음과 같은 감사 이벤트가 생성됩니다.
quantum-computing.session.update
입력
이름, 유형 | 설명 |
|---|---|
id 필수 string | 작업 세션 ID |
이름, 유형 | 설명 |
|---|---|
accepting_jobs 필수 boolean | 참이면 세션이 대기열에 추가할 새 작업을 적극적으로 수락하는 것입니다. 거짓이면 작업 생성 시 작업이 거부되고 세션에 더 이상 실행할 작업이 없으면 세션이 즉시 닫힙니다. |
인스턴스가 eu-de 리전에 있는 경우, 대신 URL 를 사용하세요: https://eu-de.quantum.cloud.ibm.com/api/v1/sessions/{id}
curl -X PATCH \
'https://quantum.cloud.ibm.com/api/v1/sessions/{id}' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Service-CRN: YOUR-SERVICE-CRN' \
-H 'IBM-API-Version: 2024-01-01' \
-H 'Content-Type: application/json' \
-d '{"accepting_jobs":true}' 인스턴스가 eu-de 리전에 있는 경우, 대신 URL 를 사용하세요: https://eu-de.quantum.cloud.ibm.com/api/v1/sessions/{id}
import requests
response = requests.request(
"PATCH",
"https://quantum.cloud.ibm.com/api/v1/sessions/{id}",
headers={
"Accept": "application/json",
"IBM-API-Version": "2024-01-01",
"Authorization": "Bearer YOUR-TOKEN",
"Service-CRN": "YOUR-SERVICE-CRN",
"Content-Type": "application/json"
},
data="{\"accepting_jobs\":true}"
)
print(response.json())출력
상태 코드 | 설명 |
|---|---|
| 204 | 세션 업데이트 성공 |
| 401 | 권한 없음 |
| 404 | 찾을 수 없음 |
| 500 | 내부 오류 |
작업 세션 닫기
런타임 세션을 닫습니다. 세션에서 새 작업 수락이 중지되고 대기 중인 작업이 실행되지 않습니다.
기존에 실행 중인 작업이 완료될 때까지 실행됩니다. 이는 키스킷의 cancel() 함수와 유사합니다.
권한 부여
이 메소드를 호출하려면 다음 조치를 포함하는 하나 이상의 IAM 액세스 역할이 지정되어야 합니다. 다음으로 이동하여 액세스 권한을 확인할 수 있습니다. Users > User > Access
quantum-computing.session.update
감사
이 메소드를 호출하면 다음과 같은 감사 이벤트가 생성됩니다.
quantum-computing.session.update
입력
이름, 유형 | 설명 |
|---|---|
id 필수 string | 세션 ID |
인스턴스가 eu-de 리전에 있는 경우, 대신 URL 를 사용하세요: https://eu-de.quantum.cloud.ibm.com/api/v1/sessions/{id}/close
curl -X DELETE \
'https://quantum.cloud.ibm.com/api/v1/sessions/{id}/close' \
-H 'Accept: application/json' \
-H 'Authorization: Bearer YOUR-TOKEN' \
-H 'Service-CRN: YOUR-SERVICE-CRN' \
-H 'IBM-API-Version: 2024-01-01' 인스턴스가 eu-de 리전에 있는 경우, 대신 URL 를 사용하세요: https://eu-de.quantum.cloud.ibm.com/api/v1/sessions/{id}/close
import requests
response = requests.request(
"DELETE",
"https://quantum.cloud.ibm.com/api/v1/sessions/{id}/close",
headers={
"Accept": "application/json",
"IBM-API-Version": "2024-01-01",
"Authorization": "Bearer YOUR-TOKEN",
"Service-CRN": "YOUR-SERVICE-CRN"
},
)
print(response.json())출력
상태 코드 | 설명 |
|---|---|
| 204 | 런타임 세션이 성공적으로 종료되었습니다 |