distributed 2021.10.0

ParametersBackRef
read_block(f, offset, length, delimiter=None)

Parameters

f: file :

File-like object supporting seek, read, tell, etc..

offset: int :

Byte offset to start read

length: int :

Number of bytes to read

delimiter: bytes (optional) :

Ensure reading starts and stops at delimiter bytestring

If using the ``delimiter=`` keyword argument we ensure that the read :
starts and stops at delimiter boundaries that follow the locations :
``offset`` and ``offset + length``. If ``offset`` is zero then we :
start at zero. The bytestring returned WILL include the :
terminating delimiter string. :

Read a block of bytes from a file

Examples

This example is valid syntax, but we were not able to check execution
>>> from io import BytesIO  # doctest: +SKIP
... f = BytesIO(b'Alice, 100\nBob, 200\nCharlie, 300') # doctest: +SKIP
... read_block(f, 0, 13) # doctest: +SKIP b'Alice, 100\nBo'
This example is valid syntax, but we were not able to check execution
>>> read_block(f, 0, 13, delimiter=b'\n')  # doctest: +SKIP
b'Alice, 100\nBob, 200\n'
This example is valid syntax, but we were not able to check execution
>>> read_block(f, 10, 10, delimiter=b'\n')  # doctest: +SKIP
b'Bob, 200\nCharlie, 300'
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

distributed.utils.read_block

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /distributed/utils.py#791
type: <class 'function'>
Commit: