Skip to content
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

Add log support for dedicated deployment #335

Merged
merged 8 commits into from
Oct 30, 2024

Conversation

PacificDou
Copy link
Contributor

@PacificDou PacificDou commented Oct 21, 2024

Description

Add log support for dedicated deployment.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How has this change been tested, please provide a testcase or example of how you tested the change?

Tested locally.

Any specific deployment considerations

For example, documentation changes, usability, usage/costs, secrets, etc.

Docs

  • Docs updated? What were the changes:

Copy link
Contributor

@bigbitbus bigbitbus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a couple of comments.

if log["insert_id"] in log_ids:
continue
log_ids.add(log["insert_id"])
print(f'[{datetime.fromisoformat(log["timestamp"]).strftime("%Y-%m-%d %H:%M:%S.%f")}] {log["payload"]}')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what form is the log["payload"]? Is it always plaintext or can it be json too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it can be either text or json, but in our inference server, it only generate texts (no structured log, because it's not tied to any cloud provider)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confirmed that the f string support dict (json) as well

status_code, msg = deploymentapi.get_deployment_log(api_key, args.deployment_name, from_timestamp, to_timestamp)
if status_code != 200:
print(f"{status_code}: {msg}")
return
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should return a non-zero exit to the cli command when there is an error, this is useful in using the command in a script.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea!

deployment_log_parser.add_argument(
"-d", "--duration", help="duration of log (from now) in seconds", type=int, default=3600
)
deployment_log_parser.add_argument("-f", "--follow", help="follow log output", action="store_true")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth having a flag to show the last n lines of the log?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea! Added

@PacificDou PacificDou requested a review from bigbitbus October 30, 2024 14:58
Copy link
Contributor

@bigbitbus bigbitbus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@PacificDou PacificDou merged commit 0d6b37d into main Oct 30, 2024
8 checks passed
@PacificDou PacificDou deleted the dedicated-deployment-add-log branch October 30, 2024 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants