Skip to content

Sentry Ray integration is broken #5225

@khoover

Description

@khoover

How do you use Sentry?

Sentry Saas (sentry.io)

Version

2.47.0

Steps to Reproduce

  1. Initialize sentry with the ray integration.
  2. Decorate a class with @ray.remote(max_restarts=-1).

Expected Result

We get a Ray Actor class.

Actual Result

new_remote checks if @ray.remote is applied directly to a class, but if you give it options then the def wrapper(user_f): doesn't check if user_f is a class or not, leading to wrapping actor classes as functions.

File “/app/.venv/lib/python3.13/site-packages/ray/data/_internal/execution/node_trackers/actor_location.py”, line 8, in <module>
’@ray.remote(num_cpus=0, max_restarts=-1, max_task_retries=-1)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/app/.venv/lib/python3.13/site-packages/sentry_sdk/integrations/ray.py”, line 98, in wrapper
rv = old_remote(*args, **kwargs)(new_func)
File “/app/.venv/lib/python3.13/site-packages/ray/_private/worker.py”, line 3368, in _make_remote
ray_option_utils.validate_task_options(options, in_options=False)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/app/.venv/lib/python3.13/site-packages/ray/_common/ray_option_utils.py”, line 329, in validate_task_options
raise ValueError(
...<2 lines>...
)
ValueError: Invalid option keyword max_restarts for remote functions. Valid ones are [‘label_selector’, ‘fallback_strategy’, ‘accelerator_type’, ‘memory’, ‘name’, ‘num_cpus’, ‘num_gpus’, ‘object_store_memory’, ‘placement_group’, ‘placement_group_bundle_index’, ‘placement_group_capture_child_tasks’, ‘resources’, ‘runtime_env’, ‘scheduling_strategy’, ‘enable_task_events’, ‘_labels’, ‘max_calls’, ‘max_retries’, ‘num_returns’, ‘retry_exceptions’, ‘_generator_backpressure_num_objects’].

Metadata

Metadata

Labels

Projects

Status

Waiting for: Product Owner

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions