- class uproot.source.chunk.Source
Abstract class for physically reading and writing data from a file, which might be remote.
In addition to the file handle, a uproot.source.chunk.Source might manage a uproot.source.futures.ResourceThreadPoolExecutor to read the file in parallel. Stopping these threads is part of the act of closing the file.
- Source.chunks(ranges, notifications)
ranges (list of (int, int) 2-tuples) – Intervals to fetch as (start, stop) pairs in a single request, if possible.
queue.Queue) – Indicator of completed chunks. After each gets filled, it is
puton the queue; a listener should
getfrom this queue
Request a set of byte ranges from the file.
This method has two outputs:
The method returns a list of unfilled uproot.source.chunk.Chunk objects, which get filled in a background thread. If you try to read data from an unfilled chunk, it will wait until it is filled.
The method also puts the same uproot.source.chunk.Chunk objects onto the
notificationsqueue as soon as they are filled.
Reading data from chunks on the queue can be more efficient than reading them from the returned list. The total reading time is the same, but work on the filled chunks can be better parallelized if it is triggered by already-filled chunks, rather than waiting for chunks to be filled.
A path to the file (or URL).
The number of bytes in the file.
The number of requests that have been made (performance counter).
The number of bytes that have been requested (performance counter).
Manually closes the file(s) and stops any running threads.
True if the associated file/connection/thread pool is closed; False otherwise.