주 콘텐츠로 건너뛰기
이 프로젝트는 베타 단계입니다. 버그를 발견하셨나요? GitHub 이슈 만들기. 질문이나 아이디어가 있으신가요? Discussions에서 질문하기 — 피드백을 기다립니다!
이 페이지의 번역 품질은 어떻습니까?

Job 태그로 정리하고 검색하기

패키지 버전

이 페이지의 코드는 다음 요구 사항으로 개발했어요. 이 버전 이상을 사용하는 것을 권장해요.

qiskit[all]~=2.5.2
qiskit-ibm-runtime~=0.49.0

이 가이드는 Job 태그를 추가하고 업데이트하는 방법과 Job 태그로 검색하는 방법에 초점을 맞추어, 실험을 더 효과적으로 정리하고 추적하며 이해할 수 있도록 도와줘요.

태그 지정하기​

Job을 실행할 때 하나 이상의 태그를 지정하면 나중에 태그로 필터링할 수 있어요. Job 태그를 사용하여 특정 오류 완화 설정, Circuit 파라미터 등을 표시할 수 있어요.

# Added by doQumentation — installs the packages this notebook needs if they are missing
import importlib.util

_needed = {"qiskit": "qiskit", "qiskit_ibm_runtime": "qiskit-ibm-runtime"}
_missing = [pip for module, pip in _needed.items()
if importlib.util.find_spec(module) is None]
# One at a time, so a package that fails to install does not block the others
for _pip in _missing:
%pip install -q {_pip}
if not _missing:
print("\u2713 All required packages are installed")
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)
['experiment-2025', 'sampler-example']

태그 추가 및 업데이트하기​

update_tags() 메서드를 사용하면 Job을 제출한 후에도 태그를 추가할 수 있어요. 이 메서드는 현재 태그를 덮어쓰므로, 이미 Job에 태그를 지정한 상태에서 추가 태그를 더하려면 기존 태그도 함께 다시 지정해야 해요.

# 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)
['sampler-example', 'experiment-2025', '127-qubit']

태그로 Job 조회하기​

다음과 같이 특정 태그가 있는 Job 목록을 표시합니다:

# List jobs with a specific tag or set of tags

service.jobs(job_tags=["experiment-2025", "sampler-example"])
[<RuntimeJobV2('db87r36il99s73fpgl80', 'sampler')>,
<RuntimeJobV2('db21r4c7f06c73ap7jtg', 'sampler')>,
<RuntimeJobV2('dav0ijbg95ks73ej7ku0', 'sampler')>,
<RuntimeJobV2('dakf378mhr3c73ea4ljg', 'sampler')>,
<RuntimeJobV2('dab7ljj4clkc73fijsm0', 'sampler')>,
<RuntimeJobV2('da0147no3ppc73akuf3g', 'sampler')>,
<RuntimeJobV2('d9mqa2eh4e6s738viav0', 'sampler')>,
<RuntimeJobV2('d9bjj0mg26ic73dg2520', 'sampler')>,
<RuntimeJobV2('d92d08vccmks73d6j8ng', 'sampler')>,
<RuntimeJobV2('d8286jg0bvlc73d1vnhg', 'sampler')>]