Obtain the appropriate progress manager for the given DataContext.
(
ctx: "DataContext", dataset_id: str, topology: "Topology", verbose_progress: bool
)
| 14 | |
| 15 | |
| 16 | def get_progress_manager( |
| 17 | ctx: "DataContext", dataset_id: str, topology: "Topology", verbose_progress: bool |
| 18 | ) -> "BaseExecutionProgressManager": |
| 19 | """Obtain the appropriate progress manager for the given DataContext.""" |
| 20 | show_op_progress = ctx.enable_operator_progress_bars |
| 21 | |
| 22 | if not ctx.enable_progress_bars: |
| 23 | from ray.data._internal.progress.base_progress import ( |
| 24 | NoopExecutionProgressManager, |
| 25 | ) |
| 26 | |
| 27 | if log_once("ray_data_progress_manager_disabled"): |
| 28 | logger.warning( |
| 29 | "Progress bars disabled. To enable, set " |
| 30 | "`ray.data.DataContext.get_current()." |
| 31 | "enable_progress_bars = True`." |
| 32 | ) |
| 33 | return NoopExecutionProgressManager( |
| 34 | dataset_id, topology, show_op_progress, verbose_progress |
| 35 | ) |
| 36 | |
| 37 | if not show_op_progress: |
| 38 | if log_once("ray_data_progress_manager_global"): |
| 39 | logger.warning( |
| 40 | "Progress bars for operators disabled. To enable, " |
| 41 | "set `ray.data.DataContext.get_current()." |
| 42 | "enable_operator_progress_bars = True`." |
| 43 | ) |
| 44 | |
| 45 | rich_enabled = ctx.enable_rich_progress_bars |
| 46 | use_ray_tqdm = ctx.use_ray_tqdm |
| 47 | worker = ray._private.worker |
| 48 | in_ray_worker = worker.global_worker.mode == worker.WORKER_MODE |
| 49 | |
| 50 | if not sys.stdout.isatty() and not (use_ray_tqdm and in_ray_worker): |
| 51 | from ray.data._internal.progress.logging_progress import ( |
| 52 | LoggingExecutionProgressManager, |
| 53 | ) |
| 54 | |
| 55 | if log_once("ray_data_logging_progress_activated"): |
| 56 | logger.info( |
| 57 | "Progress will be logged because stdout is a non-interactive terminal." |
| 58 | ) |
| 59 | return LoggingExecutionProgressManager( |
| 60 | dataset_id, topology, show_op_progress, verbose_progress |
| 61 | ) |
| 62 | |
| 63 | if not rich_enabled or use_ray_tqdm: |
| 64 | from ray.data._internal.progress.tqdm_progress import ( |
| 65 | TqdmExecutionProgressManager, |
| 66 | ) |
| 67 | |
| 68 | if log_once("ray_data_rich_progress_disabled"): |
| 69 | logger.info( |
| 70 | "[dataset]: A new progress UI is available. To enable, " |
| 71 | "set `ray.data.DataContext.get_current()." |
| 72 | "enable_rich_progress_bars = True` and `ray.data." |
| 73 | "DataContext.get_current().use_ray_tqdm = False`." |
searching dependent graphs…