Skip to content

Commit

Permalink
Full traceback call stack on broad exception handling. (#157)
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandr-mokrov authored Aug 19, 2021
1 parent 38bac04 commit 6c4879e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
11 changes: 5 additions & 6 deletions openfl/component/envoy/envoy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def run(self):
experiment_name = self.director_client.wait_experiment()
data_stream = self.director_client.get_experiment_data(experiment_name)
except Exception as exc:
logger.error(f'Failed to get experiment: {exc}')
logger.exception(f'Failed to get experiment: {exc}')
time.sleep(DEFAULT_RETRY_TIMEOUT_IN_SECONDS)
continue
data_file_path = self._save_data_stream_to_file(data_stream)
Expand All @@ -65,9 +65,9 @@ def run(self):
with ExperimentWorkspace(
experiment_name, data_file_path, is_install_requirements=True
):
self._run_collaborator(experiment_name)
self._run_collaborator()
except Exception as exc:
logger.error(f'Collaborator failed: {exc}')
logger.exception(f'Collaborator failed with error: {exc}:')
finally:
# Workspace cleaning should not be done by gRPC client!
self.is_experiment_running = False
Expand All @@ -94,7 +94,7 @@ def send_health_check(self):
)
time.sleep(DEFAULT_TIMEOUT_IN_SECONDS / 2)

def _run_collaborator(self, experiment_name, plan='plan/plan.yaml', ):
def _run_collaborator(self, plan='plan/plan.yaml'):
"""Run the collaborator for the experiment running."""
plan = Plan.parse(plan_config_path=Path(plan))

Expand All @@ -111,8 +111,7 @@ def start(self):
try:
is_accepted = self.director_client.report_shard_info(self.shard_descriptor)
except Exception as exc:
logger.exception(str(exc))
logger.exception('Failed to report shard info')
logger.exception(f'Failed to report shard info: {exc}')
else:
if is_accepted:
# Shard accepted for participation in the federation
Expand Down
6 changes: 3 additions & 3 deletions openfl/federated/plan/plan.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,9 @@ def parse(plan_config_path: Path, cols_config_path: Path = None,
return plan

except Exception:
Plan.logger.error(f'Parsing Federated Learning Plan : '
f'[red]FAILURE[/] : [blue]{plan_config_path}[/].',
extra={'markup': True})
Plan.logger.exception(f'Parsing Federated Learning Plan : '
f'[red]FAILURE[/] : [blue]{plan_config_path}[/].',
extra={'markup': True})
raise

@staticmethod
Expand Down
2 changes: 1 addition & 1 deletion openfl/interface/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,7 +396,7 @@ def dockerize_(context, base_image, save):
dockerfile=dockerfile_workspace)

except Exception as e:
echo('Faild to build the image\n' + str(e) + '\n')
echo('Failed to build the image\n' + str(e) + '\n')
sys.exit(1)
else:
echo('The workspace image has been built successfully!')
Expand Down

0 comments on commit 6c4879e

Please sign in to comment.