ray.dag.context.DAGContext#

class ray.dag.context.DAGContext(submit_timeout: int = 10, get_timeout: int = 10, teardown_timeout: int = 30, read_iteration_timeout: float = 0.1, buffer_size_bytes: int = 1000000, max_inflight_executions: int = 10, max_buffered_results: int = 1000, overlap_gpu_communication: bool = False)[source]#

Global settings for Ray DAG.

You can configure parameters in the DAGContext by setting the environment variables, RAY_CGRAPH_<param> (e.g., RAY_CGRAPH_buffer_size_bytes) or Python.

Examples

>>> from ray.dag import DAGContext
>>> DAGContext.get_current().buffer_size_bytes
1000000
>>> DAGContext.get_current().buffer_size_bytes = 500
>>> DAGContext.get_current().buffer_size_bytes
500
Parameters:
  • submit_timeout – The maximum time in seconds to wait for execute() calls.

  • get_timeout – The maximum time in seconds to wait when retrieving a result from the DAG during ray.get. This should be set to a value higher than the expected time to execute the entire DAG.

  • teardown_timeout – The maximum time in seconds to wait for the DAG to cleanly shut down.

  • read_iteration_timeout – The timeout in seconds for each read iteration that reads one of the input channels. If the timeout is reached, the read operation will be interrupted and will try to read the next input channel. It must be less than or equal to get_timeout.

  • buffer_size_bytes – The initial buffer size in bytes for messages that can be passed between tasks in the DAG. The buffers will be automatically resized if larger messages are written to the channel.

  • max_inflight_executions – The maximum number of in-flight executions that can be submitted via execute or execute_async before consuming the output using ray.get(). If the caller submits more executions, RayCgraphCapacityExceeded is raised.

  • overlap_gpu_communication – (experimental) Whether to overlap GPU communication with computation during DAG execution. If True, the communication and computation can be overlapped, which can improve the performance of the DAG execution.

DeveloperAPI: This API may change across minor Ray releases.

Methods

get_current

Get or create a singleton context.

Attributes

buffer_size_bytes

get_timeout

max_buffered_results

max_inflight_executions

overlap_gpu_communication

read_iteration_timeout

submit_timeout

teardown_timeout