Skip to content

Commit

Permalink
more comprehensive logging
Browse files Browse the repository at this point in the history
  • Loading branch information
arseniiarsenii committed Apr 18, 2022
1 parent cde1f18 commit 6765a71
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "Feecc-Workbench-Daemon"
version = "1.1.4"
version = "1.1.5"
description = "Workbench software for the Feecc QA system"
authors = ["arseniiarsenii <arseniivelichko2@gmail.com>"]
license = "Apache 2.0"
Expand Down
8 changes: 8 additions & 0 deletions src/feecc_workbench/WorkBench.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ def switch_state(self, new_state: State) -> None:
logger.info(f"Workbench no.{self.number} state changed: {self.state.value} -> {new_state.value}")
self.state = new_state

@logger.catch(reraise=True)
def log_in(self, employee: Employee) -> None:
"""authorize employee"""
self._validate_state_transition(State.AUTHORIZED_IDLING_STATE)
Expand All @@ -83,6 +84,7 @@ def log_in(self, employee: Employee) -> None:

self.switch_state(State.AUTHORIZED_IDLING_STATE)

@logger.catch(reraise=True)
def log_out(self) -> None:
"""log out the employee"""
self._validate_state_transition(State.AWAIT_LOGIN_STATE)
Expand All @@ -95,6 +97,7 @@ def log_out(self) -> None:

self.switch_state(State.AWAIT_LOGIN_STATE)

@logger.catch(reraise=True)
def assign_unit(self, unit: Unit) -> None:
"""assign a unit to the workbench"""
self._validate_state_transition(State.UNIT_ASSIGNED_IDLING_STATE)
Expand All @@ -113,6 +116,7 @@ def assign_unit(self, unit: Unit) -> None:
else:
self.switch_state(State.UNIT_ASSIGNED_IDLING_STATE)

@logger.catch(reraise=True)
def remove_unit(self) -> None:
"""remove a unit from the workbench"""
self._validate_state_transition(State.AUTHORIZED_IDLING_STATE)
Expand All @@ -123,6 +127,7 @@ def remove_unit(self) -> None:

self.switch_state(State.AUTHORIZED_IDLING_STATE)

@logger.catch(reraise=True)
async def start_operation(self, additional_info: AdditionalInfo) -> None:
"""begin work on the provided unit"""
self._validate_state_transition(State.PRODUCTION_STAGE_ONGOING_STATE)
Expand All @@ -136,6 +141,7 @@ async def start_operation(self, additional_info: AdditionalInfo) -> None:

self.switch_state(State.PRODUCTION_STAGE_ONGOING_STATE)

@logger.catch(reraise=True)
async def assign_component_to_unit(self, component: Unit) -> None:
"""assign provided component to a composite unit"""
assert (
Expand All @@ -150,6 +156,7 @@ async def assign_component_to_unit(self, component: Unit) -> None:

self.switch_state(State.UNIT_ASSIGNED_IDLING_STATE)

@logger.catch(reraise=True)
async def end_operation(self, additional_info: tp.Optional[AdditionalInfo] = None, premature: bool = False) -> None:
"""end work on the provided unit"""
self._validate_state_transition(State.UNIT_ASSIGNED_IDLING_STATE)
Expand Down Expand Up @@ -182,6 +189,7 @@ async def end_operation(self, additional_info: tp.Optional[AdditionalInfo] = Non

self.switch_state(State.UNIT_ASSIGNED_IDLING_STATE)

@logger.catch(reraise=True)
async def upload_unit_passport(self) -> None:
"""upload passport file into IPFS and pin it to Pinata, publish hash to Robonomics"""
assert self.unit is not None, "No unit is assigned to the workbench"
Expand Down

0 comments on commit 6765a71

Please sign in to comment.