Source code for fedn.clients.reducer.state
from enum import Enum
[docs]class ReducerState(Enum):
setup = 1
idle = 2
instructing = 3
monitoring = 4
[docs]def ReducerStateToString(state):
"""
:param state:
:return:
"""
if state == ReducerState.setup:
return "setup"
if state == ReducerState.idle:
return "idle"
if state == ReducerState.instructing:
return "instructing"
if state == ReducerState.monitoring:
return "monitoring"
return "UNKNOWN"
[docs]def StringToReducerState(state):
"""
:param state:
:return:
"""
if state == "setup":
return ReducerState.setup
if state == "idle":
return ReducerState.idle
elif state == "instructing":
return ReducerState.instructing
elif state == "monitoring":
return ReducerState.monitoring