Skip to content

Commit d6b62da

Browse files
akihironittatchatonthomas
authored
[App] Wrap LightningClient methods with retry wrapper by default (#16382)
Co-authored-by: thomas chaton <[email protected]> Co-authored-by: thomas <[email protected]>
1 parent 5891cdc commit d6b62da

File tree

12 files changed

+25
-27
lines changed

12 files changed

+25
-27
lines changed

src/lightning_app/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
1414

1515
### Changed
1616

17+
- Changed the default `LightningClient(retry=False)` to `retry=True` ([#16382](https://github.com/Lightning-AI/lightning/pull/16382))
18+
1719
- Add support for async predict method in PythonServer and remove torch context ([#16453](https://github.com/Lightning-AI/lightning/pull/16453))
1820

1921

src/lightning_app/cli/cmd_apps.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class _AppManager:
2222
"""_AppManager implements API calls specific to Lightning AI BYOC apps."""
2323

2424
def __init__(self) -> None:
25-
self.api_client = LightningClient()
25+
self.api_client = LightningClient(retry=False)
2626

2727
def get_cluster(self, cluster_id: str) -> V1GetClusterResponse:
2828
return self.api_client.cluster_service_get_cluster(id=cluster_id)

src/lightning_app/cli/cmd_clusters.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ class AWSClusterManager:
9999
is selected as the backend compute."""
100100

101101
def __init__(self) -> None:
102-
self.api_client = LightningClient()
102+
self.api_client = LightningClient(retry=False)
103103

104104
def create(
105105
self,

src/lightning_app/cli/cmd_ssh_keys.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class _SSHKeyManager:
3333
"""_SSHKeyManager implements API calls specific to Lightning AI SSH-Keys."""
3434

3535
def __init__(self) -> None:
36-
self.api_client = LightningClient()
36+
self.api_client = LightningClient(retry=False)
3737

3838
def get_ssh_keys(self) -> _SSHKeyList:
3939
resp = self.api_client.s_sh_public_key_service_list_ssh_public_keys()

src/lightning_app/cli/commands/connection.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ def connect(app_name_or_id: str):
151151
retriever = _LightningAppOpenAPIRetriever(app_name_or_id)
152152

153153
if not retriever.api_commands:
154-
client = LightningClient()
154+
client = LightningClient(retry=False)
155155
project = _get_project(client)
156156
apps = client.lightningapp_instance_service_list_lightningapp_instances(project_id=project.project_id)
157157
click.echo(

src/lightning_app/cli/commands/logs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def logs(app_name: str, components: List[str], follow: bool) -> None:
3939

4040

4141
def _show_logs(app_name: str, components: List[str], follow: bool) -> None:
42-
client = LightningClient()
42+
client = LightningClient(retry=False)
4343
project = _get_project(client)
4444

4545
apps = {

src/lightning_app/cli/lightning_cli.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ def cluster_logs(cluster_id: str, to_time: arrow.Arrow, from_time: arrow.Arrow,
158158
$ lightning show cluster logs my-cluster --limit 10
159159
"""
160160

161-
client = LightningClient()
161+
client = LightningClient(retry=False)
162162
cluster_manager = AWSClusterManager()
163163
existing_cluster_list = cluster_manager.get_clusters()
164164

src/lightning_app/runners/backends/cloud.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
class CloudBackend(Backend):
1212
def __init__(self, entrypoint_file, queue_id: Optional[str] = None, status_update_interval: int = None):
1313
super().__init__(entrypoint_file, queues=QueuingSystem.MULTIPROCESS, queue_id=queue_id)
14-
self.client = LightningClient(retry=True)
14+
self.client = LightningClient()
1515

1616
def create_work(self, app: "lightning_app.LightningApp", work: "lightning_app.LightningWork") -> None:
1717
raise NotImplementedError

src/lightning_app/utilities/cli_helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def _maybe_find_url(self):
160160

161161
def _maybe_find_matching_cloud_app(self):
162162
"""Tries to resolve the app url from the provided `app_id_or_name_or_url`."""
163-
client = LightningClient()
163+
client = LightningClient(retry=False)
164164
project = _get_project(client)
165165
list_apps = client.lightningapp_instance_service_list_lightningapp_instances(project_id=project.project_id)
166166

src/lightning_app/utilities/commands/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def _download_command(
107107
if not debug_mode:
108108
if app_id:
109109
if not os.path.exists(target_file):
110-
client = LightningClient()
110+
client = LightningClient(retry=False)
111111
project_id = _get_project(client).project_id
112112
response = client.lightningapp_instance_service_list_lightningapp_instance_artifacts(
113113
project_id=project_id, id=app_id

0 commit comments

Comments
 (0)