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 and carmocca committed Dec 22, 2022
1 parent 8b687e5 commit f2435f4
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
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
@@ -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
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 f2435f4

Please sign in to comment.