032: fix remaining sync→async propagation (17 call sites)

Core fixes:
  - service_datasource.py: fetch_datasource_metadata() → async
  - service.py: create_job(), update_job() → async (callers await)
  - _job_routes.py: await create_job/update_job

Maintenance scanners:
  - _dashboard_scanner.py: 4 functions → async (find_affected, _get_linked,
    _apply_filters, _resolve_title)
  - _chart_manager.py: 3 functions → async
  - _banner_renderer.py: rebuild_banner → async
  - _orchestrators.py: 3 orchestrators → async
  - maintenance_banner.py: await async calls

Migration:
  - dry_run_orchestrator.py: run(), _build_target_signatures() → async
  - risk_assessor.py: build_risks() → async
  - migration.py: await service.run()
  - mapping_service.py: sync_environment() → async

Dead code:
  - _helpers.py: _find_dashboard_id_by_slug marked DEPRECATED
This commit is contained in:
2026-06-05 08:56:37 +03:00
parent a5cd06546f
commit c7d8f4431e
13 changed files with 67 additions and 66 deletions

View File

@@ -20,6 +20,10 @@ def _find_dashboard_id_by_slug(
client: SupersetClient,
dashboard_slug: str,
) -> int | None:
"""@DEPRECATED — dead code, use _find_dashboard_id_by_slug_async."""
# This function is no longer called (only _async version is used).
# It remains as a reference but will raise AttributeError at runtime
# because SupersetClient methods are now async.
query_variants = [
{
"filters": [{"col": "slug", "opr": "eq", "value": dashboard_slug}],

View File

@@ -184,7 +184,7 @@ async def dry_run_migration(
target_client = AsyncSupersetClient(target_env)
try:
result = service.run(
result = await service.run(
selection=selection,
source_client=source_client,
target_client=target_client,

View File

@@ -106,7 +106,7 @@ async def create_job(
logger.reason(f"create_job — User: {current_user.username}", extra={"src": "translate_routes"})
try:
service = TranslateJobService(db, config_manager, current_user.username)
job = service.create_job(payload)
job = await service.create_job(payload)
dict_ids = service.get_job_dictionary_ids(job.id)
return job_to_response(job, dict_ids)
except ValueError as e:
@@ -132,7 +132,7 @@ async def update_job(
logger.reason(f"update_job — Job: {job_id}, User: {current_user.username}", extra={"src": "translate_routes"})
try:
service = TranslateJobService(db, config_manager, current_user.username)
job = service.update_job(job_id, payload)
job = await service.update_job(job_id, payload)
dict_ids = service.get_job_dictionary_ids(job.id)
return job_to_response(job, dict_ids)
except ValueError as e: