-
Notifications
You must be signed in to change notification settings - Fork 0
jig formatted status #249
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
dulaj-me
wants to merge
20
commits into
next
Choose a base branch
from
dulaj/status_format
base: next
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
jig formatted status #249
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
c9c0459
Update README.md (#245)
blainekasten 18db2a4
Add from_checkpoint parameter to price estimation for FT Job creation…
artek0chumak 0b223ec
codegen metadata
stainless-app[bot] d3d93fa
codegen metadata
stainless-app[bot] 7aca353
codegen metadata
stainless-app[bot] 760ba8f
jig papercuts (#238)
technillogue 28478be
feat(jig): Format jig status
dulaj-me 72a4ff2
chore(jig): typing fix
dulaj-me 14fd298
chore(jig): minor improvements to status
dulaj-me d0815b9
fix(jig): status formatter use Typed models
dulaj-me 55ff7fc
fix(jig): reformat app status
dulaj-me c876bc2
fix(jig): wip: reformat config status
dulaj-me 2d37351
fix(jig): add env to config status
dulaj-me 70bb130
fix(jig): replica event status
dulaj-me e085836
fix(jig): remove unused age func
dulaj-me c93ccac
fix(jig): simplify and condense status message
dulaj-me c48ec70
fix(jig): only show 'ready since' for running replicas
dulaj-me 4676038
fix: fixed replica event grouping and image tag split
dulaj-me 0d8af90
fix: Fix minor status errors
dulaj-me 7aee2bd
fix(jig): show replica_id instead of revision_id for replica events i…
dulaj-me File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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-dc45695614158674dec4da8ae843a7564905f24d2ce577e8e6e5246b4a7b0f61.yml | ||
| openapi_spec_hash: 46a91a84c8c270792676ee863b33ab99 | ||
| openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/togetherai%2Ftogetherai-0a89dd805ebaafb8dc12eea07c619a7a3a5a43b6bfbaa1db0ab460e6fed78978.yml | ||
| openapi_spec_hash: 1d8e045152a2f975af4db4a1dbadb7c3 | ||
| config_hash: 67b76d1064bef2e591cadf50de08ad19 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(deployment: Deployment) -> str: | ||
| """Format deployment status for CLI display""" | ||
| status = ( | ||
| "App:\n" | ||
| f" {'Name':<8}: {deployment.name} ┃ ID: {deployment.id}\n" | ||
| f" {'Image':<8}: {deployment.image}\n" | ||
| f" {'Status':<8}: {deployment.status}\n" | ||
| f" Created : {_format_timestamp(deployment.created_at)}" | ||
| f" ┃ Updated : {_format_timestamp(deployment.updated_at)}\n" | ||
| ) | ||
|
|
||
| if deployment.autoscaling: | ||
| autoscaling_status = f"\n Autoscaling: {deployment.autoscaling.get('profile', 'N/A')} {deployment.autoscaling.get('targetValue', 'N/A')}(target)\n" | ||
| status += autoscaling_status | ||
|
|
||
| replica_status = ( | ||
| "\n" | ||
| f" Replicas:\n" | ||
| f" {'Min/Max':<16}: {deployment.min_replicas}/{deployment.max_replicas}\n" | ||
| f" {'Ready/Desired':<16}: {deployment.ready_replicas}/{deployment.desired_replicas}\n" | ||
| ) | ||
|
|
||
| status += replica_status | ||
|
|
||
| config_status = ( | ||
| f"\nConfiguration:\n" | ||
| f" Port: {deployment.port}\n" | ||
| f" Command: {deployment.command}\n" | ||
| f" Args: {deployment.args}\n" | ||
| f" Health Check Path: {deployment.health_check_path}\n" | ||
| f" Resources: {deployment.cpu} core CPU ┃ {deployment.memory}GB Memory ┃ {deployment.storage}GB Storage \n" | ||
| ) | ||
|
|
||
| if deployment.gpu_count and deployment.gpu_type: | ||
| config_status += f" GPU: {deployment.gpu_count}x {deployment.gpu_type}\n" | ||
|
|
||
| if deployment.volumes: | ||
| config_status += f"\n Volumes:\n {'NAME':<28} MOUNT_PATH\n" | ||
| for vol in deployment.volumes: | ||
| config_status += f" {vol.name:<28} {vol.mount_path}\n" | ||
|
|
||
| if deployment.environment_variables: | ||
| secrets = [env for env in deployment.environment_variables if env.value_from_secret] | ||
| env_vars = [env for env in deployment.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 deployment.replica_events: | ||
| events_status = "\nReplica Events:\n" | ||
| images = set(map(lambda x: x.image or "-", deployment.replica_events.values())) | ||
| images = reversed(sorted(images)) | ||
|
|
||
| for image in images: | ||
| events = filter(lambda x: ((x[1].image or "-") == image), deployment.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 |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing f-string prefix on tip string literals
Medium Severity
The
tipassignments in the non-pyprojectelsebranch are plain strings, not f-strings."update \name` in {path}"and"rename your folder or add `name` to {path}"will include the literal text{path}instead of the actual file path. Compare with the pyproject branch which correctly hardcodes the path. This surfaces in the user-facing error message"Deployment name must be unique. Tip: ..."`.