> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-dependabot-github-actions-actions-cache-6.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Run

export const GitHubLink = ({url}) => <a href={url} target="_blank" rel="noopener noreferrer" className="github-source-link">
    <svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
      <path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
    </svg>
    GitHub 소스 코드
  </a>;

<GitHubLink url="https://github.com/wandb/wandb/blob/main/wandb/apis/public/runs.py" />

## <kbd>class</kbd> `Run`

엔티티 및 프로젝트와 연관된 단일 run입니다.

### <kbd>방법</kbd> `Run.__init__`

```python theme={null}
__init__(
    service_api: 'ServiceApi',
    entity: 'str',
    project: 'str',
    run_id: 'str',
    attrs: 'Mapping | None' = None,
    include_sweeps: 'bool' = False,
    lazy: 'bool' = True,
    api_key: 'str | None' = None
)
```

**인수:**

* `service_api`:  이 run에 대해 W\&B API 호출을 수행하는 wandb-core 서비스 인터페이스입니다.
* `entity`:  run과 연결된 entity.
* `project`:  run과 연결된 프로젝트.
* `run_id`:  run의 고유 식별자.
* `attrs`:  run의 속성.
* `include_sweeps`:  run에 스윕을 포함할지 여부.

**속성:**

* `tags` (\[str]):  run과 연결된 태그 목록
* `url` (str):  이 run의 URL
* `id` (str):  run의 고유 식별자(기본값은 8자)
* `name` (str):  run의 이름
* `state` (str):  running, finished, crashed, killed, preempting, preempted 중 하나
* `config` (dict):  run과 연결된 하이퍼파라미터 딕셔너리
* `created_at` (str):  run이 시작된 시점의 ISO 타임스탬프
* `system_metrics` (dict):  run에 대해 기록된 최신 시스템 메트릭
* `summary` (dict):  현재 요약 정보를 보관하는 변경 가능한 dict 유사 속성입니다. update를 호출하면 모든 변경 사항이 영구 저장됩니다.
* `project` (str):  run과 연결된 프로젝트
* `entity` (str):  run과 연결된 entity의 이름
* `project_internal_id` (int):  프로젝트의 내부 ID
* `user` (str):  run을 생성한 사용자의 이름
* `path` (str):  고유 식별자 \[entity]/\[project]/\[run\_id]
* `notes` (str):  run에 대한 메모
* `read_only` (boolean):  run이 편집 가능한지 여부
* `history_keys` (str):  `wandb.Run.log({"key": "value"})`로 로깅된 이력 메트릭 키
* `metadata` (str):  wandb-metadata.json에서 가져온 run의 메타데이터

Run 객체를 초기화합니다.

Run은 항상 wandb.Api 인스턴스인 api에서 api.runs()를 호출하여 초기화됩니다.

***

### <kbd>property</kbd> Run.config

run 구성(config)을 가져옵니다. lazy 모드일 때 전체 데이터를 자동으로 불러옵니다.

**반환값:**

* `dict[str, Any]`: config 프로퍼티 값입니다.

***

### <kbd>property</kbd> Run.entity

run과 연관된 entity입니다.

**반환값:**

* `str`: entity 속성 값입니다.

***

### <kbd>property</kbd> Run.id

run의 고유 식별자입니다.

**반환값:**

* `str`: id 속성 값입니다.

***

### <kbd>property</kbd> Run.lastHistoryStep

run history에 기록된 마지막 step을 반환합니다.

**반환값:**

* `int`: lastHistoryStep 속성 값입니다.

***

### <kbd>property</kbd> Run.metadata

wandb-metadata.json에서 가져온 run에 대한 메타데이터입니다.

메타데이터에는 run의 설명, 태그, 시작 시간, 메모리 사용량 등 다양한 정보가 포함됩니다.

**반환값:**

* `dict[str, Any] | None`: metadata 프로퍼티 값입니다.

***

### <kbd>property</kbd> Run.name

run의 이름입니다.

**반환값:**

* `str | None`: name 속성의 값입니다.

***

### <kbd>property</kbd> Run.path

run의 경로를 나타냅니다. 이 경로는 entity, 프로젝트, run\_id로 구성된 리스트입니다.

**반환 값:**

* `list[str]`: path 프로퍼티 값입니다.

***

### <kbd>property</kbd> Run.rawconfig

내부 키를 포함하는 원시 run config를 반환합니다. lazy 모드인 경우 전체 데이터를 자동으로 로드합니다.

**반환값:**

* `dict[str, Any]`: rawconfig 프로퍼티 값입니다.

***

### <kbd>속성</kbd> Run.state

run의 상태입니다.

다음 표에서는 run이 가질 수 있는 상태를 설명합니다.

\| 상태    | 설명 | | -------- | ----------- | | Crashed  | 내부 process에서 run의 하트비트 전송이 중지된 상태입니다. 머신이 충돌한 경우 이런 일이 발생할 수 있습니다. | | Failed   | run이 0이 아닌 종료 상태 코드로 종료되었습니다. | | Finished | run이 종료되었고 데이터 동기화가 완전히 완료되었거나, `wandb.Run.finish()`가 호출되었습니다. | | Killed   | run이 완료되기 전에 강제로 중지되었습니다. | | Running  | run이 아직 실행 중이며 최근에 하트비트를 전송했습니다. | | Pending  | run이 예약되었지만 아직 시작되지 않았습니다(스윕 및 Launch 작업에서 일반적임). |

**반환값:**

* `str`: 상태 속성 값입니다.

***

### <kbd>property</kbd> Run.storage\_id

run의 고유 스토리지 식별자입니다.

**반환값:**

* `str`: storage\_id 속성 값입니다.

***

### <kbd>property</kbd> Run.summary

run의 요약 메트릭을 가져옵니다. lazy 모드인 경우 전체 데이터를 자동으로 로드합니다.

**반환값:**

* `HTTPSummary`: summary 프로퍼티의 값.

***

### <kbd>property</kbd> Run.summary\_metrics

run의 요약 메트릭을 가져옵니다. lazy 모드일 경우 전체 데이터를 자동으로 로드합니다.

**반환값:**

* `dict[str, Any]`: summary\_metrics 속성 값입니다.

***

### <kbd>속성</kbd> Run.sweep

이 run에 연결된 스윕입니다. include\_sweeps가 False로 설정된 경우 스윕 데이터를 로드합니다.

**반환값:**

* `public.Sweep | None`: 스윕 속성의 값입니다.

***

### <kbd>property</kbd> Run.sweep\_name

스윕 이름을 가져옵니다. `sweepName`은 lightweight fragment에 포함되어 있기 때문에 항상 사용할 수 있습니다.

**반환값:**

* `str | None`: `sweep_name` 속성 값.

***

### <kbd>property</kbd> Run.system\_metrics

run의 시스템 메트릭을 가져옵니다. lazy 모드인 경우 전체 데이터를 자동으로 로드합니다.

**반환값:**

* `dict[str, Any]`: system\_metrics 프로퍼티 값입니다.

***

### <kbd>property</kbd> Run.url

run의 URL입니다.

run URL은 entity, 프로젝트, 그리고 run\_id로부터 생성됩니다. SaaS 사용자의 경우 `https://wandb.ai/entity/project/run_id` 형식입니다.

**반환값:**

* `str`: URL 속성 값입니다.

***

### <kbd>property</kbd> Run.username

이 API는 더 이상 사용되지 않습니다. 대신 `entity`를 사용하세요.

**반환값:**

* `str`: username 속성 값입니다.

***

### <kbd>방법</kbd> `Run.beta_scan_history`

```python theme={null}
beta_scan_history(
    keys: 'list[str] | None' = None,
    page_size: 'int' = 1000,
    min_step: 'int' = 0,
    max_step: 'int | None' = None,
    use_cache: 'bool' = True
) → public.HistoryScan
```

***

### <kbd>classmethod</kbd> `Run.create`

```python theme={null}
create(
    api: 'public.Api',
    run_id: 'str | None' = None,
    project: 'str | None' = None,
    entity: 'str | None' = None,
    state: "Literal['running', 'pending']" = 'running'
) → Self
```

지정된 프로젝트에 대한 run을 생성합니다.

대부분의 경우에는 `wandb.init()`을 사용하십시오. `wandb.init()`은 run을 생성하고 업데이트하기 위한 더 견고한 로직을 제공합니다. `wandb.apis.public.Run.create`는 스케줄링되지 않을 수 있는 잡(예: GPU가 부족하거나 경쟁이 심한 Kubernetes 클러스터의 잡)에 대해 "pending" 상태의 run을 생성하는 등의 특정 시나리오를 위해 설계되었습니다. 이렇게 생성된 pending run은 나중에 재개하여 W\&B로 추적할 수 있습니다.

이 메서드로 생성된 run은 기능이 제한적입니다. 이렇게 생성된 run에서 `update()`를 호출하면 예상과 다르게 동작할 수 있습니다.

**Args:**

* `api`:  W\&B API 인스턴스.
* `run_id`:  선택적 run ID. 제공하지 않으면 무작위 ID가 생성됩니다.
* `project`:  선택적 프로젝트 이름. API 설정의 프로젝트 또는 "uncategorized"가 기본값입니다.
* `entity`:  선택적 엔티티(사용자 또는 팀) 이름.
* `state`:  run의 초기 상태. 나중에 재개할 run에는 "pending"을, 즉시 실행할 run에는 "running"을 사용하십시오.

**Returns:**
생성된 run을 나타내는 Run 객체.

**Example:**
나중에 실행하기 위한 pending run 생성

```python theme={null}
import wandb

api = wandb.Api()

run_name = "my-pending-run"

run = Run.create(
    api=api,
    project="project",
    entity="entity",
    state="pending",
    run_id=run_name,
)
```

***

### <kbd>메서드</kbd> `Run.delete`

```python theme={null}
delete(delete_artifacts: 'bool' = False) → None
```

wandb 백엔드에서 지정된 run을 삭제합니다.

**인수:**

* `delete_artifacts` (bool, optional): run과 연결된 아티팩트를 삭제할지 여부입니다.

***

### <kbd>메서드</kbd> `Run.download_history_exports`

```python theme={null}
download_history_exports(
    download_dir: 'pathlib.Path | str',
    require_complete_history: 'bool' = True
) → runhistory.DownloadHistoryResult
```

run에 대한 모든 parquet 형식의 히스토리 파일을 지정한 디렉터리로 다운로드합니다.

**Args:**

* `download_dir`:  히스토리 파일을 다운로드할 디렉터리입니다.
* `require_complete_history`:  전체 히스토리가 모두 다운로드되어야 하는지 여부입니다. true인 경우, run에 아직 parquet 파일로 내보내지 않은 데이터가 포함되어 있으면 IncompleteRunHistoryError가 발생합니다.

**Returns:**
DownloadHistoryResult를 반환합니다.

**Raises:**

* `IncompleteRunHistoryError`:  `require_complete_history`가 True이고 run에 아직 parquet 파일로 내보내지 않은 데이터가 포함되어 있는 경우 발생합니다.
* `WandbApiFailedError`:  히스토리가 완전하지 않은 경우 이외의 이유로 API 요청이 실패한 경우 발생합니다.

***

### <kbd>메서드</kbd> `Run.file`

```python theme={null}
file(name: 'str') → public.File
```

아티팩트에서 지정한 이름을 가진 파일의 경로를 반환합니다.

**Args:**

* `name` (str): 요청한 파일의 이름입니다.

**Returns:**
`name` 인자와 이름이 일치하는 `File`입니다.

***

### <kbd>메서드</kbd> `Run.files`

```python theme={null}
files(
    names: 'list[str] | None' = None,
    pattern: 'str | None' = None,
    per_page: 'int' = 50
) → public.Files
```

지정된 조건과 일치하는 run 내 모든 파일에 대한 `Files` 객체를 반환합니다.

정확히 일치시킬 파일 이름 목록을 지정하거나, 매칭에 사용할 패턴을 지정할 수 있습니다. 둘 다 제공된 경우 패턴은 무시됩니다.

**인자(Args):**

* `names` (list):  요청된 파일의 이름 목록입니다. 비어 있으면 모든 파일을 반환합니다.
* `pattern` (str, optional):  W\&B에서 파일을 반환할 때 사용할 패턴입니다. 이 패턴은 mySQL의 LIKE 구문을 사용하므로, .json으로 끝나는 모든 파일을 매칭하려면 "%.json"을 사용합니다. `names`와 `pattern`이 모두 제공되면 ValueError가 발생합니다.
* `per_page` (int):  페이지당 결과 개수입니다.

**반환값(Returns):**
`File` 객체들에 대한 이터레이터인 `Files` 객체를 반환합니다.

***

### <kbd>메서드</kbd> `Run.history`

```python theme={null}
history(
    samples: 'int' = 500,
    keys: 'list[str] | None' = None,
    x_axis: 'str' = '_step',
    pandas: 'bool' = True,
    stream: "Literal['default', 'system']" = 'default'
) → list[dict[str, Any]] | pd.DataFrame
```

run에 대해 샘플링된 히스토리 메트릭을 반환합니다.

히스토리 레코드가 샘플링되는 것이 괜찮다면, 이 방식이 더 단순하고 빠릅니다.

**Args:**

* `samples `:  (int, optional) 반환할 샘플 개수
* `pandas `:  (bool, optional) pandas DataFrame을 반환할지 여부
* `keys `:  (list, optional) 지정한 키에 대한 메트릭만 반환
* `x_axis `:  (str, optional) 이 메트릭을 x축으로 사용합니다. 기본값은 \_step입니다.
* `stream `:  (str, optional) 메트릭의 경우 "default", 머신 메트릭의 경우 "system"

**Returns:**

* `pandas.DataFrame`:  pandas=True이면 히스토리 메트릭의 `pandas.DataFrame`을 반환합니다.
* `list of dicts`:  pandas=False이면 히스토리 메트릭의 dict 목록(list)을 반환합니다.

***

### <kbd>메서드</kbd> `Run.load`

```python theme={null}
load(force: 'bool' = False) → dict[str, Any]
```

lazy 모드 설정에 따라 적절한 프래그먼트를 사용해 run 데이터를 로드합니다.

***

### <kbd>method</kbd> `Run.load_full_data`

```python theme={null}
load_full_data(force: 'bool' = False) → dict[str, Any]
```

config, systemMetrics, summaryMetrics 같은 대용량 필드를 포함해 전체 run 데이터를 로드합니다.

이 메서드는 처음에 run 목록을 조회할 때 `lazy=True`를 사용했지만, 특정 run에 대해 전체 데이터에 접근해야 하는 경우에 유용합니다.

**인자:**

* `force`:  데이터가 이미 로드된 경우에도 강제로 다시 로드할지 여부

**반환값:**
로드된 run 속성

***

### <kbd>method</kbd> `Run.log_artifact`

```python theme={null}
log_artifact(
    artifact: 'wandb.Artifact',
    aliases: 'Collection[str] | None' = None,
    tags: 'Collection[str] | None' = None
) → wandb.Artifact
```

run의 출력으로 사용할 아티팩트를 선언합니다.

**Args:**

* `artifact` (`Artifact`):  `wandb.Api().artifact(name)`에서 반환된 아티팩트입니다.
* `aliases` (list, optional):  이 아티팩트에 적용할 별칭 목록입니다.
* `tags`:  (list, optional) 이 아티팩트에 적용할 태그 목록입니다(있는 경우).

**Returns:**
`Artifact` 객체입니다.

***

### <kbd>메서드</kbd> `Run.logged_artifacts`

```python theme={null}
logged_artifacts(per_page: 'int' = 100) → public.RunArtifacts
```

이 run에서 로깅된 모든 아티팩트를 가져옵니다.

run 동안 출력으로 로깅된 모든 아티팩트를 가져옵니다. 페이지네이션된 결과를 반환하며, 이 결과는 순회하거나 하나의 리스트로 모을 수 있습니다.

**Args:**

* `per_page`:  API 요청당 가져올 아티팩트 개수.

**Returns:**
이 run 동안 출력으로 로깅된 모든 Artifact 객체에 대한 이터러블 컬렉션.

**Example:**

```python theme={null}
import wandb
import tempfile

with tempfile.NamedTemporaryFile(mode="w", delete=False, suffix=".txt") as tmp:
    tmp.write("This is a test artifact")
    tmp_path = tmp.name
run = wandb.init(project="artifact-example")
artifact = wandb.Artifact("test_artifact", type="dataset")
artifact.add_file(tmp_path)
run.log_artifact(artifact)
run.finish()

api = wandb.Api()

finished_run = api.run(f"{run.entity}/{run.project}/{run.id}")

for logged_artifact in finished_run.logged_artifacts():
    print(logged_artifact.name)
```

***

### <kbd>메서드</kbd> `Run.save`

```python theme={null}
save() → None
```

run 객체의 변경 내용을 W\&B 백엔드에 반영합니다.

***

### <kbd>방법</kbd> `Run.scan_history`

```python theme={null}
scan_history(
    keys: 'list[str] | None' = None,
    page_size: 'int' = 1000,
    min_step: 'int' = 0,
    max_step: 'int | None' = None,
    use_cache: 'bool' = True
) → public.HistoryScan
```

run의 모든 이력 레코드를 담은 이터러블 컬렉션을 반환합니다.

**인수:**

* `keys`:  run의 이력에서 읽을 메트릭 목록입니다.  keys를 지정하지 않으면 모든 메트릭이 반환됩니다.
* `page_size`:  한 번에 읽을 이력 레코드 수입니다.
* `min_step`:  이력을 읽기 시작할 최소 step(포함)입니다.
* `max_step`:  이력을 읽을 최대 step(미포함)입니다.
* `use_cache`:  True로 설정하면 WANDB\_CACHE\_DIR에서 run 이력을 확인합니다.  캐시에서 run 이력을 찾을 수 없으면 서버에서 다운로드합니다.  False로 설정하면 매번 run 이력을 서버에서 다운로드합니다.

**반환값:**
HistoryScan object로, 이터레이터로 사용하여 이력 레코드를 가져올 수 있습니다.

***

### <kbd>method</kbd> `Run.to_html`

```python theme={null}
to_html(height: 'int' = 420, hidden: 'bool' = False) → str
```

이 run을 표시하는 iframe이 포함된 HTML을 생성합니다.

***

### <kbd>메서드</kbd> `Run.update`

```python theme={null}
update() → None
```

run 객체의 변경 내용을 wandb 백엔드에 저장합니다.

***

### <kbd>방법</kbd> `Run.update_state`

```python theme={null}
update_state(state: 'str') → bool
```

run의 상태를 업데이트합니다.

지원되는 전환:

* `running`, `failed`, `crashed` 또는 `preempted`에서 `pending`으로  (예: 종료되었거나 진행 중인 run을 다시 큐에 넣기 위해)
  * `pending` 또는 `running`에서 `failed`로  (예: 선점되었거나 손실된 run을 failed로 표시하기 위해)

스윕 Runs는 상태를 업데이트할 수 없습니다.

가능한 run 상태 목록은 `Run.state`를 참조하세요.

**인수:**

* `state`:  대상 run 상태입니다. `"pending"` 또는 `"failed"` 중 하나입니다.

**반환값:**
상태가 성공적으로 업데이트되면 `True`를 반환합니다.

**Raises:**

* `wandb.Error`:  요청한 상태 전환이 허용되지 않거나, 서버가 이 작업을 지원하지 않는 경우 발생합니다.

***

### <kbd>메서드</kbd> `Run.upload_file`

```python theme={null}
upload_file(path: 'str', root: 'str' = '.') → public.File
```

로컬 파일을 현재 run과 연결하여 W\&B에 업로드합니다.

**Args:**

* `path` (str):  업로드할 파일의 경로입니다. 절대 경로나 상대 경로 모두 사용할 수 있습니다.
* `root` (str):  파일을 저장할 때 기준이 되는 루트 경로입니다. 예를 들어, run 내에서 파일이 "my\_dir/file.txt"로 저장되기를 원하고 현재 디렉터리가 "my\_dir"이라면, root를 "../"로 설정하면 됩니다. 기본값은 현재 디렉터리(".")입니다.

**Returns:**
업로드된 파일을 나타내는 `File` 객체입니다.

***

### <kbd>method</kbd> `Run.use_artifact`

```python theme={null}
use_artifact(
    artifact: 'wandb.Artifact',
    use_as: 'str | None' = None
) → wandb.Artifact
```

run의 입력으로 사용할 아티팩트를 선언합니다.

**인자:**

* `artifact` (`Artifact`): `wandb.Api().artifact(name)`에서 반환된 아티팩트
* `use_as` (string, 선택 사항): 스크립트에서 아티팩트를 어떻게 사용하는지 식별하는 문자열입니다. 베타 기능인 wandb Launch의 아티팩트 스와핑 기능을 사용할 때 run에서 사용된 아티팩트를 쉽게 구분하는 데 사용됩니다.

**반환값:**
`Artifact` 객체.

***

### <kbd>메서드</kbd> `Run.used_artifacts`

```python theme={null}
used_artifacts(per_page: 'int' = 100) → public.RunArtifacts
```

이 run에서 명시적으로 사용된 아티팩트를 가져옵니다.

일반적으로 `run.use_artifact()`을 통해 run 동안 사용되었다고 명시적으로 선언된 입력 아티팩트만을 가져옵니다. 반복(iteration)하거나 단일 리스트로 수집할 수 있는 페이징된 결과를 반환합니다.

**Args:**

* `per_page`:  API 요청당 가져올 아티팩트 개수입니다.

**Returns:**
이 run에서 명시적으로 입력으로 사용된 Artifact 객체로 구성된 이터러블 컬렉션입니다.

**Example:**

```python theme={null}
import wandb

run = wandb.init(project="artifact-example")
run.use_artifact("test_artifact:latest")
run.finish()

api = wandb.Api()
finished_run = api.run(f"{run.entity}/{run.project}/{run.id}")
for used_artifact in finished_run.used_artifacts():
    print(used_artifact.name)
test_artifact
```

***

### <kbd>method</kbd> `Run.wait_until_finished`

```python theme={null}
wait_until_finished() → None
```

run이 완료될 때까지 해당 run의 상태를 확인합니다.
