> ## Documentation Index
> Fetch the complete documentation index at: https://docs.coreweave.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Run

export const GitHubLink = ({url, compact = false}) => <a href={url} target="_blank" rel="noopener noreferrer" className={compact ? "source-link" : "github-source-link"}>
    {compact ? "View source" : <>
    <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 source
      </>}
  </a>;

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

<h2 id="class-wandbapispublicrun">
  <Badge color="yellow" size="lg" shape="rounded">クラス</Badge> wandb.apis.public.Run
</h2>

entity と project に関連付けられた単一の run です。

```python theme={"system"}
(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)
```

<h2 id="args">
  引数
</h2>

<ResponseField name="service_api" type="ServiceApi">
  この run の W\&B API 呼び出しを実行する wandb-core サービスへのインターフェースです。
</ResponseField>

<ResponseField name="entity" type="str">
  run に関連付けられた entity です。
</ResponseField>

<ResponseField name="project" type="str">
  run に関連付けられた project です。
</ResponseField>

<ResponseField name="run_id" type="str">
  run の一意の ID です。
</ResponseField>

<ResponseField name="attrs" type="Mapping | None">
  run の属性です。
</ResponseField>

<ResponseField name="include_sweeps" type="bool">
  run に sweep を含めるかどうか。
</ResponseField>

<ResponseField name="lazy" type="bool">
  説明はありません。
</ResponseField>

<ResponseField name="api_key" type="str | None">
  説明はありません。
</ResponseField>

<h2 id="attributes">
  属性
</h2>

* `tags` (`[str]`): run に関連付けられたタグのリスト
* `url` (`str`): この run の URL
* `id` (`str`): run の一意の ID (デフォルトは 8 文字)
* `name` (`str`): run 名
* `state` (`str`): running、finished、crashed、killed、preempting、preempted のいずれか
* `config` (`dict`): run に関連付けられたハイパーパラメーターの dict
* `created_at` (`str`): run の開始時刻を示す ISO タイムスタンプ
* `system_metrics` (`dict`): run で記録された最新のシステムメトリクス
* `summary` (`dict`): 現在のサマリーを保持する、変更可能な dict 形式のプロパティ。update を呼び出すと、変更内容が保存されます。
* `project` (`str`): run に関連付けられた project
* `entity` (`str`): run に関連付けられた entity の名前
* `project_internal_id` (`int`): project の内部 ID
* `user` (`str`): run を作成したユーザーの名前
* `path` (`str`): 一意の ID \[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 のメタデータ

<h2 id="properties">
  プロパティ
</h2>

<ResponseField name="config" type="dict[str, Any]">
  run 設定を取得します。遅延モードの場合は、完全なデータを自動的に読み込みます。
</ResponseField>

<ResponseField name="entity" type="str">
  run に関連付けられた entity。
</ResponseField>

<ResponseField name="id" type="str">
  run の一意の ID。
</ResponseField>

<ResponseField name="lastHistoryStep" type="int">
  run の履歴に最後にログされたステップを返します。
</ResponseField>

<ResponseField name="metadata" type="dict[str, Any] | None">
  wandb-metadata.json から取得した run のメタデータ。

  メタデータには、run の説明、タグ、開始時刻、メモリ
  使用量などが含まれます。
</ResponseField>

<ResponseField name="name" type="str | None">
  run の名前。
</ResponseField>

<ResponseField name="path" type="list[str]">
  run のパス。entity、project、run\_id を要素とするリストです。
</ResponseField>

<ResponseField name="rawconfig" type="dict[str, Any]">
  内部キーを含む未加工の run 設定を取得します。遅延モードの場合は、完全なデータを自動的に読み込みます。
</ResponseField>

<ResponseField name="state" type="str">
  run の状態。

  次の表に、run が取りうる状態を示します。

  | 状態 | 説明 |
  | - | - |
  | Crashed | 内部プロセスで run からのハートビートが途絶えた状態です。マシンがクラッシュした場合などに発生します。 |
  | Failed | run がゼロ以外の終了ステータスで終了しました。 |
  | Finished | run が終了してデータの同期が完了したか、`wandb.Run.finish()` が呼び出されました。 |
  | Killed | run が完了する前に強制停止されました。 |
  | Running | run は実行中で、直近にハートビートを送信しています。 |
  | Pending | run はスケジュール済みですが、まだ開始されていません (sweep や Launch job でよく見られます)。 |
</ResponseField>

<ResponseField name="storage_id" type="str">
  run の一意のストレージ ID。
</ResponseField>

<ResponseField name="summary" type="HTTPSummary">
  run のサマリー メトリクスを取得します。遅延モードの場合は、完全なデータを自動的に読み込みます。
</ResponseField>

<ResponseField name="summary_metrics" type="dict[str, Any]">
  run のサマリー メトリクスを取得します。遅延モードの場合は、完全なデータを自動的に読み込みます。
</ResponseField>

<ResponseField name="sweep" type="public.Sweep | None">
  この run に関連付けられた sweep。include\_sweeps が False の場合は sweep データを読み込みます。
</ResponseField>

<ResponseField name="sweep_name" type="str | None">
  sweep 名を取得します。sweepName は軽量フラグメントに含まれているため、常に取得できます。
</ResponseField>

<ResponseField name="system_metrics" type="dict[str, Any]">
  run のシステムメトリクスを取得します。遅延モードの場合は、完全なデータを自動的に読み込みます。
</ResponseField>

<ResponseField name="url" type="str">
  run の URL。

  run の URL は entity、project、run\_id から生成されます。
  SaaS ユーザーの場合、`https://wandb.ai/entity/project/run_id` の形式になります。
</ResponseField>

<ResponseField name="username" type="str">
  この API は非推奨です。代わりに `entity` を使用してください。
</ResponseField>

<h2 id="methods">
  メソッド
</h2>

<h3 id="method-runbeta_scan_history">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.beta\_scan\_history()
</h3>

```python theme={"system"}
self,
keys: 'list[str] | None' = None,
page_size: 'int' = 1000,
min_step: 'int' = 0,
max_step: 'int | None' = None,
use_cache: 'bool' = True
```

<h5 id="arguments">
  引数
</h5>

<ResponseField name="keys" type="list[str] | None">
  説明はありません。
</ResponseField>

<ResponseField name="page_size" type="int">
  説明はありません。
</ResponseField>

<ResponseField name="min_step" type="int">
  説明はありません。
</ResponseField>

<ResponseField name="max_step" type="int | None">
  説明はありません。
</ResponseField>

<ResponseField name="use_cache" type="bool">
  説明はありません。
</ResponseField>

<h3 id="method-runconsole_logs">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.console\_logs()
</h3>

```python theme={"system"}
self, *,
per_page: 'int' = 1000,
last: 'int | None' = None
```

run で取得されたコンソール出力を返します。

run の実行中、W\&B はそのプロセスが
stdout と stderr に書き込んだ内容を取得し、run のコンソールログとして記録します。これは
W\&B App の run ページにある「Logs」タブに表示されるログと同じものです。
このメソッドは、終了した run と実行中の run の
どちらについても、そのログを読み取ります。

<h5 id="arguments-2">
  引数
</h5>

<ResponseField name="per_page" type="int">
  ログを先頭から読み込む際に、1 回のリクエストで取得する行数です。`last` を指定した場合は無視されます。
</ResponseField>

<ResponseField name="last" type="int | None">
  設定すると、ログの末尾 N 行のみを 1 回のリクエストで取得します。実行中の run の状況確認やクラッシュの原因調査に便利です。1 回のリクエストで返される行数にはバックエンド側で上限が設けられているため、上限を超える行数を指定した場合は、最新の行のみに切り詰めて返されます。
</ResponseField>

<h5 id="raises">
  送出される例外
</h5>

* `CommError`: イテレーション中にリクエストが失敗した場合。ログを先頭から読み取るには W\&B サーバー 0.77 以降が必要です。それより古いサーバーでは、代わりに末尾の N 行を読み取ってください。

<h5 id="examples">
  サンプル
</h5>

```python theme={"system"}
import wandb

run = wandb.Api().run("entity/project/run_id")

# ログ全体を古い行から順に読み取ります。
for line in run.console_logs():
    print(line.content)

# 末尾の 100 行のみを読み取ります。
for line in run.console_logs(last=100):
    print(line.timestamp, line.content)
```

<h3 id="method-runcreate">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.create()
</h3>

```python theme={"system"}
api: 'public.Api',
run_id: 'str | None' = None,
project: 'str | None' = None,
entity: 'str | None' = None,
state: "Literal['running', 'pending']" = 'running'
```

指定された project に run を作成します。

ほとんどのユースケースでは、`wandb.init()` を使用してください。`wandb.init()` は、run の作成と更新に関してより堅牢な
ロジックを備えています。`wandb.apis.public.Run.create`
は、スケジュールできない可能性のあるジョブ向けに
"pending" 状態の run を作成するといった、特定のシナリオでの使用を想定しています
(たとえば、GPU が不足している Kubernetes クラスターや、リソースの競合が激しい Kubernetes
クラスターの場合など) 。こうした pending 状態の run は、後から再開して W\&B で追跡できます。

このメソッドで作成した run は、機能が制限されています。この方法で作成した run に対して
`update()` を呼び出すと、想定どおりに動作しない場合があります。

<h5 id="arguments-3">
  引数
</h5>

<ResponseField name="api" type="public.Api">
  W\&B API インスタンス。
</ResponseField>

<ResponseField name="run_id" type="str | None">
  run ID (オプション) 。指定しない場合は、ランダムな ID が生成されます。
</ResponseField>

<ResponseField name="project" type="str | None">
  プロジェクト名 (オプション) 。デフォルトは API 設定で指定された project、または "uncategorized" です。
</ResponseField>

<ResponseField name="entity" type="str | None">
  entity (ユーザーまたはチーム) 名 (オプション) 。
</ResponseField>

<ResponseField name="state" type="Literal['running', 'pending']">
  run の初期状態。後で再開する run の場合は "pending" を、すぐに実行する場合は "running" を使用します。
</ResponseField>

<h5 id="examples-2">
  サンプル
</h5>

後で実行する保留中の run を作成する

```python theme={"system"}
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,
)
```

<h3 id="method-rundelete">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.delete()
</h3>

```python theme={"system"}
self,
delete_artifacts: 'bool' = False
```

指定された run を wandb バックエンドから削除します。

<h5 id="arguments-4">
  引数
</h5>

<ResponseField name="delete_artifacts" type="bool">
  run に関連付けられたアーティファクトを削除するかどうか。
</ResponseField>

<h3 id="method-rundownload_history_exports">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.download\_history\_exports()
</h3>

```python theme={"system"}
self,
download_dir: 'pathlib.Path | str',
require_complete_history: 'bool' = True
```

run の Parquet 形式の履歴ファイルを、指定されたディレクトリにすべてダウンロードします。

<h5 id="arguments-5">
  引数
</h5>

<ResponseField name="download_dir" type="pathlib.Path | str">
  履歴ファイルのダウンロード先ディレクトリ。
</ResponseField>

<ResponseField name="require_complete_history" type="bool">
  完全な履歴のダウンロードを必須にするかどうか。true の場合、まだ parquet ファイルにエクスポートされていないデータが run に含まれていると、IncompleteRunHistoryError が発生します。
</ResponseField>

<h5 id="raises-2">
  送出される例外
</h5>

* `IncompleteRunHistoryError`: require\_complete\_history が True で、run に parquet ファイルへ未エクスポートのデータが含まれている場合。
* `WandbApiFailedError`: 履歴の不完全以外の理由で API リクエストが失敗した場合。

<h3 id="method-runfile">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.file()
</h3>

```python theme={"system"}
self,
name: 'str'
```

アーティファクト内にある、指定した名前のファイルのパスを返します。

<h5 id="arguments-6">
  引数
</h5>

<ResponseField name="name" type="str">
  取得するファイルの名前。
</ResponseField>

<h3 id="method-runfiles">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.files()
</h3>

```python theme={"system"}
self,
names: 'list[str] | None' = None,
pattern: 'str | None' = None,
per_page: 'int' = 50
```

指定した条件に一致する run 内のすべてのファイルを含む `Files` オブジェクトを返します。

完全一致させるファイル名のリスト、または照合するパターンを指定できます。
両方を指定した場合、パターンは無視されます。

<h5 id="arguments-7">
  引数
</h5>

<ResponseField name="names" type="list[str] | None">
  リクエストするファイルの名前。空の場合はすべてのファイルを返します。
</ResponseField>

<ResponseField name="pattern" type="str | None">
  W\&B からファイルを返す際に照合するパターン。このパターンには mySQL の LIKE 構文を使用します。たとえば、.json で終わるすべてのファイルに一致させるには "%.json" と指定します。names と pattern の両方を指定すると、ValueError が発生します。
</ResponseField>

<ResponseField name="per_page" type="int">
  1 ページあたりの結果数。
</ResponseField>

<h3 id="method-runhistory">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.history()
</h3>

```python theme={"system"}
self,
samples: 'int' = 500,
keys: 'list[str] | None' = None,
x_axis: 'str' = '_step',
pandas: 'bool' = True,
stream: "Literal['default', 'system']" = 'default'
```

run のサンプリングされた履歴メトリクスを返します。

履歴レコードがサンプリングされていても問題なければ、こちらのほうがシンプルで高速です。

<h5 id="arguments-8">
  引数
</h5>

<ResponseField name="samples" type="int">
  (int, optional) 返すサンプル数
</ResponseField>

<ResponseField name="keys" type="list[str] | None">
  (list, optional) 指定したキーのメトリクスのみを返します
</ResponseField>

<ResponseField name="x_axis" type="str">
  (str, optional) x 軸として使用するメトリクス。デフォルトは \_step です
</ResponseField>

<ResponseField name="pandas" type="bool">
  (bool, optional) pandas データフレームを返します
</ResponseField>

<ResponseField name="stream" type="Literal['default', 'system']">
  (str, optional) メトリクスの場合は "default"、マシンメトリクスの場合は "system" を指定します
</ResponseField>

<h3 id="method-runload">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.load()
</h3>

```python theme={"system"}
self,
force: 'bool' = False
```

遅延モードに応じた適切なフラグメントを使用して、run のデータを読み込みます。

<h5 id="arguments-9">
  引数
</h5>

<ResponseField name="force" type="bool">
  True の場合、run のデータがすでに読み込まれていても、サーバーから再取得します。
</ResponseField>

<h5 id="raises-3">
  送出される例外
</h5>

* `RunNotFoundError`: run が見つからない場合、または run のデータを読み込めない場合。

<h3 id="method-runload_full_data">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.load\_full\_data()
</h3>

```python theme={"system"}
self,
force: 'bool' = False
```

config、systemMetrics、summaryMetrics などのサイズの大きいフィールドを含め、run の全データを読み込みます。

このメソッドは、run の一覧取得時に lazy=True を使用したものの、
特定の run については全データにアクセスする必要がある場合に便利です。

<h5 id="arguments-10">
  引数
</h5>

<ResponseField name="force" type="bool">
  データがすでに読み込まれている場合でも、強制的に再読み込みします。
</ResponseField>

<h3 id="method-runlog_artifact">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.log\_artifact()
</h3>

```python theme={"system"}
self,
artifact: 'wandb.Artifact',
aliases: 'Collection[str] | None' = None,
tags: 'Collection[str] | None' = None
```

アーティファクトを run の出力として宣言します。

<h5 id="arguments-11">
  引数
</h5>

<ResponseField name="artifact" type="wandb.Artifact">
  `wandb.Api().artifact(name)` から返されたアーティファクト。
</ResponseField>

<ResponseField name="aliases" type="Collection[str] | None">
  このアーティファクトに付与するエイリアス。
</ResponseField>

<ResponseField name="tags" type="Collection[str] | None">
  (list, optional) このアーティファクトに付与するタグ (ある場合)。
</ResponseField>

<h3 id="method-runlogged_artifacts">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.logged\_artifacts()
</h3>

```python theme={"system"}
self,
per_page: 'int' = 100
```

この run でログされたすべてのアーティファクトを取得します。

run 中にログされたすべての出力アーティファクトを取得します。
ページネーションされた結果を返します。この結果は反復処理することも、1 つのリストにまとめることもできます。

<h5 id="arguments-12">
  引数
</h5>

<ResponseField name="per_page" type="int">
  1 回の API リクエストで取得するアーティファクトの数。
</ResponseField>

<h5 id="examples-3">
  サンプル
</h5>

```python theme={"system"}
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)
```

<h3 id="method-runsave">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.save()
</h3>

```python theme={"system"}
self
```

Run オブジェクトへの変更を W\&B バックエンドに保存します。

<h3 id="method-runscan_history">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.scan\_history()
</h3>

```python theme={"system"}
self,
keys: 'list[str] | None' = None,
page_size: 'int' = 1000,
min_step: 'int' = 0,
max_step: 'int | None' = None,
use_cache: 'bool' = True
```

run のすべての履歴レコードを含むイテラブルなコレクションを返します。

<h5 id="arguments-13">
  引数
</h5>

<ResponseField name="keys" type="list[str] | None">
  run の履歴から読み取るメトリクスのリストです。スキャンでは、リクエストしたすべてのキーを含む行のみが返されます。キーごとにログされた ステップ が異なる場合は、キーごとに個別に呼び出すか、この引数を省略してください。キーを指定しない場合は、すべてのメトリクスが返されます。
</ResponseField>

<ResponseField name="page_size" type="int">
  一度に読み取る履歴レコードの数です。
</ResponseField>

<ResponseField name="min_step" type="int">
  履歴の読み取りを開始する最小の ステップ です (この値を含みます) 。
</ResponseField>

<ResponseField name="max_step" type="int | None">
  履歴の読み取りを終了する最大の ステップ です (この値は含みません) 。
</ResponseField>

<ResponseField name="use_cache" type="bool">
  True に設定すると、WANDB\_CACHE\_DIR 内に run の履歴があるかを確認します。キャッシュ内に run の履歴が見つからない場合は、サーバーからダウンロードされます。False に設定すると、run の履歴は毎回ダウンロードされます。
</ResponseField>

<h3 id="method-runstop">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.stop()
</h3>

```python theme={"system"}
self
```

この run の正常停止をリクエストします。

これにより、W\&B バックエンド上で run の停止フラグが設定されます。これは W\&B App UI の「Stop run」ボタンから送信されるものと同じシグナルです。run を実行しているプロセスは、定期的なハートビートを通じてこのフラグを検出し、
run を正常にシャットダウンします。そのため、リモートの run
(たとえば Kubernetes の Pod 上の run) の終了にも安全に使用できます。

停止処理は非同期で行われます。このメソッドは、run の終了時ではなく、バックエンドが
run にフラグを設定した時点で制御を返します。再度呼び出した場合や、
すでに実行中でない run に対して呼び出した場合は、何も起こりません。

<h5 id="raises-4">
  送出される例外
</h5>

* `wandb.Error`: リクエストが失敗した場合。

<h5 id="examples-4">
  サンプル
</h5>

```python theme={"system"}
import wandb

run = wandb.Api().run("entity/project/run_id")
run.stop()
```

<h3 id="method-runto_html">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.to\_html()
</h3>

```python theme={"system"}
self,
height: 'int' = 420,
hidden: 'bool' = False
```

この run を表示する iframe を含む HTML を生成します。

<h5 id="arguments-14">
  引数
</h5>

<ResponseField name="height" type="int">
  説明はありません。
</ResponseField>

<ResponseField name="hidden" type="bool">
  説明はありません。
</ResponseField>

<h3 id="method-runupdate">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.update()
</h3>

```python theme={"system"}
self
```

Run オブジェクトへの変更を wandb バックエンドに保存します。

<h3 id="method-runupdate_state">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.update\_state()
</h3>

```python theme={"system"}
self,
state: 'str'
```

run の状態を更新します。

サポートされる遷移:

* `running`、`failed`、`crashed`、`preempted` から `pending` へ
  (例: 終了した run や実行中の run をキューに入れ直す場合)
  * `pending` または `running` から `failed` へ
    (例: プリエンプトされた run や応答がなくなった run を失敗としてマークする場合)

sweep の run は状態を更新できません。

run が取り得る状態の一覧については、`Run.state` を参照してください。

<h5 id="arguments-15">
  引数
</h5>

<ResponseField name="state" type="str">
  変更先の run の状態。`"pending"` または `"failed"` のいずれかです。
</ResponseField>

<h5 id="raises-5">
  送出される例外
</h5>

* `wandb.Error`: 要求された状態遷移が許可されていない場合、またはサーバーがこの操作をサポートしていない場合。

<h3 id="method-runupload_file">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.upload\_file()
</h3>

```python theme={"system"}
self,
path: 'str',
root: 'str' = '.'
```

ローカルファイルを W\&B にアップロードし、この run に関連付けます。

<h5 id="arguments-16">
  引数
</h5>

<ResponseField name="path" type="str">
  アップロードするファイルのパス。絶対パスと相対パスのどちらでも指定できます。
</ResponseField>

<ResponseField name="root" type="str">
  ファイルを保存する際に基準とするルートパス。たとえば、現在 "my\_dir" にいて、ファイルを run 内に "my\_dir/file.txt" として保存したい場合は、root を "../" に設定します。デフォルトはカレントディレクトリ (".") です。
</ResponseField>

<h3 id="method-runuse_artifact">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.use\_artifact()
</h3>

```python theme={"system"}
self,
artifact: 'wandb.Artifact',
use_as: 'str | None' = None
```

アーティファクトを run の入力として宣言します。

<h5 id="arguments-17">
  引数
</h5>

<ResponseField name="artifact" type="wandb.Artifact">
  `wandb.Api().artifact(name)` から返されたアーティファクト
</ResponseField>

<ResponseField name="use_as" type="str | None">
  スクリプト内でのアーティファクトの使用方法を識別する string です。ベータ版の wandb Launch 機能が備えるアーティファクトの入れ替え機能を使用する際に、run で使用されるアーティファクトを簡単に区別するために使用します。
</ResponseField>

<h3 id="method-runused_artifacts">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.used\_artifacts()
</h3>

```python theme={"system"}
self,
per_page: 'int' = 100
```

この run で明示的に使用されたアーティファクトを取得します。

run 中に使用すると明示的に宣言された入力アーティファクトのみを取得します。宣言は通常、`run.use_artifact()` で行われます。ページネーションされた
結果を返します。この結果は反復処理することも、1 つのリストにまとめることもできます。

<h5 id="arguments-18">
  引数
</h5>

<ResponseField name="per_page" type="int">
  1 回の API リクエストで取得するアーティファクトの数。
</ResponseField>

<h5 id="examples-5">
  サンプル
</h5>

```python theme={"system"}
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
```

<h3 id="method-runwait_until_finished">
  <Badge color="blue" size="lg" shape="rounded">メソッド</Badge> Run.wait\_until\_finished()
</h3>

```python theme={"system"}
self
```

run が終了するまで、run の状態を確認します。
