# 코드 서빙 배포

이제 코드 서빙을 배포하고 커밋, 배포 정보를 어떻게 알 수 있는지 알아보겠습니다

### **1. 코드 서빙 상세 페이지 진입**

<figure><img src="/files/u7dGXXy8XrLTBi8IAVJn" alt=""><figcaption></figcaption></figure>

### **2. 배포 버튼 클릭**

<figure><img src="/files/OUz1RJ1Z8rShhSFu7xyl" alt=""><figcaption></figcaption></figure>

도커 이미지, 인스턴스 타입, GPU 할당량, 커밋 해시를 상황에 맞게 입력하시면 됩니다.

<figure><img src="/files/GeCOv7OvH8zzWOvLpPOZ" alt=""><figcaption></figcaption></figure>

설정 예시입니다. 작성을 완료하셨으면 생성을 누르면 됩니다.

### **3. 배포 신청 승인**

<figure><img src="/files/WXG3wuGL112JlBEfeL7T" alt=""><figcaption></figcaption></figure>

배포 신청을 누르면 이렇게 배포 신청 승인 대기 중 상태가 됩니다. 승인을 하기 위해서는 승인 권한을 가진 사용자가

메뉴에서 **승인 - 승인**으로 들어가시면

<figure><img src="/files/aVajF9swphK1yJz5Xg07" alt=""><figcaption></figcaption></figure>

이렇게 배포 승인을 하거나 반려를 할 수 있습니다.

### **4. 커밋 정보 확인**

배포한 이후에는 실수로 브랜치를 삭제하시더라도 커밋 정보를 확인할 수 있습니다.

코드 스페이스에서 다음과 같이 입력하면 됩니다.

#### a. 코드 서빙 정보 확인

```python
import requests, textwrap

# === 사용자가 바꿀 값 2개 ===
BEARER_TOKEN_RAW = """
{AccessToken값}
""" # AccessToken 값을 넣으면 됩니다.
CODE_ID = 7 # git 저장소 주소를 보시면 llmops/7 이런 식으로 숫자가 있는데 숫자를 넣으면 됩니다.

# 줄바꿈/공백 제거
BEARER_TOKEN = "".join(BEARER_TOKEN_RAW.split())

BASE = "http://llmops-admin-api-service.llmops.svc.cluster.local:8080/api/admin"
url = f"{BASE}/serving/code/{CODE_ID}"

headers = {"Accept": "application/json", "Authorization": f"Bearer {BEARER_TOKEN}"}
response = requests.get(url, headers=headers, timeout=15)

print("GET", url)
print("status:", response.status_code)
print(textwrap.shorten(response.text, width=2000, placeholder=" ..."))
```

**출력 예시**

<figure><img src="/files/DhI8BebW7ZuA051a8zfY" alt=""><figcaption></figcaption></figure>

코드 서빙 리소스와 기본 메타데이터를 조회할 수 있습니다.

#### b. 배포 정보 확인

```python
import requests, textwrap

# 토큰/대상 코드서빙 ID 설정
BEARER_TOKEN_RAW = """
{accessToken 값}
"""  # AccessToken 값을 넣으면 됩니다.
CODE_ID = 7 # git 저장소 주소를 보시면 llmops/7 이런 식으로 숫자가 있는데 숫자를 넣으면 됩니다.

BEARER_TOKEN = "".join(BEARER_TOKEN_RAW.split())

BASE = "http://llmops-admin-api-service.llmops.svc.cluster.local:8080/api/admin"
url = f"{BASE}/serving/code/{CODE_ID}/deployments"

headers = {"Accept": "application/json", "Authorization": f"Bearer {BEARER_TOKEN}"}
response = requests.get(url, headers=headers, timeout=15)

print("GET", url)
print("status:", response.status_code)
print(textwrap.shorten(response.text, width=2500, placeholder=" ..."))
```

**출력 예시**

<figure><img src="/files/MKo44EGAT3xl22E0pmSP" alt=""><figcaption></figcaption></figure>

배포 정보를 확인하실 수 있습니다.

#### c. 커밋 정보 확인

```python
import requests, textwrap

# 토큰/대상 코드서빙 ID 설정
BEARER_TOKEN_RAW = """
{accessToken }
"""  # AccessToken 값을 넣으면 됩니다.
CODE_ID = 7 # git 저장소 주소를 보시면 llmops/7 이런 식으로 숫자가 있는데 숫자를 넣으면 됩니다.

BEARER_TOKEN = "".join(BEARER_TOKEN_RAW.split())

BASE = "http://llmops-admin-api-service.llmops.svc.cluster.local:8080/api/admin"
url = f"{BASE}/serving/code/{CODE_ID}/commits"

headers = {"Accept": "application/json", "Authorization": f"Bearer {BEARER_TOKEN}"}

# ref=HEAD (기본). 페이지네이션도 가능: page, page_size
params = {"ref": "HEAD", "page": 1, "page_size": 10}

response = requests.get(url, headers=headers, params=params, timeout=15)

print("GET", url)
print("params:", params)
print("status:", response.status_code)
print(textwrap.shorten(response.text, width=2500, placeholder=" ..."))
```

**출력 예시**

<figure><img src="/files/vZZE5smvxOJcloB41QDE" alt=""><figcaption></figcaption></figure>

위 사진과 같이 커밋 정보를 확인할 수 있습니다.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://genos-docs.gitbook.io/default/v1.8.5/basic-tutorials/guides/development/code_serving/deploy_code_serving.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
