Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Full traceback call stack on broad exception handling. #157

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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