[App] Fix bug when preventing cross launch of apps #15370
Closed
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.
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 socluster_id
isNone
. 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 ifNone == '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
lightning run app app.py --cloud
-> creates the app on the global lightning clusterlightning run app app.py --cloud
-> updates the app instance on the global clusterScenario 2
lightning run app app.py --cloud --cluster-id my-cluster
-> creates the app on 'my-cluster'lightning run app app.py --cloud
-> updates the app instance on 'my-cluster'Scenario 3
lightning run app app.py --cloud --cluster-id my-cluster
-> creates the app on 'my-cluster'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
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:
Did you have fun?
Make sure you had fun coding 馃檭