Hi folks - is it possible to access the actual DAG...
# ask-the-community
Hi folks - is it possible to access the actual DAG contained in a workflow? That is, to see how the nodes are dependent on one another? (Obviously this is known when the DAG is created, but it's somewhat implicit, and we'd like to have an explicit representation to look at for data validation...)
For static workflows, this can be done via the following, but I'm curious if something similar can be done for dynamic workflows
Copy code
def get_node_dependencies(workflow) -> dict[str, list[str]]:
    links = {}
    for node in workflow.nodes:
        links[node.flyte_entity.name] = [n.flyte_entity.name for n in node.upstream_nodes]
    return links
Can you help me understand how does this help
Fair question @Ketan (kumare3) - basically I have a dynamic workflow which runs some tasks if a user requests them based on an input object
. However, some of those tasks have upstream dependencies, which can also be requested independently. If a user requests a task which has upstream dependencies, but they do not explicitly request those dependencies in
, we'd like to automatically add them to
so that the workflow can complete successfully. While we can manually describe the relationships between these tasks, since they're already part of a workflow which already converts these tasks into a DAG, we were wondering if it was possible to leverage that DAG directly 🤔