From e446e00ce18512b2c8b34896fbee88006882705b Mon Sep 17 00:00:00 2001 From: Reid Mello <30907815+rjmello@users.noreply.github.com> Date: Tue, 24 Oct 2023 18:01:49 -0400 Subject: [PATCH] Change `heartbeat_period` type from float to int --- ..._30907815+rjmello_engine_heartbeat_period_int.rst | 6 ++++++ .../globus_compute_endpoint/engines/base.py | 2 +- .../engines/globus_compute.py | 2 +- .../globus_compute_endpoint/engines/process_pool.py | 2 +- .../globus_compute_endpoint/engines/thread_pool.py | 2 +- .../endpoint/endpoint/test_interchange.py | 12 ++++++------ 6 files changed, 16 insertions(+), 10 deletions(-) create mode 100644 changelog.d/20231024_175842_30907815+rjmello_engine_heartbeat_period_int.rst diff --git a/changelog.d/20231024_175842_30907815+rjmello_engine_heartbeat_period_int.rst b/changelog.d/20231024_175842_30907815+rjmello_engine_heartbeat_period_int.rst new file mode 100644 index 000000000..bb34cb4d7 --- /dev/null +++ b/changelog.d/20231024_175842_30907815+rjmello_engine_heartbeat_period_int.rst @@ -0,0 +1,6 @@ +Changed +^^^^^^^ + +- Changed ``heartbeat_period`` type from float to int for ``GlobusComputeEngine``, + ``ProcessPoolEngine``, and ``ThreadPoolEngine`` to maintain parity with the + ``HighThroughputEngine`` and Parsl's ``HighThroughputExecutor``. \ No newline at end of file diff --git a/compute_endpoint/globus_compute_endpoint/engines/base.py b/compute_endpoint/globus_compute_endpoint/engines/base.py index ee08a429c..df09bd3ac 100644 --- a/compute_endpoint/globus_compute_endpoint/engines/base.py +++ b/compute_endpoint/globus_compute_endpoint/engines/base.py @@ -75,7 +75,7 @@ class GlobusComputeEngineBase(ABC): def __init__( self, *args: object, - heartbeat_period: float = 30.0, + heartbeat_period: int = 30, endpoint_id: t.Optional[uuid.UUID] = None, **kwargs: object, ): diff --git a/compute_endpoint/globus_compute_endpoint/engines/globus_compute.py b/compute_endpoint/globus_compute_endpoint/engines/globus_compute.py index c70d7e815..0d6c2ff31 100644 --- a/compute_endpoint/globus_compute_endpoint/engines/globus_compute.py +++ b/compute_endpoint/globus_compute_endpoint/engines/globus_compute.py @@ -25,7 +25,7 @@ def __init__( *args, label: str = "GlobusComputeEngine", address: t.Optional[str] = None, - heartbeat_period: float = 30.0, + heartbeat_period: int = 30, strategy: t.Optional[SimpleStrategy] = SimpleStrategy(), executor: t.Optional[HighThroughputExecutor] = None, **kwargs, diff --git a/compute_endpoint/globus_compute_endpoint/engines/process_pool.py b/compute_endpoint/globus_compute_endpoint/engines/process_pool.py index a269e701e..d78b05746 100644 --- a/compute_endpoint/globus_compute_endpoint/engines/process_pool.py +++ b/compute_endpoint/globus_compute_endpoint/engines/process_pool.py @@ -26,7 +26,7 @@ def __init__( self, *args, label: str = "ProcessPoolEngine", - heartbeat_period: float = 30.0, + heartbeat_period: int = 30, **kwargs, ): self.label = label diff --git a/compute_endpoint/globus_compute_endpoint/engines/thread_pool.py b/compute_endpoint/globus_compute_endpoint/engines/thread_pool.py index 6ae375c35..403c5890a 100644 --- a/compute_endpoint/globus_compute_endpoint/engines/thread_pool.py +++ b/compute_endpoint/globus_compute_endpoint/engines/thread_pool.py @@ -26,7 +26,7 @@ def __init__( self, *args, label: str = "ThreadPoolEngine", - heartbeat_period: float = 30.0, + heartbeat_period: int = 30, **kwargs, ): self.label = label diff --git a/compute_endpoint/tests/integration/endpoint/endpoint/test_interchange.py b/compute_endpoint/tests/integration/endpoint/endpoint/test_interchange.py index ab3bab475..e83fea14b 100644 --- a/compute_endpoint/tests/integration/endpoint/endpoint/test_interchange.py +++ b/compute_endpoint/tests/integration/endpoint/endpoint/test_interchange.py @@ -168,7 +168,7 @@ def test_no_idle_if_not_configured(mocker, endpoint_uuid, mock_spt): conf = Config( executors=[mocker.Mock(endpoint_id=endpoint_uuid)], - heartbeat_period=0.01, + heartbeat_period=1, idle_heartbeats_soft=0, ) ei = EndpointInterchange( @@ -191,7 +191,7 @@ def test_soft_idle_honored(mocker, endpoint_uuid, mock_spt): conf = Config( executors=[mocker.Mock(endpoint_id=endpoint_uuid)], - heartbeat_period=0.1, + heartbeat_period=1, idle_heartbeats_soft=3, ) ei = EndpointInterchange( @@ -229,7 +229,7 @@ def test_hard_idle_honored(mocker, endpoint_uuid, mock_spt): conf = Config( executors=[mocker.Mock(endpoint_id=endpoint_uuid)], - heartbeat_period=0.1, + heartbeat_period=1, idle_heartbeats_soft=1, idle_heartbeats_hard=3, ) @@ -265,7 +265,7 @@ def test_unidle_updates_proc_title(mocker, endpoint_uuid, mock_spt): conf = Config( executors=[mocker.Mock(endpoint_id=endpoint_uuid)], - heartbeat_period=0.1, + heartbeat_period=1, idle_heartbeats_soft=1, idle_heartbeats_hard=3, ) @@ -302,7 +302,7 @@ def test_sends_final_status_message_on_shutdown(mocker, endpoint_uuid): conf = Config( executors=[mocker.Mock(endpoint_id=endpoint_uuid)], - heartbeat_period=0.01, + heartbeat_period=1, idle_heartbeats_soft=1, idle_heartbeats_hard=2, ) @@ -327,7 +327,7 @@ def test_faithfully_handles_status_report_messages(mocker, endpoint_uuid, random conf = Config( executors=[mocker.Mock(endpoint_id=endpoint_uuid)], - heartbeat_period=0.01, + heartbeat_period=1, ) ei = EndpointInterchange( endpoint_id=endpoint_uuid,