set_attr

Applicability

Product

Supported

Atlas A3 training products/Atlas A3 inference products

√

Atlas A2 training products/Atlas A2 inference products

√

Atlas 200I/500 A2 inference products

x

Atlas inference products

x

Atlas training products

x

Function Description

Sets the attributes of FlowNode.

Prototype

1
set_attr(attr_name, attr_value)

Parameters

Parameter

Data Type

Value Description

attr_name

str

Attribute name.

Currently, the following types are supported:

  • _flow_attr: bool type. The value true indicates that the flow attribute exists, and the value false indicates that the flow attribute does not exist.
  • _flow_attr_depth: int type. It specifies the queue depth and is greater than or equal to 2. The default depth is 128.
  • _flow_attr_enqueue_policy: string type. It specifies the enqueuing policy, which can be FIFO or OVERWRITE only. If this attribute is set to FIFO, data enters the queue in sequence and waits dequeuing when the queue is full. If this attribute is set to OVERWRITE, data will be overwritten circularly. The default value is FIFO.

attr_value

Union[bool, str, int]

Attribute value.

Returns

None is returned in normal scenarios.

TypeError is returned when the parameter type is incorrect.

Examples

1
2
3
4
5
6
import dataflow as df
pp = df.FuncProcessPoint(...)
flow_node = df.FlowNode(...)
flow_node.set_attr("_flow_attr",True)
flow_node.set_attr("_flow_attr_depth",5)
flow_node.set_attr("_flow_attr_enqueue_policy","FIFO")

Constraints

Before setting the depth and policy by using _flow_attr_depth and _flow_attr_enqueue_policy, you need to enable _flow_attr. Otherwise, the settings do not take effect.