작업 태그별로 정리 및 검색
이 페이지의 코드는 다음 요구 사항을 사용하여 개발되었습니다. 다음 버전 이상을 사용하는 것이 좋습니다.
qiskit[all]~=2.3.1 qiskit-ibm-runtime~=0.45.1
이 가이드에서는 실험을 더 잘 정리하고, 추적하고, 이해할 수 있도록 작업 태그를 추가하고 업데이트하는 방법과 작업 태그를 기준으로 검색하는 방법에 중점을 둡니다.
태그 지정
작업을 실행할 때 하나 이상의 태그를 할당하여 나중에 태그를 기준으로 필터링할 수 있도록 할 수 있습니다. 작업 태그를 사용하여 특정 오류 완화 설정, 회로 매개변수 등에 레이블을 지정할 수 있습니다.
from qiskit_ibm_runtime import QiskitRuntimeService, Sampler
from qiskit import QuantumCircuit
from qiskit.transpiler import generate_preset_pass_manager
service = QiskitRuntimeService()
backend = service.least_busy(simulator=False, operational=True)
qc = QuantumCircuit(2)
qc.h(0)
qc.cx(0, 1)
qc.measure_all()
sampler = Sampler(backend)
pm = generate_preset_pass_manager(backend=backend, optimization_level=1)
isa_circuit = pm.run(qc)
# Assign tags before executing
sampler.options.environment.job_tags = ["experiment-2025", "sampler-example"]
# Submit
job = sampler.run([isa_circuit])
print(service.job(job.job_id()).tags)Output:
['experiment-2025', 'sampler-example']
태그 추가 및 업데이트
update_tags() 메서드를 사용하여 작업을 제출한 후 태그를 추가할 수 있습니다. 이 방법은 현재 태그를 덮어쓰므로 이미 작업에 태그를 할당했는데 추가 태그를 추가하려면 원래 태그를 다시 할당해야 합니다.
# Add a new tag while keeping the previously assigned tags
job.update_tags(["experiment-2025", "sampler-example", "127-qubit"])
# Confirm updated tags
print(job.tags)Output:
['sampler-example', '127-qubit', 'experiment-2025']
태그로 작업 검색
특정 태그가 있는 작업 목록을 다음과 같이 표시합니다:
# List jobs with a specific tag or set of tags
service.jobs(job_tags=["experiment-2025", "sampler-example"])Output:
[<RuntimeJobV2('d76cmj5bjrds73edf2og', 'sampler')>,
<RuntimeJobV2('d6r5u84u243c73a11mug', 'sampler')>,
<RuntimeJobV2('d6hugq2thhns7392lovg', 'sampler')>,
<RuntimeJobV2('d68n7qtbujdc73d1b3vg', 'sampler')>,
<RuntimeJobV2('d674nppv6o8c73d514fg', 'sampler')>,
<RuntimeJobV2('d61mt5bc4tus73fcf3ng', 'sampler')>,
<RuntimeJobV2('d61lhfqo8gvs73f15d30', 'sampler')>,
<RuntimeJobV2('d5vftt1mvbjc73acdgpg', 'sampler')>,
<RuntimeJobV2('d5k96nv853es738djj30', 'sampler')>,
<RuntimeJobV2('d5b1s2rht8fs73a66r80', 'sampler')>]
이 페이지가 도움이 되었습니까?
GitHub에서 버그, 오타를 보고하거나 컨텐츠를 요청하십시오.