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

[App] Application logs in CLI #13634

Merged
merged 28 commits into from
Aug 10, 2022
Merged

[App] Application logs in CLI #13634

merged 28 commits into from
Aug 10, 2022

Conversation

adam-lightning
Copy link
Contributor

@adam-lightning adam-lightning commented Jul 13, 2022

What does this PR do?

This PR adds CLI command lightning show logs <app_name> [<components>] that prints logs

Does your PR introduce any breaking changes? If yes, please list them.

We've extended the run_app_in_cloud context manager to return app_name as well. This is to enable easier testing, but might also affect other existing tests from different repositories.

Before submitting

  • Was this discussed/approved via a GitHub issue? (not for typos and docs)
  • Did you read the contributor guideline, Pull Request section?
  • Did you make sure your PR does only one thing, instead of bundling different changes together?
  • Did you make sure to update the documentation with your changes? (if necessary)
  • Did you write any new necessary tests? (not for typos and docs)
  • Did you verify new and existing tests pass locally with your changes?
  • Did you list all the breaking changes introduced by this pull request?
  • Did you update the CHANGELOG? (not for typos, docs, test updates, or minor internal changes/refactors)

PR review

Anyone in the community is welcome to review the PR.
Before you start reviewing, make sure you have read the review guidelines. In short, see the following bullet-list:

  • Is this pull request ready for review? (if not, please submit in draft mode)
  • Check that all items from Before submitting are resolved
  • Make sure the title is self-explanatory and the description concisely explains the PR
  • Add labels and milestones (and optionally projects) to the PR so it can be classified

Did you have fun?

Make sure you had fun coding 🙃

cc @Borda

@williamFalcon
Copy link
Contributor

is “show” the best command word here? @adam-lightning.
how will this generalize as the CLI evolves?

@adam-lightning
Copy link
Contributor Author

@williamFalcon The idea is that show would be for showing / displaying / printing all information about given resource(s).
Something like just saying "Show me logs of X", "show me something ...", "show me my application" etc.

Tho, for the future, I'd distinguish the "show" from "list" as one first one answers the question about the object's contents / details, and the other lists the objects we might want to interact with.

Or You mean something else by the CLI evolution ?

@williamFalcon
Copy link
Contributor

that makes sense. i'm just thinking about what else "show" will apply to other than logs

@manskx
Copy link
Contributor

manskx commented Jul 19, 2022

@adam-lightning We should add two things:

  • An issue/ticket to create update the docs
  • Update changelog

@adam-lightning
Copy link
Contributor Author

adam-lightning commented Jul 19, 2022

@adam-lightning We should add two things:

  • An issue/ticket to create update the docs
  • Update changelog

@manskx

  • Just create a ticket or also implement it before merging this PR ?
  • I haven't found changelog in the existing files. Should I create one?

@manskx
Copy link
Contributor

manskx commented Jul 19, 2022

@adam-lightning We should add two things:

  • An issue/ticket to create update the docs
  • Update changelog

@manskx

  • Just create a ticket or also implement it before merging this PR ?
  • I haven't found changelog in the existing files. Should I create one?

Would be nice to update the docs in the same PR :))) up to you

changelog is here: https://github.com/Lightning-AI/lightning/blob/35ec79ad1f75790767a6857637c9bbe052e47b58/src/lightning_app/CHANGELOG.md

@github-actions github-actions bot added the app (removed) Generic label for Lightning App package label Jul 26, 2022
@mergify mergify bot added the has conflicts label Aug 2, 2022
Copy link
Contributor

@tchaton tchaton left a comment

Choose a reason for hiding this comment

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

LGTM once the comments are addressed.

src/lightning_app/cli/lightning_cli.py Outdated Show resolved Hide resolved
src/lightning_app/cli/lightning_cli.py Show resolved Hide resolved
src/lightning_app/cli/lightning_cli.py Outdated Show resolved Hide resolved
src/lightning_app/cli/lightning_cli.py Outdated Show resolved Hide resolved
src/lightning_app/cli/lightning_cli.py Outdated Show resolved Hide resolved
src/lightning_app/cli/lightning_cli.py Outdated Show resolved Hide resolved
src/lightning_app/cli/lightning_cli.py Outdated Show resolved Hide resolved
src/lightning_app/utilities/app_logs.py Show resolved Hide resolved
@mergify mergify bot added ready PRs ready to be merged and removed has conflicts ready PRs ready to be merged labels Aug 5, 2022
@mergify mergify bot requested a review from a team August 5, 2022 07:31
Copy link
Contributor

@awaelchli awaelchli left a comment

Choose a reason for hiding this comment

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

I like "show". For a different product, we had a CLI redesign planned (now on ice) where "show" was supposed to show information about many different types resources. It also fits well for logs.

lightning show [what] [name or id]

src/lightning_app/cli/lightning_cli.py Outdated Show resolved Hide resolved
src/lightning_app/cli/lightning_cli.py Outdated Show resolved Hide resolved
src/lightning_app/cli/lightning_cli.py Outdated Show resolved Hide resolved
logs_api_client = _LightningLogsSocketAPI(client.api_client)

# We will use a socket per component
log_sockets = [
Copy link
Contributor

Choose a reason for hiding this comment

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

This probably works well for some apps, and is a good start. I just want to point out that an app doesn't need to have a constant amount of "components". These could come and go during runtime of the app. So if you "follow" the logs, that's probably useful to know.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, this is definitely a skateboard version and needs to be improved upon.

@Borda Borda added this to the app:0.6 milestone Aug 8, 2022
@tchaton tchaton enabled auto-merge (squash) August 10, 2022 09:13
@tchaton tchaton merged commit ddb476d into master Aug 10, 2022
@tchaton tchaton deleted the app-logs-in-cli branch August 10, 2022 09:48
jessecambon pushed a commit to jessecambon/lightning that referenced this pull request Aug 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app (removed) Generic label for Lightning App package ready PRs ready to be merged
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

6 participants