Skip to content

Commit

Permalink
Print the e2e app ID as early as possible (#15821)
Browse files Browse the repository at this point in the history
  • Loading branch information
carmocca committed Nov 26, 2022
1 parent 6a2a83a commit 76cf419
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/lightning_app/testing/testing.py
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

0 comments on commit 76cf419

Please sign in to comment.