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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[App] Fix bug when preventing cross launch of apps #15370

Conversation

luca3rd
Copy link
Contributor

@luca3rd luca3rd commented Oct 27, 2022

What does this PR do?

Fixes bug introduced in #15226.

If you launch an app with lightning run app app.py --cloud, --cluster-id was not used so cluster_id is None. If the app has never ran before, and there are no BYOC clusters in the default project, the app will run on the global lightning cluster.

The bug occurs when launching the same app a second time using the same command. We checked to see if the cluster_id matches the cluster of the previous app instance (which was set by the platform to the global cluster). Essentially it was checking if None == 'lightning-cluster'.

This PR fixes the bug by setting cluster_id to the cluster of the previous instance, if it was not set by the user.

To run through some examples and desired behaviour:

Scenario 1

  1. lightning run app app.py --cloud -> creates the app on the global lightning cluster
  2. lightning run app app.py --cloud -> updates the app instance on the global cluster

Scenario 2

  1. lightning run app app.py --cloud --cluster-id my-cluster -> creates the app on 'my-cluster'
  2. lightning run app app.py --cloud -> updates the app instance on 'my-cluster'

Scenario 3

  1. lightning run app app.py --cloud --cluster-id my-cluster -> creates the app on 'my-cluster'
  2. lightning run app app.py --cloud --cluster-id some-other-cluster -> Error: we don't support 1 app on multiple clusters (yet). See PR description in Prevent bug when launching apps on multiple clusters聽#15226.

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 馃檭

@luca3rd luca3rd changed the title Fix bug when preventing cross launch of apps [App] Fix bug when preventing cross launch of apps Oct 27, 2022
@github-actions github-actions bot added the app Generic label for Lightning App package label Oct 27, 2022
@luca3rd luca3rd closed this Nov 2, 2022
@luca3rd luca3rd deleted the ENG-497-bug-cant-run-app-on-a-cluster-if-it-already-run-in-another branch November 2, 2022 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
app Generic label for Lightning App package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant