6.5. pilotscope.PilotScheduler
- class PilotScheduler(config: pilotscope.PilotConfig.PilotConfig)[source]
Bases:
object
- __init__(config: pilotscope.PilotConfig.PilotConfig) → None[source]
- Parameters
config – The configuration of PilotScope.
- init()[source]
Initialize the scheduler for enabling the AI4DB algorithms, triggering the registered events and others. This function should be called before executing any sql and after registering all the required data and events.
- execute(sql)[source]
The function will finish the following tasks:
execute a sql using the registered AI4DB algorithms.
save the collected data into the specific table
try to trigger the registered events
- Parameters
sql – a sql to be executed
- Returns
the related records of the sql
- register_custom_handlers(handlers: List[pilotscope.Anchor.BaseAnchor.BaseAnchorHandler.BaseAnchorHandler])[source]
Register custom AI4DB handlers
- Parameters
handlers – a list of custom handlers
- register_required_data(table_name_for_store_data, pull_execution_time=False, pull_physical_plan=False, pull_subquery_2_cards=False, pull_buffer_cache=False, pull_estimated_cost=False)[source]
Register data need to collect when executing a sql
- Parameters
table_name_for_store_data – the table name for storing the collected data
pull_execution_time – whether to get the execution time of a sql
pull_physical_plan – whether to get the physical plan of a sql
pull_subquery_2_cards – whether to get the sub-plan queries and their cardinality of a sql
pull_buffer_cache – whether to get the buffer cache of table after executing a sql
pull_estimated_cost – whether to get the estimated cost of a sql
- Returns
- register_events(events: List[pilotscope.PilotEvent.Event])[source]
Register events into scheduler.
- Parameters
events – the events to be registered