Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core][compiled-graph] Throw an exception when DAGNode is inside any type of container as a DAGNode arg #48302

Merged
merged 5 commits into from
Nov 7, 2024

Conversation

kevin85421
Copy link
Member

@kevin85421 kevin85421 commented Oct 29, 2024

Why are these changes needed?

Based on #48045, we have decided to treat a case where a DAGNode is inside any type of container as a DAGNode argument as an error and throw an exception.

We verify whether there is a case in the constructor of the DAGNode.

Related issue number

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

Signed-off-by: kaihsun <[email protected]>
@kevin85421 kevin85421 changed the title [core][compiled graphs] Throw an exception when DAGNode is inside any type of container as a DAGNode arg [core][compiled-graph] Throw an exception when DAGNode is inside any type of container as a DAGNode arg Oct 29, 2024

# UUID that is not changed over copies of this node.
self._stable_uuid = uuid.uuid4().hex

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've decided to move this function below _stable_uuid so that it won't throw an error when printing self in the exception in _collect_upstream_nodes.

actor.echo.bind((inp,))
assert re.search(self.regex, str(exc_info.value), re.DOTALL)

def test_dag_node_in_dict(self, ray_start_regular):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it working if dag node is in a different class?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a test

@kevin85421
Copy link
Member Author

This PR is a breaking change for traditional DAG. For example:

@ray.remote
def d(nested):
ray.get(ct.inc.remote())
return ray.get(nested["x"]) + ray.get(nested["y"])
a_ref = a.bind()
b_ref = b.bind(x=a_ref)
c_ref = c.bind(x=a_ref)
dag = d.bind({"x": b_ref, "y": c_ref})

The test passes a dict of refs to the FunctionNode, and then calls ray.get inside the task to resolve the values.

Should we "Throw an exception when DAGNode is inside any type of container as a DAGNode arg" only when it is a RayCG instead of making a breaking change?

@rkooo567
Copy link
Contributor

rkooo567 commented Nov 4, 2024

yeah can we make it ray cg only?

@kevin85421 kevin85421 assigned kevin85421 and unassigned rkooo567 and ruisearch42 Nov 4, 2024
Signed-off-by: kaihsun <[email protected]>
Signed-off-by: kaihsun <[email protected]>
@kevin85421 kevin85421 added the go add ONLY when ready to merge, run all tests label Nov 5, 2024
Copy link
Contributor

@ruisearch42 ruisearch42 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, some minor comments

python/ray/dag/dag_node.py Outdated Show resolved Hide resolved
python/ray/dag/dag_node.py Show resolved Hide resolved
python/ray/dag/dag_node.py Outdated Show resolved Hide resolved
python/ray/dag/dag_node.py Outdated Show resolved Hide resolved
Signed-off-by: kaihsun <[email protected]>
Signed-off-by: kaihsun <[email protected]>
@rkooo567 rkooo567 merged commit fafe308 into ray-project:master Nov 7, 2024
5 checks passed
JP-sDEV pushed a commit to JP-sDEV/ray that referenced this pull request Nov 14, 2024
…type of container as a DAGNode arg (ray-project#48302)

Based on ray-project#48045, we have decided to treat a case where a DAGNode is inside any type of container as a DAGNode argument as an error and throw an exception.

Signed-off-by: JP-sDEV <[email protected]>
mohitjain2504 pushed a commit to mohitjain2504/ray that referenced this pull request Nov 15, 2024
…type of container as a DAGNode arg (ray-project#48302)

Based on ray-project#48045, we have decided to treat a case where a DAGNode is inside any type of container as a DAGNode argument as an error and throw an exception.

Signed-off-by: mohitjain2504 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go add ONLY when ready to merge, run all tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants