From 3f7b554140667a8944e8a7edbf92233449b3c8d9 Mon Sep 17 00:00:00 2001 From: Doug Boulware Date: Tue, 5 Mar 2024 07:20:26 -0700 Subject: [PATCH] Add ray initialization in sea action __call__ as a fail safe. --- scos_actions/actions/acquire_sea_data_product.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scos_actions/actions/acquire_sea_data_product.py b/scos_actions/actions/acquire_sea_data_product.py index e0120c53..20a684da 100644 --- a/scos_actions/actions/acquire_sea_data_product.py +++ b/scos_actions/actions/acquire_sea_data_product.py @@ -504,6 +504,13 @@ def __call__(self, sensor: Sensor, schedule_entry: dict, task_id: int): """This is the entrypoint function called by the scheduler.""" self._sensor = sensor action_start_tic = perf_counter() + # Ray should have already been initialized within scos-sensor, + # but check and initialize just in case. + if not ray.is_initialized(): + logger.info("Initializing ray.") + logger.info("Set RAY_INIT=true to avoid initializing within " + __name__) + # Dashboard is only enabled if ray[default] is installed + ray.init() _ = psutil.cpu_percent(interval=None) # Initialize CPU usage monitor self.test_required_components()