Jobs
Run a job
Invoke a Qiskit Runtime primitive.
Authorization
To call this method, you must be assigned one or more IAM access roles that include the following actions. You can check your access by going to Users > User > Access
quantum-computing.direct-access-job.create
Auditing
Calling this method generates the following auditing events.
quantum-computing.direct-access-job.create
Input
Name, Type | Description |
|---|---|
backend Required string | Name of the backend Example: "ibm_rensselaer" |
id Required string | Job identifier. Recommended to be UUID |
log_level string | Logging level of the program Possible values: infodebugwarningerrorcriticalDefault value: warning |
program_id Required string | ID of the program Example: "sampler" |
storage Required | |
timeout_secs Required integer | Time (in seconds) after which job should time out and get cancelled. It is based on system execution time (not wall clock time). System execution time is the amount of time that the system is dedicated to processing your job. |
curl -X POST \
'https://direct-access-<YOUR_CLIENT_ACRONYM>.quantum-computing.cloud.ibm.com:30060/v1/jobs' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
-d '{"id":"example","program_id":"sampler","backend":"ibm_rensselaer","timeout_secs":1,"storage":{}}'import requests
response = requests.request(
"POST",
"https://direct-access-<YOUR_CLIENT_ACRONYM>.quantum-computing.cloud.ibm.com:30060/v1/jobs",
headers={
"Accept": "application/json",
"Content-Type": "application/json"
},
data="{\"id\":\"example\",\"program_id\":\"sampler\",\"backend\":\"ibm_rensselaer\",\"timeout_secs\":1,\"storage\":{}}"
)
print(response.json())Output
Status code | Description |
|---|---|
| 204 | Returned when job was submitted successfully. |
| 400 | Returned when invalid input is received. |
| 401 | Returned when authentication failed. |
| 404 | Returned when the backend was not found |
| 408 | Returned when the request took too long to read. |
| 409 | Returned when a duplicate job with same job ID was submitted. |
| 413 | Returned when the request body is too large. |
| 422 | Returned when validation of the request failed. The error message contains details about the specific validation error. |
| 423 | The requested backend is reserved and jobs outside of the reservation cannot be run. |
| 429 | Returned when per backend concurrent job limit has been reached. Try again later once existing jobs terminate and delete terminated jobs to submit more. |
Get jobs
Fetches a list of all jobs submitted by the current authenticated client, ordered by creation time in ascending order.
Authorization
To call this method, you must be assigned one or more IAM access roles that include the following actions. You can check your access by going to Users > User > Access
quantum-computing.direct-access-job.list
Auditing
Calling this method generates the following auditing events.
quantum-computing.direct-access-job.list
Input
Infomation |
|---|
| This endpoint accepts no inputs. |
curl -X GET \
'https://direct-access-<YOUR_CLIENT_ACRONYM>.quantum-computing.cloud.ibm.com:30060/v1/jobs' \
-H 'Accept: application/json'import requests
response = requests.request(
"GET",
"https://direct-access-<YOUR_CLIENT_ACRONYM>.quantum-computing.cloud.ibm.com:30060/v1/jobs",
headers={
"Accept": "application/json"
},
)
print(response.json())Output
Status code | Description |
|---|---|
| 200 | Returned when jobs were retrieved successfully. |
| 401 | Returned when authentication failed. |
{
"jobs": [
{
"backend": "ibm_rensselaer",
"created_time": "example",
"end_time": "example",
"id": "example",
"log_level": "info",
"program_id": "sampler",
"reason_code": 1,
"reason_message": "example",
"reason_solution": "example",
"status": "Running",
"storage": {
"input": {
"bucket_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket",
"object_name": "example",
"presigned_url": "example",
"region": "us-east",
"region_type": "regional",
"runtime_instance_crn": "crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::",
"type": "s3_compatible"
},
"logs": {
"bucket_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket",
"object_name": "example",
"presigned_url": "example",
"region": "us-east",
"region_type": "regional",
"runtime_instance_crn": "crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::",
"type": "s3_compatible"
},
"results": {
"bucket_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket",
"object_name": "example",
"presigned_url": "example",
"region": "us-east",
"region_type": "regional",
"runtime_instance_crn": "crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::",
"type": "s3_compatible"
}
},
"timeout_secs": 1,
"usage": {
"quantum_nanoseconds": 1
}
}
]
}{
"additionalProperties": false,
"properties": {
"jobs": {
"items": {
"additionalProperties": false,
"properties": {
"backend": {
"description": "Name of the backend",
"examples": [
"ibm_rensselaer"
],
"type": "string"
},
"created_time": {
"description": "Time when job was created.",
"format": "date-time",
"type": "string"
},
"end_time": {
"description": "Time when job reached a terminal status.",
"format": "date-time",
"type": "string"
},
"id": {
"description": "Unique ID for the Job (UUID V4)",
"type": "string"
},
"log_level": {
"description": "Logging level of the program",
"enum": [
"info",
"debug",
"warning",
"error",
"critical"
],
"type": "string"
},
"program_id": {
"description": "ID of the program",
"examples": [
"sampler"
],
"type": "string"
},
"reason_code": {
"description": "This field will be set to a numeric error code when the job has failed.",
"format": "int64",
"type": "integer"
},
"reason_message": {
"description": "Reason message explaining why the job is in a particular status. Ex: If a job has Failed, this field will have the error message.",
"type": "string"
},
"reason_solution": {
"description": "Next steps to take in case of failure.",
"type": "string"
},
"status": {
"description": "Current status of the job.",
"enum": [
"Running",
"Completed",
"Cancelled",
"Failed"
],
"type": "string"
},
"storage": {
"additionalProperties": false,
"properties": {
"input": {
"description": "Location from where input will be read. Required for primitive programs.",
"additionalProperties": false,
"properties": {
"bucket_crn": {
"description": "Fully specified <a href='https://cloud.ibm.com/docs/account?topic=account-crn'>CRN</a> for the target Cloud Object Storage bucket. bucket_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket"
],
"type": "string"
},
"object_name": {
"description": "Name/ID of the object in the IBM Cloud Object Storage bucket. object_name is required when type is <b>ibmcloud_cos</b>",
"type": "string"
},
"presigned_url": {
"description": "Presigned GET or PUT URLs to read job params or write results and logs to. presigned_url is required when type is <b>s3_compatible</b>",
"type": "string"
},
"region": {
"description": "region is required when type is <b>ibmcloud_cos</b>",
"examples": [
"us-east"
],
"pattern": "^[a-zA-Z-]+$",
"type": "string"
},
"region_type": {
"description": "Region, Cross-Region, or Single Data Center as defined by IBM Cloud Object Storage (https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints). region_type is required when type is <b>ibmcloud_cos</b>",
"enum": [
"regional",
"cross-region",
"single-site"
],
"type": "string"
},
"runtime_instance_crn": {
"description": "Service CRN of the runtime instance that has access to the provided storage location. runtime_instance_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::"
],
"type": "string"
},
"type": {
"enum": [
"s3_compatible"
],
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
},
"logs": {
"description": "Location for where job logs will be stored.",
"additionalProperties": false,
"properties": {
"bucket_crn": {
"description": "Fully specified <a href='https://cloud.ibm.com/docs/account?topic=account-crn'>CRN</a> for the target Cloud Object Storage bucket. bucket_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket"
],
"type": "string"
},
"object_name": {
"description": "Name/ID of the object in the IBM Cloud Object Storage bucket. object_name is required when type is <b>ibmcloud_cos</b>",
"type": "string"
},
"presigned_url": {
"description": "Presigned GET or PUT URLs to read job params or write results and logs to. presigned_url is required when type is <b>s3_compatible</b>",
"type": "string"
},
"region": {
"description": "region is required when type is <b>ibmcloud_cos</b>",
"examples": [
"us-east"
],
"pattern": "^[a-zA-Z-]+$",
"type": "string"
},
"region_type": {
"description": "Region, Cross-Region, or Single Data Center as defined by IBM Cloud Object Storage (https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints). region_type is required when type is <b>ibmcloud_cos</b>",
"enum": [
"regional",
"cross-region",
"single-site"
],
"type": "string"
},
"runtime_instance_crn": {
"description": "Service CRN of the runtime instance that has access to the provided storage location. runtime_instance_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::"
],
"type": "string"
},
"type": {
"enum": [
"s3_compatible"
],
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
},
"results": {
"description": "Location for where job results will be stored. Required for primitive programs.",
"additionalProperties": false,
"properties": {
"bucket_crn": {
"description": "Fully specified <a href='https://cloud.ibm.com/docs/account?topic=account-crn'>CRN</a> for the target Cloud Object Storage bucket. bucket_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket"
],
"type": "string"
},
"object_name": {
"description": "Name/ID of the object in the IBM Cloud Object Storage bucket. object_name is required when type is <b>ibmcloud_cos</b>",
"type": "string"
},
"presigned_url": {
"description": "Presigned GET or PUT URLs to read job params or write results and logs to. presigned_url is required when type is <b>s3_compatible</b>",
"type": "string"
},
"region": {
"description": "region is required when type is <b>ibmcloud_cos</b>",
"examples": [
"us-east"
],
"pattern": "^[a-zA-Z-]+$",
"type": "string"
},
"region_type": {
"description": "Region, Cross-Region, or Single Data Center as defined by IBM Cloud Object Storage (https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints). region_type is required when type is <b>ibmcloud_cos</b>",
"enum": [
"regional",
"cross-region",
"single-site"
],
"type": "string"
},
"runtime_instance_crn": {
"description": "Service CRN of the runtime instance that has access to the provided storage location. runtime_instance_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::"
],
"type": "string"
},
"type": {
"enum": [
"s3_compatible"
],
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
}
},
"type": "object"
},
"timeout_secs": {
"description": "Time (in seconds) after which job should time out and get cancelled.",
"format": "int64",
"type": "integer"
},
"usage": {
"description": "Job usage details.",
"additionalProperties": false,
"properties": {
"quantum_nanoseconds": {
"description": "Execution time on quantum device in nanoseconds.",
"format": "int64",
"type": "integer"
}
},
"type": "object"
}
},
"required": [
"id",
"program_id",
"backend",
"status",
"created_time"
],
"type": "object"
},
"type": [
"array",
"null"
]
}
},
"required": [
"jobs"
],
"type": "object"
}Get Job by ID
Fetches a single job by its unique identifier for the current authenticated client.
Authorization
To call this method, you must be assigned one or more IAM access roles that include the following actions. You can check your access by going to Users > User > Access
quantum-computing.direct-access-job.read
Auditing
Calling this method generates the following auditing events.
quantum-computing.direct-access-job.read
Input
Name, Type | Description |
|---|---|
job-id Required string |
curl -X GET \
'https://direct-access-<YOUR_CLIENT_ACRONYM>.quantum-computing.cloud.ibm.com:30060/v1/jobs/{job-id}' \
-H 'Accept: application/json'import requests
response = requests.request(
"GET",
"https://direct-access-<YOUR_CLIENT_ACRONYM>.quantum-computing.cloud.ibm.com:30060/v1/jobs/{job-id}",
headers={
"Accept": "application/json"
},
)
print(response.json())Output
Status code | Description |
|---|---|
| 200 | Job retrieved successfully. |
| 401 | Returned when authentication failed. |
| 404 | No job found for the provided ID belonging to the authenticated client. |
{
"backend": "ibm_rensselaer",
"created_time": "example",
"end_time": "example",
"id": "example",
"log_level": "info",
"program_id": "sampler",
"reason_code": 1,
"reason_message": "example",
"reason_solution": "example",
"status": "Running",
"storage": {
"input": {
"bucket_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket",
"object_name": "example",
"presigned_url": "example",
"region": "us-east",
"region_type": "regional",
"runtime_instance_crn": "crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::",
"type": "s3_compatible"
},
"logs": {
"bucket_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket",
"object_name": "example",
"presigned_url": "example",
"region": "us-east",
"region_type": "regional",
"runtime_instance_crn": "crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::",
"type": "s3_compatible"
},
"results": {
"bucket_crn": "crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket",
"object_name": "example",
"presigned_url": "example",
"region": "us-east",
"region_type": "regional",
"runtime_instance_crn": "crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::",
"type": "s3_compatible"
}
},
"timeout_secs": 1,
"usage": {
"quantum_nanoseconds": 1
}
}{
"additionalProperties": false,
"properties": {
"backend": {
"description": "Name of the backend",
"examples": [
"ibm_rensselaer"
],
"type": "string"
},
"created_time": {
"description": "Time when job was created.",
"format": "date-time",
"type": "string"
},
"end_time": {
"description": "Time when job reached a terminal status.",
"format": "date-time",
"type": "string"
},
"id": {
"description": "Unique ID for the Job (UUID V4)",
"type": "string"
},
"log_level": {
"description": "Logging level of the program",
"enum": [
"info",
"debug",
"warning",
"error",
"critical"
],
"type": "string"
},
"program_id": {
"description": "ID of the program",
"examples": [
"sampler"
],
"type": "string"
},
"reason_code": {
"description": "This field will be set to a numeric error code when the job has failed.",
"format": "int64",
"type": "integer"
},
"reason_message": {
"description": "Reason message explaining why the job is in a particular status. Ex: If a job has Failed, this field will have the error message.",
"type": "string"
},
"reason_solution": {
"description": "Next steps to take in case of failure.",
"type": "string"
},
"status": {
"description": "Current status of the job.",
"enum": [
"Running",
"Completed",
"Cancelled",
"Failed"
],
"type": "string"
},
"storage": {
"additionalProperties": false,
"properties": {
"input": {
"description": "Location from where input will be read. Required for primitive programs.",
"additionalProperties": false,
"properties": {
"bucket_crn": {
"description": "Fully specified <a href='https://cloud.ibm.com/docs/account?topic=account-crn'>CRN</a> for the target Cloud Object Storage bucket. bucket_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket"
],
"type": "string"
},
"object_name": {
"description": "Name/ID of the object in the IBM Cloud Object Storage bucket. object_name is required when type is <b>ibmcloud_cos</b>",
"type": "string"
},
"presigned_url": {
"description": "Presigned GET or PUT URLs to read job params or write results and logs to. presigned_url is required when type is <b>s3_compatible</b>",
"type": "string"
},
"region": {
"description": "region is required when type is <b>ibmcloud_cos</b>",
"examples": [
"us-east"
],
"pattern": "^[a-zA-Z-]+$",
"type": "string"
},
"region_type": {
"description": "Region, Cross-Region, or Single Data Center as defined by IBM Cloud Object Storage (https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints). region_type is required when type is <b>ibmcloud_cos</b>",
"enum": [
"regional",
"cross-region",
"single-site"
],
"type": "string"
},
"runtime_instance_crn": {
"description": "Service CRN of the runtime instance that has access to the provided storage location. runtime_instance_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::"
],
"type": "string"
},
"type": {
"enum": [
"s3_compatible"
],
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
},
"logs": {
"description": "Location for where job logs will be stored.",
"additionalProperties": false,
"properties": {
"bucket_crn": {
"description": "Fully specified <a href='https://cloud.ibm.com/docs/account?topic=account-crn'>CRN</a> for the target Cloud Object Storage bucket. bucket_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket"
],
"type": "string"
},
"object_name": {
"description": "Name/ID of the object in the IBM Cloud Object Storage bucket. object_name is required when type is <b>ibmcloud_cos</b>",
"type": "string"
},
"presigned_url": {
"description": "Presigned GET or PUT URLs to read job params or write results and logs to. presigned_url is required when type is <b>s3_compatible</b>",
"type": "string"
},
"region": {
"description": "region is required when type is <b>ibmcloud_cos</b>",
"examples": [
"us-east"
],
"pattern": "^[a-zA-Z-]+$",
"type": "string"
},
"region_type": {
"description": "Region, Cross-Region, or Single Data Center as defined by IBM Cloud Object Storage (https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints). region_type is required when type is <b>ibmcloud_cos</b>",
"enum": [
"regional",
"cross-region",
"single-site"
],
"type": "string"
},
"runtime_instance_crn": {
"description": "Service CRN of the runtime instance that has access to the provided storage location. runtime_instance_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::"
],
"type": "string"
},
"type": {
"enum": [
"s3_compatible"
],
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
},
"results": {
"description": "Location for where job results will be stored. Required for primitive programs.",
"additionalProperties": false,
"properties": {
"bucket_crn": {
"description": "Fully specified <a href='https://cloud.ibm.com/docs/account?topic=account-crn'>CRN</a> for the target Cloud Object Storage bucket. bucket_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:cloud-object-storage:global:a/abc123:abc123:bucket:my-bucket"
],
"type": "string"
},
"object_name": {
"description": "Name/ID of the object in the IBM Cloud Object Storage bucket. object_name is required when type is <b>ibmcloud_cos</b>",
"type": "string"
},
"presigned_url": {
"description": "Presigned GET or PUT URLs to read job params or write results and logs to. presigned_url is required when type is <b>s3_compatible</b>",
"type": "string"
},
"region": {
"description": "region is required when type is <b>ibmcloud_cos</b>",
"examples": [
"us-east"
],
"pattern": "^[a-zA-Z-]+$",
"type": "string"
},
"region_type": {
"description": "Region, Cross-Region, or Single Data Center as defined by IBM Cloud Object Storage (https://cloud.ibm.com/docs/cloud-object-storage?topic=cloud-object-storage-endpoints). region_type is required when type is <b>ibmcloud_cos</b>",
"enum": [
"regional",
"cross-region",
"single-site"
],
"type": "string"
},
"runtime_instance_crn": {
"description": "Service CRN of the runtime instance that has access to the provided storage location. runtime_instance_crn is required when type is <b>ibmcloud_cos</b>",
"examples": [
"crn:v1:bluemix:public:quantum-computing:us-east:a/abc123:abc123::"
],
"type": "string"
},
"type": {
"enum": [
"s3_compatible"
],
"type": "string"
}
},
"required": [
"type"
],
"type": "object"
}
},
"type": "object"
},
"timeout_secs": {
"description": "Time (in seconds) after which job should time out and get cancelled.",
"format": "int64",
"type": "integer"
},
"usage": {
"description": "Job usage details.",
"additionalProperties": false,
"properties": {
"quantum_nanoseconds": {
"description": "Execution time on quantum device in nanoseconds.",
"format": "int64",
"type": "integer"
}
},
"type": "object"
}
},
"required": [
"id",
"program_id",
"backend",
"status",
"created_time"
],
"type": "object"
}Delete a job
Deletes a job if it has terminated.
Authorization
To call this method, you must be assigned one or more IAM access roles that include the following actions. You can check your access by going to Users > User > Access
quantum-computing.direct-access-job.delete
Auditing
Calling this method generates the following auditing events.
quantum-computing.direct-access-job.delete
Input
Name, Type | Description |
|---|---|
job-id Required string |
curl -X DELETE \
'https://direct-access-<YOUR_CLIENT_ACRONYM>.quantum-computing.cloud.ibm.com:30060/v1/jobs/{job-id}' \
-H 'Accept: application/json'import requests
response = requests.request(
"DELETE",
"https://direct-access-<YOUR_CLIENT_ACRONYM>.quantum-computing.cloud.ibm.com:30060/v1/jobs/{job-id}",
headers={
"Accept": "application/json"
},
)
print(response.json())Output
Status code | Description |
|---|---|
| 204 | Returned when job was deleted successfully. |
| 401 | Returned when authentication failed. |
| 404 | Returned when job is not found. |
| 409 | Returned when a job has not yet terminated and has to be cancelled before it can be deleted. |
Cancel a job
Cancels a job if it has not yet terminated.
Authorization
To call this method, you must be assigned one or more IAM access roles that include the following actions. You can check your access by going to Users > User > Access
quantum-computing.direct-access-job.cancel
Auditing
Calling this method generates the following auditing events.
quantum-computing.direct-access-job.cancel
Input
Name, Type | Description |
|---|---|
job-id Required string |
curl -X POST \
'https://direct-access-<YOUR_CLIENT_ACRONYM>.quantum-computing.cloud.ibm.com:30060/v1/jobs/{job-id}/cancel' \
-H 'Accept: application/json'import requests
response = requests.request(
"POST",
"https://direct-access-<YOUR_CLIENT_ACRONYM>.quantum-computing.cloud.ibm.com:30060/v1/jobs/{job-id}/cancel",
headers={
"Accept": "application/json"
},
)
print(response.json())Output
Status code | Description |
|---|---|
| 204 | Returned when job cancel request was submitted successfully. |
| 401 | Returned when authentication failed. |
| 404 | Returned when job is not found. |
| 409 | Returned when a job has already terminated and cannot be cancelled. |
| 500 | Returned when an internal server error occurs. |