Skip to content

Commit

Permalink
[App] Simplify messaging in cloud dispatch (#16160)
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanwharris authored Dec 21, 2022
1 parent 1e16836 commit 9657671
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/lightning_app/runners/cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ def dispatch(
raise RuntimeError("The source upload url is empty.")

if getattr(lightning_app_release, "cluster_id", None):
logger.info(f"Running app on {lightning_app_release.cluster_id}")
print(f"Running app on {lightning_app_release.cluster_id}")

# Save the config for re-runs
app_config.save_to_dir(root)
Expand Down
7 changes: 1 addition & 6 deletions src/lightning_app/utilities/cloud.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import os
import warnings

from lightning_cloud.openapi import V1Membership

Expand All @@ -25,11 +24,7 @@ def _get_project(client: LightningClient, project_id: str = LIGHTNING_CLOUD_PROJ
if len(projects.memberships) == 0:
raise ValueError("No valid projects found. Please reach out to lightning.ai team to create a project")
if len(projects.memberships) > 1:
warnings.warn(
f"It is currently not supported to have multiple projects but "
f"found {len(projects.memberships)} projects."
f" Defaulting to the project {projects.memberships[0].name}"
)
print(f"Defaulting to the project: {projects.memberships[0].name}")
return projects.memberships[0]


Expand Down
5 changes: 2 additions & 3 deletions tests/tests_app/runners/test_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -1383,9 +1383,8 @@ def test_get_project(monkeypatch):
V1Membership(name="test-project2", project_id="test-project-id2"),
]
)
with pytest.warns(UserWarning, match="Defaulting to the project test-project1"):
ret = _get_project(mock_client)
assert ret.project_id == "test-project-id1"
ret = _get_project(mock_client)
assert ret.project_id == "test-project-id1"


def write_file_of_size(path, size):
Expand Down

0 comments on commit 9657671

Please sign in to comment.