set_attr

Applicability

Product

Supported

Atlas A3 training product/Atlas A3 inference product

Atlas A2 training product/Atlas A2 inference product

Atlas 200I/500 A2 inference product

x

Atlas inference product

x

Atlas training product

x

Function Description

Sets the attributes of FlowNode.

Prototype

1
set_attr(attr_name, attr_value)

Parameters

Parameter

Data Type

Description

attr_name

str

Attribute name.

Currently, the following types are supported:

  • _flow_attr: a bool-type attribute that indicates the flow attribute. The value true indicates that the flow attribute exists, and false indicates that the flow attribute does not exist.
  • _flow_attr_depth: an INT-type attribute that specifies the queue depth. The value must be greater than or equal to 2. If this parameter is not set, the default depth 128 is used.
  • _flow_attr_enqueue_policy: a string-type attribute that specifies the enqueue policy and only supports FIFO and OVERWRITE. FIFO means data is enqueued in sequence and waits for dequeue operations when the queue is full, while OVERWRITE means no waiting occurs during enqueue and existing data is overwritten cyclically. The default policy is FIFO if this attribute is not configured.

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.