Skip to content

Commit

Permalink
Add ray initialization in sea action __call__ as a fail safe.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboulware committed Mar 5, 2024
1 parent 6df86d0 commit 3f7b554
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions scos_actions/actions/acquire_sea_data_product.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 3f7b554

Please sign in to comment.