> ## 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.

# LaunchAgent

<Card title="소스 코드 보기" href="https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L164-L924" icon="code" />

지정된 run 큐를 폴링하고 wandb launch를 위해 run을 실행하는 Launch 에이전트 클래스입니다.

```python theme={"system"}
LaunchAgent(
    api: Api,
    config: Dict[str, Any]
)
```

| 인수 | 설명 |
| :- | :- |
| `api` | 백엔드에 요청을 보내는 데 사용할 API 객체입니다. |
| `config` | 에이전트의 설정 딕셔너리입니다. |

| 속성 | 설명 |
| :- | :- |
| `num_running_jobs` | 스케줄러를 제외한 작업 수를 반환합니다. |
| `num_running_schedulers` | 스케줄러 수만 반환합니다. |
| `thread_ids` | 에이전트에서 실행 중인 스레드 ID의 키 목록을 반환합니다. |

<h2 id="methods">
  메서드
</h2>

<h3 id="check_sweep_state">
  `check_sweep_state`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L786-L803)

```python theme={"system"}
check_sweep_state(
    launch_spec, api
)
```

스윕의 상태를 확인한 후 스윕에 대한 run을 시작하세요.

<h3 id="fail_run_queue_item">
  `fail_run_queue_item`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L295-L304)

```python theme={"system"}
fail_run_queue_item(
    run_queue_item_id, message, phase, files=None
)
```

<h3 id="finish_thread_id">
  `finish_thread_id`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L416-L509)

```python theme={"system"}
finish_thread_id(
    thread_id, exception=None
)
```

현재 목록에서 작업을 제거합니다.

<h3 id="get_job_and_queue">
  `get_job_and_queue`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L908-L915)

```python theme={"system"}
get_job_and_queue()
```

<h3 id="initialized">
  `initialized`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L190-L193)

```python theme={"system"}
@classmethod
initialized() -> bool
```

에이전트가 초기화되었는지 여부를 반환합니다.

<h3 id="loop">
  `loop`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L572-L653)

```python theme={"system"}
loop()
```

무한 반복하며 작업을 폴링하고 실행합니다.

| 예외 | 설명 |
| :- | :- |
| `KeyboardInterrupt` | 에이전트에 중지가 요청된 경우. |

<h3 id="name">
  `name`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L180-L188)

```python theme={"system"}
@classmethod
name() -> str
```

에이전트의 이름을 반환합니다.

<h3 id="pop_from_queue">
  `pop_from_queue`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L340-L363)

```python theme={"system"}
pop_from_queue(
    queue
)
```

run 큐에서 항목을 꺼내 작업으로 실행합니다.

| 인수 | 설명 |
| :- | :- |
| `queue` | 항목을 꺼낼 큐입니다. |

| 반환값 | 설명 |
| :- | :- |
| 큐에서 꺼낸 항목입니다. | |

| 예외 | 설명 |
| :- | :- |
| `Exception` | 큐에서 항목을 꺼내는 중 오류가 발생한 경우입니다. |

<h3 id="print_status">
  `print_status`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L365-L381)

```python theme={"system"}
print_status() -> None
```

에이전트의 현재 상태를 출력합니다.

<h3 id="run_job">
  `run_job`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L511-L541)

```python theme={"system"}
run_job(
    job, queue, file_saver
)
```

프로젝트를 설정하고 작업을 실행하세요.

| 인수 | 설명 |
| :- | :- |
| `job` | 실행할 작업. |

<h3 id="task_run_job">
  `task_run_job`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L656-L688)

```python theme={"system"}
task_run_job(
    launch_spec, job, default_config, api, job_tracker
)
```

<h3 id="update_status">
  `update_status`
</h3>

[소스 보기](https://www.github.com/wandb/wandb/tree/v0.20.1/wandb/sdk/launch/agent/agent.py#L383-L394)

```python theme={"system"}
update_status(
    status
)
```

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

| 인수 | 설명 |
| :- | :- |
| `status` | 에이전트를 업데이트할 상태입니다. |


## Related topics

- [Launch 용어 및 개념](/ko/products/wandb/platform/launch/launch-terminology.md)
