032: fix coroutine never awaited in debug.py + task_logger.py
debug.py: _test_db_api and _get_dataset_structure were already async def but called SupersetClient methods (authenticate, get_databases, get_dataset) without await. Added await to 4 calls. task_logger.py: _add_log callback is async def but _log() called it without await, silently dropping all task log messages (RuntimeWarning: coroutine never awaited). Changed to fire-and-forget via asyncio.ensure_future when a running event loop is available, drops gracefully otherwise.
This commit is contained in:
@@ -167,8 +167,8 @@ class DebugPlugin(PluginBase):
|
||||
raise ValueError(f"Environment '{name}' not found.")
|
||||
|
||||
client = SupersetClient(env_config)
|
||||
client.authenticate()
|
||||
count, dbs = client.get_databases()
|
||||
await client.authenticate()
|
||||
count, dbs = await client.get_databases()
|
||||
log.debug(f"Found {count} databases in {name}")
|
||||
results[name] = {
|
||||
"count": count,
|
||||
@@ -203,9 +203,9 @@ class DebugPlugin(PluginBase):
|
||||
raise ValueError(f"Environment '{env_name}' not found.")
|
||||
|
||||
client = SupersetClient(env_config)
|
||||
client.authenticate()
|
||||
await client.authenticate()
|
||||
|
||||
dataset_response = client.get_dataset(dataset_id)
|
||||
dataset_response = await client.get_dataset(dataset_id)
|
||||
log.debug(f"Retrieved dataset structure for {dataset_id}")
|
||||
return dataset_response.get('result') or {}
|
||||
# endregion _get_dataset_structure
|
||||
|
||||
Reference in New Issue
Block a user