Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sphuber committed Mar 20, 2024
1 parent aec4a35 commit 655fcf0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
15 changes: 1 addition & 14 deletions src/aiida/cmdline/commands/cmd_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,21 +240,8 @@ def export(code, output_file):
"""Export code to a yaml file."""
import yaml

code_data = {}

for key in code.Model.model_fields.keys():
if key == 'computer':
value = getattr(code, key).label
else:
value = getattr(code, key)

# If the attribute is not set, for example ``with_mpi`` do not export it, because the YAML won't be valid for
# use in ``verdi code create`` since ``None`` is not a valid value on the CLI.
if value is not None:
code_data[key] = str(value)

with open(output_file, 'w', encoding='utf-8') as yfhandle:
yaml.dump(code_data, yfhandle)
yaml.dump(code.serialize(), yfhandle)


@verdi_code.command()
Expand Down
2 changes: 2 additions & 0 deletions src/aiida/orm/nodes/data/code/installed.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ class Model(AbstractCode.Model):
...,
title='Computer',
description='The remote computer on which the executable resides.',
orm_to_model=lambda node: node.computer.label,
short_name='-Y',
priority=2,
)
filepath_executable: str = MetadataField(
...,
title='Filepath executable',
description='Filepath of the executable on the remote computer.',
orm_to_model=lambda node: str(node.filepath_executable), # type: ignore[attr-defined]
short_name='-X',
priority=1,
)
Expand Down

0 comments on commit 655fcf0

Please sign in to comment.