turbaszek commented on a change in pull request #8277: [AIRFLOW-8187] Extend
elastic DAG with a binary tree, grid, star
URL: https://github.com/apache/airflow/pull/8277#discussion_r409300985
##########
File path: scripts/perf/dags/elastic_dag.py
##########
@@ -123,5 +188,11 @@ class DagShape(Enum):
pass
elif SHAPE == DagShape.LINEAR:
chain(*tasks)
+ elif SHAPE == DagShape.BINARY_TREE:
+ chain_as_binary_tree(*tasks)
+ elif SHAPE == DagShape.STAR:
+ chain_as_star(*tasks)
+ elif SHAPE == DagShape.GRID:
+ chain_as_grid(*tasks)
Review comment:
This list will probably grow over time and pylint will start to moan about
to many elif cases. So I would suggest to use dictionary:
```python
shape_function_map = {
DagShape.LINEAR: chain,
DagShape.BINARY_TREE: chain_as_binary_tree,
...
}
builder = shape_function_map[SHAPE]
builder(*tasks)
```
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services