Skip to content

[Data] (Data Fault Tolerance 2/n) Support fan-out tasks in lineage tracker - #65642

Merged
rueian merged 10 commits into
ray-project:masterfrom
Kunchd:data_lineage_tracker
Sep 9, 2026
Merged

rueian merged 10 commits into
ray-project:masterfrom
Kunchd:data_lineage_tracker

Conversation

@Kunchd

@Kunchd Kunchd commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

Description

Note: This PR is a no-op and simply adds additional functionality to the Ray Data lineage tracking framework to support fan-out tasks.

This PR builds on top of #65519 and introduces the ability to track fan-out tasks via plans. We define fan-out tasks as those whose outputs are consumed by more than one downstream tasks.

At a high level, we support plans via the following steps:
image

  1. When a task fails, we set that task as the target task. A reconstruction plan ID associated with the target task is created.
  2. From there, we begin walking up the task lineage graph. For each upstream parent, we create a plan entry that tracks the dependencies produced by that parent task that are necessary to reconstruct the downstream tasks that ultimately leads to the target task.
  3. Once we've reached the root, we begin resubmission starting from the root task.
  4. For each resubmitted task that completes, we check its reconstruction plan in the lineage graph and only pass the outputs that are needed in the plan to downstream tasks.
  5. This continues until the target task is reconstructed.

Related issues

Additional information

@Kunchd
Kunchd requested a review from a team as a code owner August 21, 2026 08:31
@Kunchd Kunchd added the go add ONLY when ready to merge, run all tests label Aug 21, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request updates the LineageTracker to support fan-out lineage tracking by allowing tasks to have multiple parents and children, and tracking in-flight reconstruction plans via plan IDs. It also adds a comprehensive suite of unit tests for fan-out failure recovery scenarios. A review comment points out a potential issue where duplicate ChildBlockDependency objects can accumulate in plan_to_child_block_lineages on retries of a reconstruction plan, and provides a code suggestion to clear the plan's lineage on the first visit to each node during the trace traversal.

Comment on lines +250 to +261
child_ids = traced_child_ids.setdefault(node.data_task_id, set())
if child_node is not None:
if child_node.data_task_id in child_ids:
return
child_ids.add(child_node.data_task_id)

# Every task along the failed path takes part in the plan. The target
# of the reconstruction has no child to re-produce blocks for, so its
# lineage for the plan stays empty.
child_block_lineages = node.plan_to_child_block_lineages.setdefault(
plan_id_to_attach, []
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

On retries of a reconstruction plan, register_failed_task is called with an existing plan_id. Since traced_child_ids is a local dictionary initialized to empty on each call, setdefault on plan_to_child_block_lineages will retrieve the existing list of lineages and append duplicate ChildBlockDependency objects to it. This leads to duplicate entries accumulating in plan_to_child_block_lineages on every retry, causing unnecessary memory growth.

To fix this, we should clear the plan's lineage on the first visit to each node during the current trace traversal.

Suggested change
child_ids = traced_child_ids.setdefault(node.data_task_id, set())
if child_node is not None:
if child_node.data_task_id in child_ids:
return
child_ids.add(child_node.data_task_id)
# Every task along the failed path takes part in the plan. The target
# of the reconstruction has no child to re-produce blocks for, so its
# lineage for the plan stays empty.
child_block_lineages = node.plan_to_child_block_lineages.setdefault(
plan_id_to_attach, []
)
is_first_visit = node.data_task_id not in traced_child_ids
child_ids = traced_child_ids.setdefault(node.data_task_id, set())
if child_node is not None:
if child_node.data_task_id in child_ids:
return
child_ids.add(child_node.data_task_id)
# Every task along the failed path takes part in the plan. The target
# of the reconstruction has no child to re-produce blocks for, so its
# lineage for the plan stays empty.
if is_first_visit:
node.plan_to_child_block_lineages[plan_id_to_attach] = []
child_block_lineages = node.plan_to_child_block_lineages[plan_id_to_attach]

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This should not happen with only fan-outs. Will address this in the fan-in case.

@ray-gardener ray-gardener Bot added the data Ray Data-related issues label Aug 21, 2026
@ayushk7102 ayushk7102 self-assigned this Aug 21, 2026
Comment on lines +201 to +202
del task_node.plan_to_child_block_lineages[plan_id]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Discussed offline, while our assumption holds that there should never be more than one instance of a reconstruction targeting the same task at the same time, we can still run into two issues:

  1. Currently, we append child block lineages every time we trace up to a seed in reconstruction (even if it's a repeated failure), and we can therefore append duplicates -- need to use a set / check for existing
  2. Because of the above, we can run into key not found errors where we are trying to delete a plan ID for a task from plan_to_child_block_lineages when it has already been deleted.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Just adding on a little from offline discussion. The primary case we discovered that can lead to key error and duplicates involves topologies with fan-ins such as the one below:
image

We will address this issue as a followup when we support fan-in on the lineage tracker.

Comment on lines +274 to +279
child_block_lineages.append(
ChildBlockDependency(
child_data_task_id=child_node.data_task_id,
output_index=output_index,
)
)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we be blindly appending to child_block_lineages here?

What if we run _trace_parent_for_reconstruction on a repeated failure, which means that the chain of task nodes in this reconstruction attempt already have some state in their child_block_lineages, and we will end up adding duplicates

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

We've walked through some cases offline per above discussion and found it is possible to have duplicates. This will be addressed when we support fan-ins.

Comment on lines +163 to +165
#: Every child consumes the *same* seed output block, so the seed produces a
#: single output shared by the whole fan-out.
SHARED = "shared"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Unless I'm understanding this wrong, I don't think we have any cases like this in Ray Data. We don't have a fork/copy operator in the API that would broadcast a block to several consumers downstream, and we don't have a broadcast join either

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Chatted offline. We have decided to keep this since we will need the shared pattern for supporting joins in the near future.

@ayushk7102 ayushk7102 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@rueian
rueian merged commit 29321c4 into ray-project:master Sep 9, 2026
6 checks passed
@Kunchd
Kunchd deleted the data_lineage_tracker branch September 10, 2026 21:58
NightWing1998 pushed a commit to NightWing1998/ray that referenced this pull request Sep 11, 2026
…acker (ray-project#65642)

## Description
**Note**: This PR is a no-op and simply adds additional functionality to
the Ray Data lineage tracking framework to support fan-out tasks.

This PR builds on top of ray-project#65519
and introduces the ability to track fan-out tasks via plans. We define
fan-out tasks as those whose outputs are consumed by more than one
downstream tasks.

At a high level, we support plans via the following steps:
<img width="3318" height="1911" alt="image"
src="https://github.com/user-attachments/assets/c9629b38-5a3a-4f74-acd8-82c4c908ea3d"
/>

1. When a task fails, we set that task as the `target task`. A
reconstruction plan ID associated with the target task is created.
2. From there, we begin walking up the task lineage graph. For each
upstream parent, we create a plan entry that tracks the dependencies
produced by that parent task that are necessary to reconstruct the
downstream tasks that ultimately leads to the target task.
3. Once we've reached the root, we begin resubmission starting from the
root task.
4. For each resubmitted task that completes, we check its reconstruction
plan in the lineage graph and only pass the outputs that are needed in
the plan to downstream tasks.
5. This continues until the target task is reconstructed.

## Related issues

## Additional information

---------

Signed-off-by: davik <[email protected]>
Co-authored-by: davik <[email protected]>
Sparks0219 pushed a commit that referenced this pull request Sep 21, 2026
#66136)

## Description
**Note**: This PR is a no-op and simply adds additional functionality to
the Ray Data lineage tracking framework to support fan-out tasks.

This PR builds on top of #65642 to support pipelines with fan-ins on the
lineage tracking. Here we define *fan-in* operators as operators whose
tasks can take input blocks from more than one upstream operator tasks.

At a high level, we extend the plan concept discussed in #65642 via the
following steps:

<img width="1035" height="666" alt="image"
src="https://github.com/user-attachments/assets/792b9fa0-6b62-4889-b573-c634b7229325"
/>

As discussed before, the steps for constructing the plan itself is as
follows:
> 1. When a task fails, we set that task as the `target task`. A
reconstruction plan ID associated with the target task is created.
> 2. From there, we begin walking up the task lineage graph. For each
upstream parent, we create a plan entry that tracks the dependencies
produced by that parent task that are necessary to reconstruct the
downstream tasks that ultimately leads to the target task.
> 3. Once we've reached the root, we begin resubmission starting from
the root task.
> 4. For each resubmitted task that completes, we check its
reconstruction plan in the lineage graph and only pass the outputs that
are needed in the plan to downstream tasks.
> 5. This continues until the target task is reconstructed.

The main extension for supporting fan-ins is: As we walk up the graph
when creating the plan, we must ensure that we visit all parents instead
of assuming only a single parent. This will allow us to create plans
that support fan-in operators.

#### Bug fix

Another change we've added to the lineage tracker on this PR is to
address the issue mentioned in
#65642 (comment).
When we submit a reconstruction task, we now remove the submitted task
from the set of children pending dependencies on the parent's plan
instead of simply removing the plan when the parent task completes. This
is necessary because it's possible for a reconstruction task to still be
executing when another reconstruction attempt that needs to re-execute
the same task is triggered. Consider the following scenario that was
possible prior to this PR:

<img width="1652" height="1087" alt="image"
src="https://github.com/user-attachments/assets/188eabdd-3e80-46e1-bd63-51be8aa643c7"
/>
Suppose task C failed at some point, triggering reconstruction. Task A
has already completed so it's plan is erased. Task B is still executing
because it has some unproduced outputs, but the output block Task C
needs is ready. So Task C is already executing.

At this point, suppose task C's node dies again. Thus we begin
reconstruction under the same plan again. Task B's plan entry is
duplicated since the previous entry hasn't been erased yet, and Task A's
plan is repopulated.

<img width="1180" height="1018" alt="image"
src="https://github.com/user-attachments/assets/a6f8ab35-5522-4471-a6cc-6e1aeb12e59d"
/>

Here, notice that once task A completes, task B is essentially going to
have two reconstruction attempts happening at the same time for the same
plan_id. So let's suppose the earlier task B finishes. This will result
in the entire plan being wiped, although the second task B is still
executing.

<img width="1634" height="1090" alt="Screenshot 2026-09-12 at 7 05
14 PM"
src="https://github.com/user-attachments/assets/41682f09-9b04-4bd6-8c6e-3a64a813439f"
/>

Now if the second task B completes, it's deletion of the plan will
result in a key error!

Thus, this PR clears the dependency in the parent's plan upon child task
submission instead of parent task completion. This means that when the
first task B execution produced the dependency needed for task C, we
would've cleared task B's plan there when task C was submitted instead
of waiting for the executions to double up. Thus, avoiding the issue.

## Related issues

## Additional information

---------

Signed-off-by: davik <[email protected]>
Co-authored-by: davik <[email protected]>
owenowenisme pushed a commit to owenowenisme/ray that referenced this pull request Sep 23, 2026
ray-project#66136)

## Description
**Note**: This PR is a no-op and simply adds additional functionality to
the Ray Data lineage tracking framework to support fan-out tasks.

This PR builds on top of ray-project#65642 to support pipelines with fan-ins on the
lineage tracking. Here we define *fan-in* operators as operators whose
tasks can take input blocks from more than one upstream operator tasks.

At a high level, we extend the plan concept discussed in ray-project#65642 via the
following steps:

<img width="1035" height="666" alt="image"
src="https://github.com/user-attachments/assets/792b9fa0-6b62-4889-b573-c634b7229325"
/>

As discussed before, the steps for constructing the plan itself is as
follows:
> 1. When a task fails, we set that task as the `target task`. A
reconstruction plan ID associated with the target task is created.
> 2. From there, we begin walking up the task lineage graph. For each
upstream parent, we create a plan entry that tracks the dependencies
produced by that parent task that are necessary to reconstruct the
downstream tasks that ultimately leads to the target task.
> 3. Once we've reached the root, we begin resubmission starting from
the root task.
> 4. For each resubmitted task that completes, we check its
reconstruction plan in the lineage graph and only pass the outputs that
are needed in the plan to downstream tasks.
> 5. This continues until the target task is reconstructed.

The main extension for supporting fan-ins is: As we walk up the graph
when creating the plan, we must ensure that we visit all parents instead
of assuming only a single parent. This will allow us to create plans
that support fan-in operators.

#### Bug fix

Another change we've added to the lineage tracker on this PR is to
address the issue mentioned in
ray-project#65642 (comment).
When we submit a reconstruction task, we now remove the submitted task
from the set of children pending dependencies on the parent's plan
instead of simply removing the plan when the parent task completes. This
is necessary because it's possible for a reconstruction task to still be
executing when another reconstruction attempt that needs to re-execute
the same task is triggered. Consider the following scenario that was
possible prior to this PR:

<img width="1652" height="1087" alt="image"
src="https://github.com/user-attachments/assets/188eabdd-3e80-46e1-bd63-51be8aa643c7"
/>
Suppose task C failed at some point, triggering reconstruction. Task A
has already completed so it's plan is erased. Task B is still executing
because it has some unproduced outputs, but the output block Task C
needs is ready. So Task C is already executing.

At this point, suppose task C's node dies again. Thus we begin
reconstruction under the same plan again. Task B's plan entry is
duplicated since the previous entry hasn't been erased yet, and Task A's
plan is repopulated.

<img width="1180" height="1018" alt="image"
src="https://github.com/user-attachments/assets/a6f8ab35-5522-4471-a6cc-6e1aeb12e59d"
/>

Here, notice that once task A completes, task B is essentially going to
have two reconstruction attempts happening at the same time for the same
plan_id. So let's suppose the earlier task B finishes. This will result
in the entire plan being wiped, although the second task B is still
executing.

<img width="1634" height="1090" alt="Screenshot 2026-09-12 at 7 05
14 PM"
src="https://github.com/user-attachments/assets/41682f09-9b04-4bd6-8c6e-3a64a813439f"
/>

Now if the second task B completes, it's deletion of the plan will
result in a key error!

Thus, this PR clears the dependency in the parent's plan upon child task
submission instead of parent task completion. This means that when the
first task B execution produced the dependency needed for task C, we
would've cleared task B's plan there when task C was submitted instead
of waiting for the executions to double up. Thus, avoiding the issue.

## Related issues

## Additional information

---------

Signed-off-by: davik <[email protected]>
Co-authored-by: davik <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
…acker (ray-project#65642)

## Description
**Note**: This PR is a no-op and simply adds additional functionality to
the Ray Data lineage tracking framework to support fan-out tasks.

This PR builds on top of ray-project#65519
and introduces the ability to track fan-out tasks via plans. We define
fan-out tasks as those whose outputs are consumed by more than one
downstream tasks.

At a high level, we support plans via the following steps:
<img width="3318" height="1911" alt="image"
src="https://github.com/user-attachments/assets/c9629b38-5a3a-4f74-acd8-82c4c908ea3d"
/>

1. When a task fails, we set that task as the `target task`. A
reconstruction plan ID associated with the target task is created.
2. From there, we begin walking up the task lineage graph. For each
upstream parent, we create a plan entry that tracks the dependencies
produced by that parent task that are necessary to reconstruct the
downstream tasks that ultimately leads to the target task.
3. Once we've reached the root, we begin resubmission starting from the
root task.
4. For each resubmitted task that completes, we check its reconstruction
plan in the lineage graph and only pass the outputs that are needed in
the plan to downstream tasks.
5. This continues until the target task is reconstructed.

## Related issues

## Additional information

---------

Signed-off-by: davik <[email protected]>
Co-authored-by: davik <[email protected]>
nadongjun pushed a commit to nadongjun/ray that referenced this pull request Oct 6, 2026
ray-project#66136)

## Description
**Note**: This PR is a no-op and simply adds additional functionality to
the Ray Data lineage tracking framework to support fan-out tasks.

This PR builds on top of ray-project#65642 to support pipelines with fan-ins on the
lineage tracking. Here we define *fan-in* operators as operators whose
tasks can take input blocks from more than one upstream operator tasks.

At a high level, we extend the plan concept discussed in ray-project#65642 via the
following steps:

<img width="1035" height="666" alt="image"
src="https://github.com/user-attachments/assets/792b9fa0-6b62-4889-b573-c634b7229325"
/>

As discussed before, the steps for constructing the plan itself is as
follows:
> 1. When a task fails, we set that task as the `target task`. A
reconstruction plan ID associated with the target task is created.
> 2. From there, we begin walking up the task lineage graph. For each
upstream parent, we create a plan entry that tracks the dependencies
produced by that parent task that are necessary to reconstruct the
downstream tasks that ultimately leads to the target task.
> 3. Once we've reached the root, we begin resubmission starting from
the root task.
> 4. For each resubmitted task that completes, we check its
reconstruction plan in the lineage graph and only pass the outputs that
are needed in the plan to downstream tasks.
> 5. This continues until the target task is reconstructed.

The main extension for supporting fan-ins is: As we walk up the graph
when creating the plan, we must ensure that we visit all parents instead
of assuming only a single parent. This will allow us to create plans
that support fan-in operators.

#### Bug fix

Another change we've added to the lineage tracker on this PR is to
address the issue mentioned in
ray-project#65642 (comment).
When we submit a reconstruction task, we now remove the submitted task
from the set of children pending dependencies on the parent's plan
instead of simply removing the plan when the parent task completes. This
is necessary because it's possible for a reconstruction task to still be
executing when another reconstruction attempt that needs to re-execute
the same task is triggered. Consider the following scenario that was
possible prior to this PR:

<img width="1652" height="1087" alt="image"
src="https://github.com/user-attachments/assets/188eabdd-3e80-46e1-bd63-51be8aa643c7"
/>
Suppose task C failed at some point, triggering reconstruction. Task A
has already completed so it's plan is erased. Task B is still executing
because it has some unproduced outputs, but the output block Task C
needs is ready. So Task C is already executing.

At this point, suppose task C's node dies again. Thus we begin
reconstruction under the same plan again. Task B's plan entry is
duplicated since the previous entry hasn't been erased yet, and Task A's
plan is repopulated.

<img width="1180" height="1018" alt="image"
src="https://github.com/user-attachments/assets/a6f8ab35-5522-4471-a6cc-6e1aeb12e59d"
/>

Here, notice that once task A completes, task B is essentially going to
have two reconstruction attempts happening at the same time for the same
plan_id. So let's suppose the earlier task B finishes. This will result
in the entire plan being wiped, although the second task B is still
executing.

<img width="1634" height="1090" alt="Screenshot 2026-09-12 at 7 05
14 PM"
src="https://github.com/user-attachments/assets/41682f09-9b04-4bd6-8c6e-3a64a813439f"
/>

Now if the second task B completes, it's deletion of the plan will
result in a key error!

Thus, this PR clears the dependency in the parent's plan upon child task
submission instead of parent task completion. This means that when the
first task B execution produced the dependency needed for task C, we
would've cleared task B's plan there when task C was submitted instead
of waiting for the executions to double up. Thus, avoiding the issue.

## Related issues

## Additional information

---------

Signed-off-by: davik <[email protected]>
Co-authored-by: davik <[email protected]>
goutamvenkat-anyscale pushed a commit that referenced this pull request Oct 10, 2026
… streaming executor (#66220)

## Description
Note: By default the changes introduced in this PR are a no-op in Ray
Data. Data lineage reconstruction is enabled only when the job turns off
Ray Core lineage reconstruction via the JobConfig
(`JobConfig(_disable_job_level_lineage_reconstruction=True)`, #65487)

This PR wires the lineage tracker introduced in
#65519 and developed to support
fan-in and fan-out tasks in
#65642,
#66136.

This is a part of a larger effort to introduce lineage reconstruction as
a first class construct in Ray Data for application-level fault
tolerance. A more detailed proposal can be found on this Ray Enhancement
Proposal (ray-project/enhancements#74)

A task serves at most one reconstruction plan here; batching several
plans onto one seed re-execution is a follow-up PR.



## Additional Information
I've broken down the changes introduced in this PR at a higher level
below.

### Concepts

This is a representation of block lineage and how it dictates which
tasks need to be submitted for reconstruction.

<img width="3045" height="1400" alt="lineage_diagram"
src="https://github.com/user-attachments/assets/b7164ae8-369e-4b68-87c2-665fe253bcca"
/>

As seen in the sketch above, lineage for a fan-out pipeline results in
certain blocks being pruned as they are not required to reconstruct the
lost object(s). Conversely, fan-in pipelines require a number of
ancestor blocks to be reconstructed. This has a direct impact on the
number of re-submitted tasks with Data lineage reconstruction.

At a high level, the sketch below shows that lineage reconstruction and
regular Ray Data task execution run in tandem during a pipeline. The
main ideas to grasp are the following:
- Blocks that are emitted by reconstruction tasks that are NOT part of a
lost block's lineage are pruned, or NOT propagated downstream
- Blocks produced by reconstruction tasks that are part of a lost
block's lineage are withheld in a separate data structure (while
accounting for their resource usage). When all reconstruction blocks in
a dependency set are ready, they are bundled and added to the operator
outqueue for a child reconstruction task to consume
<img width="1946" height="1626" alt="fan_in_fan_out_LR"
src="https://github.com/user-attachments/assets/9f1ecda1-cb38-48f7-a1f4-08f4e840e9d6"
/>



#### Building the lineage graph while the dataset executes


1. A `LineageTracker` instance is declared for the DAG's streaming
executor
2. An operator that reads directly from an `InputDataBuffer` is a 'seed'
operator. Its input is durable and resubmittable (a
`ReadTask`/`FileManifest`, or the data itself for `from_*`), so it
retains that bundle in a map in case it ever needs to re-submit seed
tasks. The tracker stores IDs, never actual `RefBundle`s.
3. **On task submission**:`MapOperator._submit_data_task` registers any
task to be submitted with the `LineageTracker`, keeping track of whether
it's a fresh task or a reconstruction task, and assigning it a logical
Ray Data task ID
- A producing task registers each block that is produced with the
`LineageTracker`, via `_output_ready_callback`. Specifically, a tuple of
(producing task logical ID, output index). A consuming task during
submission time (3.) looks up the above dependencies to add edges in the
lineage graph
5. **On task completion**: The `LineageTracker` marks the task in the
graph as complete.



#### Triggering lineage reconstruction when any output block is lost
1. The callback `DataOpTask.on_data_ready` catches an `ObjectLostError`,
and triggers data lineage reconstruction
2. The `LineageTracker` traces the lost object's lineage, back to its
seed task, and opens a reconstruction plan for it (or folds to an
existing plan, if already open)
3. The streaming executor aborts the lost task so its operator releases
resources, these will be requested again by the triggered reconstruction
tasks
4. The streaming executor also clears the completion state for the DAG
(if necessary), and re-submits the seed task.

#### Managing reconstructed blocks
1. As each reconstruction task emits blocks, check the reuse status of
each block. `NEW` flows downstream as usual, `PRUNED`/`UNRELATED` is
dropped these are not required to reconstruct lost objects, and `REUSED`
is
withheld so that it can be passed along to following reconstruction
tasks
2. For a fan-in, the withheld objects must be released together, so that
a downstream reconstruction task can accept inputs exactly as in its
original attempt (maintaining the same order of blocks)


### Known Limitations in Current Implementation
- No batching of seed tasks (if multiple reconstruction plans can be
served by a single seed task). This is explicitly addressed in a follow
up PR to enable batching of reconstruction plans.
- Blocks lost after they're handed to an iterator (`iter_batches`,
`iter_rows`, `take`, `take_all`) aren't reconstructed. This is going to
be addressed as part of a follow up effort to integrate external
consumers (e.g. Ray Train) with Data FT
- No support for DAGs with shuffles. Lineage reconstruction for
pipelines with `AllToAllOperator` / shuffles in the DAG needs to be
scoped. We will work on this in the future.

---------

Signed-off-by: Ayush Kumar <[email protected]>
Signed-off-by: Ayush Kumar <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues 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