> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://docs.nvidia.com/dynamo/llms.txt. For full content including API reference and SDK examples, see https://docs.nvidia.com/dynamo/llms-full.txt.

# Read Operation

An operation which transfers data from a remote worker to the local worker.

To create the operation, NIXL metadata ([RdmaMetadata](/dynamo/dev/nixl-connect/rdma-metadata)) from a remote worker's [`ReadableOperation`](/dynamo/dev/nixl-connect/readable-operation)
along with a matching set of local [`Descriptor`](/dynamo/dev/nixl-connect/descriptor) objects which reference memory intended to receive data from the remote worker must be provided.
The NIXL metadata must be transferred from the remote to the local worker via a secondary channel, most likely HTTP or TCP+NATS.

Once created, data transfer will begin immediately.
Disposal of the object will instruct the NIXL subsystem to cancel the operation,
therefore the operation should be awaited until completed unless cancellation is intended.

## Example Usage

```python
    async def read_from_remote(
      self,
      remote_metadata: dynamo.nixl_connect.RdmaMetadata,
      local_tensor: torch.Tensor
    ) -> None:
      descriptor = dynamo.nixl_connect.Descriptor(local_tensor)

      with await self.connector.begin_read(remote_metadata, descriptor) as read_op:
        # Wait for the operation to complete writing data from the remote worker to local_tensor.
        await read_op.wait_for_completion()
```

## Methods

### cancel

```python
def cancel(self) -> None
```

Instructs the NIXL subsystem to cancel the operation.
Completed operations cannot be cancelled.

### wait\_for\_completion

```python
async def wait_for_completion(self) -> None
```

Blocks the caller until the memory from the remote worker has been transferred to the provided buffers.

## Properties

The current state (aka. status) of the operation. See [`OperationStatus`](/dynamo/dev/nixl-connect/operation-status).

## Related Classes

* [Connector](/dynamo/dev/nixl-connect/connector)
* [Descriptor](/dynamo/dev/nixl-connect/descriptor)
* [Device](/dynamo/dev/nixl-connect/device)
* [OperationStatus](/dynamo/dev/nixl-connect/operation-status)
* [RdmaMetadata](/dynamo/dev/nixl-connect/rdma-metadata)
* [ReadableOperation](/dynamo/dev/nixl-connect/readable-operation)
* [WritableOperation](/dynamo/dev/nixl-connect/writable-operation)
* [WriteOperation](/dynamo/dev/nixl-connect/write-operation)