Skip to content

Conversation

tchaton
Copy link
Contributor

@tchaton tchaton commented Aug 12, 2022

What does this PR do?

This PR introduces logic to connect to an application. The connect, disconnect acts as a context manager and makes the App Commands available.

Here is the user flow:

(.venv) ➜  lightning --help
Usage: lightning [OPTIONS] COMMAND [ARGS]...

Options:
  --version  Show the version and exit.
  --help     Show this message and exit.

Commands:
  connect     Connect to a Lightning Application.
  create      Create Lightning AI self-managed resources (clusters, etc…)
  delete      Delete Lightning AI self-managed resources (clusters, etc…)
  disconnect  Disconnect to a Lightning Application.
  init        Init a Lightning App and/or component.
  install     Install a Lightning App and/or component.
  list        List Lightning AI self-managed resources (clusters, etc…)
  login       Log in to your lightning.ai account.
  logout      Log out of your lightning.ai account.
  run         Run a Lightning application locally or on the cloud.
  show        Show given resource.
(.venv) ➜  lightning connect example
The Lightning App `example` provides a client interface (CLI). Do you want to proceed and install its CLI ? [y/N]: y
 
Storing `command_with_client` under /Users/thomas/.lightning/lightning_connection/commands/command_with_client.py
You can review all the downloaded commands under /Users/thomas/.lightning/lightning_connection/commands folder.
 
The client interface has been successfully installed. 
You can now run the following commands `lightning ['command_without_client', 'command_with_client', 'nested_command']`.
 
You are connected to the cloud Lightning App: example.
(.venv) ➜   lightning --help         
You are connected to the cloud Lightning App: example.
Usage: lightning [OPTIONS] COMMAND [ARGS]...

  --help     Show this message and exit.

Lightning App Commands
  nested_command         Description
  command_without_client Description
  command_with_client    Description
(.venv) ➜   lightning command_with_client --help
You are connected to the cloud Lightning App: example.
usage: command_with_client [-h] [--name NAME]

optional arguments:
  -h, --help   show this help message and exit
  --name NAME
(.venv) ➜  lightning command_with_client --name=hello
You are connected to the cloud Lightning App: example.
Your command execution was successful.
(.venv) ➜   lightning disconnect                      
You are disconnected to the cloud Lightning App: example
.
(.venv) ➜   lightning disconnect
You aren't connected to any Lightning App. Please, use `lightning connect app_name_or_id` to connect to one.
(.venv) ➜  lightning connect localhost
You are connected to the local Lightning App.

Fixes #<issue_number>

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

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

@github-actions github-actions bot added the app (removed) Generic label for Lightning App package label Aug 12, 2022
@tchaton tchaton assigned ethanwharris and unassigned hhsecond Aug 13, 2022
@tchaton tchaton mentioned this pull request Aug 30, 2022
12 tasks
@tchaton tchaton changed the base branch from master to add_missing_docs August 30, 2022 15:32
@tchaton tchaton added this to the app:0.6 milestone Aug 30, 2022
@tchaton tchaton marked this pull request as ready for review August 30, 2022 17:39
@mergify mergify bot added ready PRs ready to be merged and removed ready PRs ready to be merged labels Aug 31, 2022
@tchaton
Copy link
Contributor Author

tchaton commented Aug 31, 2022

Looks good, let’s make sure this work plays nicely with auth.
Basically users would have to first login on the CLI and then connect to an app via the id or url. The next time around, the connect file is still there but I am not authenticated, so we should make sure we communicate the user that we first need to log in.

Sounds great. I will add this when auth is ready on the infra side. Should be simple on the CLI side.

@tchaton tchaton requested a review from carmocca as a code owner August 31, 2022 10:21
@Borda Borda requested a review from lantiga August 31, 2022 19:13
@Borda
Copy link
Member

Borda commented Aug 31, 2022

Missing chlong entry, but let's do one more pass on fixing all other missing entries before release...

@Borda Borda merged commit 6e17191 into add_missing_docs Aug 31, 2022
@Borda Borda deleted the connect branch August 31, 2022 19:17
lexierule pushed a commit that referenced this pull request Aug 31, 2022
* update

* update

* update

* update

* Review of content

* Formatting updates

* Fomatting updates

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Updates based on new commits

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* update

* update

* update

* update

* Introduce lightning connect (#14183)


Co-authored-by: Luca Antiga <[email protected]>

Co-authored-by: Felonious-Spellfire <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Luca Antiga <[email protected]>
@mergify mergify bot added has conflicts and removed ready PRs ready to be merged labels Sep 2, 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 has conflicts
Projects
No open projects
Status: Done
Development

Successfully merging this pull request may close these issues.

7 participants