Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 74
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-af83378ff78b22014ab7358ae8aa060cc25e4b818e798f2e09d6deb1226e0ba6.yml
openapi_spec_hash: 113f84b407b43bd991ee6d1afb6efb49
config_hash: 67b76d1064bef2e591cadf50de08ad19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-5510a252ce4388d91d332de72ef93714d88e7882443156762a5901ba8b7394bd.yml
openapi_spec_hash: 33e21f8c6c05ad826601c74eadb4467f
config_hash: b66198d27b4d5c152688ff6cccfdeab5
9 changes: 1 addition & 8 deletions api.md
Original file line number Diff line number Diff line change
Expand Up @@ -158,14 +158,7 @@ Methods:
Types:

```python
from together.types import (
FileList,
FileObject,
FilePurpose,
FileResponse,
FileType,
FileDeleteResponse,
)
from together.types import FileList, FilePurpose, FileResponse, FileType, FileDeleteResponse
```

Methods:
Expand Down
2 changes: 1 addition & 1 deletion scripts/format
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ uv run ruff check --fix .
uv run ruff format

echo "==> Formatting docs"
uv run python scripts/utils/ruffen-docs.py README.md api.md
uv run python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md)
2 changes: 1 addition & 1 deletion src/together/lib/cli/api/beta/clusters/list_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def list_regions(ctx: click.Context, json: bool) -> None:
data.append(
{
"Name": region.name,
"Availability Zones": ", ".join(region.availability_zones) if region.availability_zones else "",
"Supported GPU Types": ", ".join(region.supported_instance_types) if region.supported_instance_types else "",
"Driver Versions": ", ".join(region.driver_versions) if region.driver_versions else "",
}
)
Expand Down
107 changes: 107 additions & 0 deletions src/together/lib/cli/api/beta/jig/_utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
"""Utility functions for jig CLI commands."""

from __future__ import annotations

from datetime import datetime

from together.types.beta.deployment import Deployment


def _format_timestamp(timestamp_str: str | None) -> str:
"""Format ISO timestamp for display"""
if not timestamp_str:
return "-"
try:
ts = datetime.fromisoformat(timestamp_str.replace("Z", "+00:00"))
return ts.strftime("%Y-%m-%d %H:%M:%S")
except (ValueError, TypeError):
return timestamp_str or "-"


def _image_tag(image: str | None) -> str:
if image is None:
return "unknown"
tag = image.rsplit(":", 1)[-1] if ":" in image else image
if "@sha256:" in image:
tag = f"sha256:{tag[:8]}"

return tag


def format_deployment_status(d: Deployment) -> str:
"""Format d status for CLI display"""
status = (
"App:\n"
f" {'Name':<8}: {d.name} ┃ ID: {d.id}\n"
f" {'Image':<8}: {d.image}\n"
f" {'Status':<8}: {d.status}\n"
f" Created : {_format_timestamp(d.created_at)}"
f" ┃ Updated : {_format_timestamp(d.updated_at)}\n"
)

if d.autoscaling:
autoscaling_status = (
f"\n Autoscaling: {d.autoscaling.get('metric', 'N/A')} {d.autoscaling.get('target', 'N/A')}(target)\n"
)
status += autoscaling_status

replica_status = (
"\n"
f" Replicas:\n"
f" {'Min/Max':<16}: {d.min_replicas}/{d.max_replicas}\n"
f" {'Ready/Desired':<16}: {d.ready_replicas}/{d.desired_replicas}\n"
)

status += replica_status

config_status = (
f"\nConfiguration:\n"
f" Port: {d.port}\n"
f" Command: {d.command}\n"
f" Args: {d.args}\n"
f" Health Check Path: {d.health_check_path}\n"
f" Resources: {d.cpu} core CPU ┃ {d.memory}GB Memory ┃ {d.storage}GB Storage \n"
)

if d.gpu_count and d.gpu_type:
config_status += f" GPU: {d.gpu_count}x {d.gpu_type}\n"

if d.volumes:
config_status += f"\n Volumes:\n {'NAME':<28} MOUNT_PATH\n"
for vol in d.volumes:
config_status += f" {vol.name:<28} {vol.mount_path}\n"

if d.environment_variables:
secrets = [env for env in d.environment_variables if env.value_from_secret]
env_vars = [env for env in d.environment_variables if not env.value_from_secret]

if secrets:
config_status += f"\n Secrets: {[secret.name for secret in secrets]}\n"

if env_vars:
config_status += f"\n Environment Variables:\n {'NAME':<40} VALUE\n"
for env in env_vars:
config_status += f" {env.name:<40} {env.value}\n"

status += config_status

if d.replica_events:
events_status = "\nReplica Events:\n"
images = set(map(lambda x: x.image or "-", d.replica_events.values()))
for image in reversed(sorted(images)):
events = filter(lambda x: ((x[1].image or "-") == image), d.replica_events.items())
events_status += f"{_image_tag(image)}:\n"
for replica_id, event in events:
events_status += f" {replica_id}: "

if event.volume_preload_status and not event.volume_preload_completed_at:
events_status += f"Volume Preloading"
else:
events_status += f"{event.replica_status}"
if event.replica_status == "Running":
events_status += f", ready since {_format_timestamp(event.replica_ready_since)}"
events_status += "\n"

status += events_status

return status
Loading