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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print the e2e app ID as early as possible #15821

Merged
merged 4 commits into from
Nov 26, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions src/lightning_app/testing/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,12 +383,12 @@ def run_app_in_cloud(
).lightningapps
if app.name == name
]

if not lit_apps:
return True

assert len(lit_apps) == 1
app_id = lit_apps[0].id
app = lit_apps[0]
app_id = app.id
print(f"The Lightning App ID is: {app.id}") # useful for Grafana

if debug:
process = Process(target=_print_logs, kwargs={"app_id": app_id})
Expand All @@ -404,24 +404,22 @@ def run_app_in_cloud(
except (playwright._impl._api_types.Error, playwright._impl._api_types.TimeoutError):
pass

# TODO: is re-creating this redundant?
lit_apps = [
app
for app in client.lightningapp_instance_service_list_lightningapp_instances(
project_id=project.project_id
).lightningapps
if app.name == name
]

app_url = lit_apps[0].status.url

app = lit_apps[0]
app_url = app.status.url
while True:
sleep(1)
resp = requests.get(app_url + "/openapi.json")
if resp.status_code == 200:
break

print(f"The Lightning Id Name : [bold magenta]{app_id}[/bold magenta]")

logs_api_client = _LightningLogsSocketAPI(client.api_client)

def fetch_logs(component_names: Optional[List[str]] = None) -> Generator:
Expand Down