Datasets:
id: offline-compute_PrestoSQL_prestosql_012
name: Data Quality Check Pipeline Instance GPU Card-Hour Analysis
category: offline-compute/PrestoSQL
timeout_seconds: 900
modality: pure-text
engine: prestosql
Prompt
Task Objective: Analyze the runtime of data quality check pipeline instances. For some abnormally terminated instances, their completion records need to be backfilled. Compute the runtime duration of each instance per date shard, and combined with GPU monitoring data, compute the GPU card-hour consumption, ultimately outputting a detail table.
Business Background: The data quality check pipeline produces various span records, including check.start, check.completed, check.aborted, data.scan, rule.evaluate, resource.allocate, etc. Some instances only record check.aborted without check.completed. For these instances, a synthetic check.completed record must be constructed based on their start and aborted times to correctly compute the runtime duration.
GPU monitoring data is collected in 5-minute windows and must be mapped to instances via Pod names. Combined with the GPU count from the task configuration, the card-hours are computed (gpu_hour = host_gpu_num * total_run_minutes / 60.0).
Input Tables:
internal_platform_db.t_quality_check_span_prestosql_012(quality check span table)databus_imp_dateSTRING — data datetrace_idSTRING — trace IDspan_nameSTRING — span namestart_timeSTRING — start time (epoch milliseconds)end_timeSTRING — end time (epoch milliseconds)status_codeINT — status codeproject_idSTRING — project IDtask_idSTRING — task IDcheck_typeSTRING — check type
internal_platform_db.t_quality_gpu_monitor_prestosql_012(GPU monitoring table)pod_nameSTRING — Pod namepkg_timeSTRING — collection time (epoch seconds)gpu_nameSTRING — GPU modelmetricSTRING — monitoring metricvalueSTRING — metric valuedtSTRING — date partition
internal_platform_db.dwd_quality_podname_prestosql_012(Pod-to-instance mapping table)dtSTRING — date partitioninstance_uuidSTRING — instance UUIDpod_nameSTRING — Pod namepod_phaseSTRING — Pod phase
internal_platform_db.dwd_quality_task_config_prestosql_012(task GPU configuration table 1)databus_imp_dateSTRING — data dateinstance_uuidSTRING — instance UUIDhost_gpu_numDOUBLE — GPU counthost_numDOUBLE — host countlast_modifyDOUBLE — last modification timegpu_nameSTRING — GPU modelresource_idSTRING — resource IDis_dedicatedSTRING — whether dedicated
internal_platform_db.quality_task_config_prestosql_012(task GPU configuration table 2)databus_imp_dateSTRING — data dateinstance_uuidSTRING — instance UUIDhost_gpu_numDOUBLE — GPU counthost_numDOUBLE — host countlast_modifyDOUBLE — last modification timegpu_nameSTRING — GPU modelresource_idSTRING — resource IDis_dedicatedSTRING — whether dedicatedscan_typeSTRING — scan type
Key Logic Notes:
- Identify trace_ids that have only check.aborted without check.completed, and synthesize a check.completed record for them
- Spans running across days must be split by day, generating one record per day
- GPU monitoring data must be deduplicated by 5-minute windows to compute running minutes, and mapped to instances via Pod mapping
- The two GPU configuration tables must be combined with UNION ALL, then use ROW_NUMBER to take the latest configuration per instance
- gpu_hour = host_gpu_num * total_run_minutes / 60.0
Output Requirements:
- Target table:
internal_platform_db.t_quality_check_gpu_instance_detail_cand_prestosql_012 - Output fields:
p_dateSTRING,trace_idSTRING,project_idSTRING,task_idSTRING,check_typeSTRING,status_codeINT,instance_run_timeINT,code_run_timeINT,gpu_hourDOUBLE,resource_idSTRING,is_dedicatedBOOLEAN - If the target table does not exist, first create the table, then write the data
- Use Presto/Trino SQL syntax; do not use Hive/Spark SQL dialects
Environment and Execution Notes:
- Presto is running, connected via the Hive catalog
- Execute SQL:
presto-cli --catalog hive --schema internal_platform_db -f /tmp_workspace/result.sql - After writing
result.sql, you must execute it yourself to verify that it runs successfully and produces correct data