File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,34 @@ The `Store` class supports the following options:
9999Use ` Store.for_download() ` as a convenient shorthand for storing results
100100as a single Parquet file with a presigned URL.
101101
102+ ### Execution progress
103+
104+ You can monitor the progress of running queries by registering a
105+ progress handler on the connection.
106+
107+ ``` python
108+ from wherobots.db import connect, ProgressInfo
109+ from wherobots.db.region import Region
110+ from wherobots.db.runtime import Runtime
111+
112+ def on_progress (info : ProgressInfo) -> None :
113+ print (f " { info.tasks_completed} / { info.tasks_total} tasks "
114+ f " ( { info.tasks_active} active) " )
115+
116+ with connect(
117+ api_key = ' ...' ,
118+ runtime = Runtime.TINY ,
119+ region = Region.AWS_US_WEST_2 ) as conn:
120+ conn.set_progress_handler(on_progress)
121+ curr = conn.cursor()
122+ curr.execute(" SELECT ..." )
123+ results = curr.fetchall()
124+ ```
125+
126+ The handler receives a ` ProgressInfo ` named tuple with ` execution_id ` ,
127+ ` tasks_total ` , ` tasks_completed ` , and ` tasks_active ` fields. Pass
128+ ` None ` to ` set_progress_handler() ` to disable progress reporting.
129+
102130### Runtime and region selection
103131
104132You can chose the Wherobots runtime you want to use using the ` runtime `
You can’t perform that action at this time.
0 commit comments