Poll cb and poll first dict, error handling #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
-poll_callback_on_data method for executing a callback on receiving each row of poll data
-poll_return_first_dict method for returning and stopping the polling function upon the first block after start_block with applicable data. Ideal for recursively calling from front end
-Basic error handling
In this Pull Request, there are two new methods in addition to the poll method: poll_callback_on_data and poll_return_first_dict. Both of these methods have similar functionality to the original "poll" method in that they run the substream in an attempt to receive their data, but the difference is in the behavior upon data received. While the original poll method gets the data from all blocks between the start_block and end_block and then returns a pandas data frame, these new methods execute logic each time a block has an applicable tx/event. poll_return_first_dict returns a dict of the data on the first applicable block after start block. The idea is that this function will be recursively called from the front end so that streamlit/whatever library can update its state and then restart the streaming on the successive block. One useful feature of this method is that you can define the end_block past chain head and it will return data in real time as each block finalizes. The other method poll_callback_on_data receives a callback as an argument from the front end and executes it after receiving a row of data.