Skip to content

Commit

Permalink
replace echo_error with echo_critical
Browse files Browse the repository at this point in the history
  • Loading branch information
agoscinski committed May 24, 2024
1 parent cdce925 commit 6a71ae0
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/aiida/cmdline/commands/cmd_computer.py
Original file line number Diff line number Diff line change
Expand Up @@ -787,23 +787,20 @@ def computer_export_config(computer, user, output_file):
from aiida.orm import User

if not computer.is_configured:
echo.echo_error(
echo.echo_critical(
f'Computer<{computer.pk}> {computer.label} configuration cannot be exported,'
' because computer has not been configured yet.'
)
else:
try:
if user is None:
user = User.collection.get_default()
computer_configuration = computer.get_configuration(user)
output_file.write_text(yaml.dump(computer_configuration, sort_keys=True), 'utf-8')
echo.echo_success(
f"Computer<{computer.pk}> {computer.label} configuration exported to file '{output_file}'."
)
except Exception as e:
error_traceback = traceback.format_exc()
echo.CMDLINE_LOGGER.debug(error_traceback)
echo.echo_critical(
f'Unexpected error while exporting configuration for Computer<{computer.pk}> {computer.label}'
f' and User<{user.pk}> {user.email}: {e!s}.'
)
try:
if user is None:
user = User.collection.get_default()
computer_configuration = computer.get_configuration(user)
output_file.write_text(yaml.dump(computer_configuration, sort_keys=True), 'utf-8')
echo.echo_success(f"Computer<{computer.pk}> {computer.label} configuration exported to file '{output_file}'.")
except Exception as e:
error_traceback = traceback.format_exc()
echo.CMDLINE_LOGGER.debug(error_traceback)
echo.echo_critical(
f'Unexpected error while exporting configuration for Computer<{computer.pk}> {computer.label}'
f' and User<{user.pk}> {user.email}: {e!s}.'
)

0 comments on commit 6a71ae0

Please sign in to comment.