Curator icon indicating copy to clipboard operation
Curator copied to clipboard

Deduplication without a running Ray cluster fails with only "Failed to look up actor"

Open hzmsh opened this issue 1 month ago • 0 comments

Describe the bug

Running fuzzy or exact deduplication (or calling create_id_generator_actor()) without a Ray cluster already running fails with Ray's generic Failed to look up actor error. The message doesn't say that a Ray cluster has to be started first, so users have opened issues about it and were told there to start a cluster first (#1216, #1292); the reporter of #1292 also asked for "a more meaningful error message".

Starting the cluster first is the intended usage, as explained in #1216, and the tutorials now do it. This issue is only about the error message for people who miss that step.

Steps/Code to reproduce bug

from nemo_curator.stages.deduplication.id_generator import create_id_generator_actor, get_id_generator_actor

create_id_generator_actor()  # no Ray cluster is running yet
get_id_generator_actor()

Output on main (09c8a1c):

ValueError: Failed to look up actor with name 'curator_deduplication_id_generator'. This could because 1. You are trying to look up a named actor you didn't create. 2. The named actor died. 3. You did not use a namespace matching the namespace of the actor.

TextDuplicatesRemovalWorkflow(id_generator_path=...).run() without a cluster ends with the same error.

Expected behavior

An error that says the actor needs a Ray cluster that is already running, and how to start one, similar to the message added for resumability in #2063 ("start one with RayClient().start()").

Additional context

Why it happens

  • create_id_generator_actor() calls ray.init(), creates the detached actor, and then calls ray.shutdown() (id_generator.py#L106-L132). If no cluster is running in a separate process, ray.init() starts a local one in this process (or reuses one the script started with ray.init()), and ray.shutdown() stops it, which removes the actor too.
  • The next get_id_generator_actor() call can't find it and raises Ray's message (L89-L90). In TextDuplicatesRemovalWorkflow, this happens in kill_id_generator_actor() in the finally block (removal_workflow.py#L203-L213), so this is the error the user sees in the end. From reading the code, the fuzzy and exact workflows do the same (they need a GPU, so I only ran the removal workflow).

Suggested fix

  • In get_id_generator_actor(), catch the ValueError and raise a new ValueError with a clearer message (create the actor while a Ray cluster is running in a separate process, for example one started with RayClient().start()), chained to Ray's original error.
  • Keeping the type means callers that already catch ValueError (BaseReader.setup(), MinHashStage, ExactDuplicateIdentification) behave as before. This doesn't change when or how the actor is created.

Environment: main (09c8a1c), Python 3.11.17, Ray 2.57.0, Ubuntu 20.04 on WSL2, CPU only.

I have a small fix with a test ready and will open a PR today. Thank you for taking a look!

AI assistance: Co-found and drafted with Claude Code (Claude Opus 5.5). The output above is from running the script on main (09c8a1c9).

hzmsh avatar Oct 19 '26 01:10 hzmsh