Regenerate heartbeat by setting heartbeat_liveness instead of HEARTBEAT_LIVENESS #2977
+5
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, the heartbeat_liveness parameter is used only to initialize value self.heartbeat.
After receiving a heartbeat value is set to HEARTBEAT_LIVENESS:
c.heartbeat = HEARTBEAT_LIVENESS
.I guess that original motivation to add this parameter was to give possibility to adjust how many missing heartbeats WorkerNode is considered missing.
To obtain this aim, value after regeneration should be equal to value passed to the constructor.
Another possible solution: complete removal of the heartbeat_liveness parameter from constructor.
Motivation behind change
self._local_worker_node = WorkerNode(id="local", heartbeat_liveness=HEARTBEAT_LIVENESS)
— default value of constructor parameter is evaluated during function creation but value HEARTBEAT_LIVENESS can change after that.