Skip to content

Commit

Permalink
Disable Ray progress bar by default.
Browse files Browse the repository at this point in the history
Currently the Ray progress bar doesn't update correctly due to this
issue: ray-project/ray#44983. Until that is
fixed, we disable the progress bar by default. You can explicitly
enable by passing enable_progress_bars=True in the sycamore.init function.
  • Loading branch information
bsowell committed Jun 19, 2024
1 parent b0e3eca commit 56e94aa
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/sycamore/sycamore/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@
from typing import Any, Optional

import ray
import ray.data

from sycamore.rules import Rule


class Context:
def __init__(self, ray_args: Optional[dict[str, Any]] = None):
def __init__(self, ray_args: Optional[dict[str, Any]] = None, enable_progress_bars=False):
if ray_args is None:
ray_args = {}

Expand All @@ -17,6 +18,9 @@ def __init__(self, ray_args: Optional[dict[str, Any]] = None):

ray.init(**ray_args)

# Disable progress bars by default while https://github.com/ray-project/ray/issues/44983 is open.
ray.data.DataContext.get_current().enable_progress_bars = enable_progress_bars

self.extension_rules: list[Rule] = []
self._internal_lock = threading.Lock()

Expand Down Expand Up @@ -44,7 +48,7 @@ def deregister_rule(self, rule: Rule) -> None:
_global_context: Optional[Context] = None


def init(ray_args: Optional[dict[str, Any]] = None) -> Context:
def init(ray_args: Optional[dict[str, Any]] = None, enable_progress_bars=False) -> Context:
global _global_context
with _context_lock:
if _global_context is None:
Expand All @@ -57,6 +61,6 @@ def init(ray_args: Optional[dict[str, Any]] = None) -> Context:

sycamore_logger.setup_logger()

_global_context = Context(ray_args)
_global_context = Context(ray_args, enable_progress_bars=enable_progress_bars)

return _global_context

0 comments on commit 56e94aa

Please sign in to comment.