Skip to content

Commit e477665

Browse files
committed
DOC and TEST: containerized code how to set and how to use
pytest fix Add more docs in data_types Use localhost to test add-docker container
1 parent b833510 commit e477665

13 files changed

Lines changed: 237 additions & 26 deletions

File tree

.github/config/add.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
label: add
33
description: add
4-
default_calc_job_plugin: core.arithmetic.add
4+
input_plugin: core.arithmetic.add
55
on_computer: true
66
computer: localhost
7-
filepath_executable: /bin/bash
7+
remote_abs_path: /bin/bash
88
prepend_text: ' '
99
append_text: ' '

.github/config/doubler.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
label: doubler
33
description: doubler
4-
default_calc_job_plugin: core.templatereplacer
4+
input_plugin: core.templatereplacer
55
on_computer: true
66
computer: localhost
7-
filepath_executable: PLACEHOLDER_REMOTE_ABS_PATH_DOUBLER
7+
remote_abs_path: PLACEHOLDER_REMOTE_ABS_PATH_DOUBLER
88
prepend_text: ' '
99
append_text: ' '

.github/system_tests/test_containerized_code.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
1-
import os
1+
# -*- coding: utf-8 -*-
2+
###########################################################################
3+
# Copyright (c), The AiiDA team. All rights reserved. #
4+
# This file is part of the AiiDA code. #
5+
# #
6+
# The code is hosted on GitHub at https://github.com/aiidateam/aiida-core #
7+
# For further information on the license, see the LICENSE.txt file #
8+
# For further information please visit http://www.aiida.net #
9+
###########################################################################
10+
"""Test run on containrized code."""
211
from aiida import orm
312
from aiida.engine import run_get_node
413
from aiida.plugins import CalculationFactory
514

6-
ArithmeticAddCalculation = CalculationFactory('core.arithmetic.add')
15+
ArithmeticAddCalculation = CalculationFactory('core.arithmetic.add')
716

817
inputs = {
918
'code': orm.load_code('add-docker@localhost'),

.github/workflows/setup.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ verdi setup --non-interactive --config "${CONFIG}/profile.yaml"
2121
verdi computer setup --non-interactive --config "${CONFIG}/localhost.yaml"
2222
verdi computer configure core.local localhost --config "${CONFIG}/localhost-config.yaml"
2323
verdi computer test localhost
24-
verdi code create core.code.installed --non-interactive --config "${CONFIG}/doubler.yaml"
25-
verdi code create core.code.installed --non-interactive --config "${CONFIG}/add.yaml"
24+
verdi code setup --non-interactive --config "${CONFIG}/doubler.yaml"
25+
verdi code setup --non-interactive --config "${CONFIG}/add.yaml"
2626
verdi code create core.code.installed.containerized --non-interactive --config "${CONFIG}/add-docker.yaml"
2727

2828
# set up slurm-ssh computer

.github/workflows/tests_nightly.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ export PYTHONPATH="${PYTHONPATH}:${SYSTEM_TESTS}:${MODULE_POLISH}"
99

1010
verdi daemon start 4
1111
verdi -p test_aiida run ${SYSTEM_TESTS}/test_daemon.py
12-
docker version | echo
1312
verdi -p test_aiida run ${SYSTEM_TESTS}/test_containerized_code.py
1413
bash ${SYSTEM_TESTS}/test_polish_workchains.sh
1514
verdi daemon stop

aiida/engine/daemon/execmanager.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from aiida.common.links import LinkType
3030
from aiida.manage.configuration import get_config_option
3131
from aiida.orm import CalcJobNode, Code, FolderData, Node, PortableCode, RemoteData, load_node
32-
from aiida.orm.nodes.data.code.containerized import PortableContainerizedCode
3332
from aiida.orm.utils.log import get_dblogger_extra
3433
from aiida.repository.common import FileType
3534
from aiida.schedulers.datastructures import JobState

aiida/engine/processes/calcjobs/calcjob.py

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
from aiida.common.folders import Folder
2525
from aiida.common.lang import classproperty, override
2626
from aiida.common.links import LinkType
27-
from aiida.orm.nodes.data.code.containerized import Containerized, PortableContainerizedCode
27+
from aiida.orm.nodes.data.code.containerized import Containerized
2828
from aiida.orm.utils.loaders import load_code
2929

3030
from ..exit_code import ExitCode
@@ -617,15 +617,7 @@ def presubmit(self, folder: Folder) -> CalcInfo:
617617
from aiida.common.datastructures import CodeInfo, CodeRunMode
618618
from aiida.common.exceptions import InputValidationError, InvalidOperation, PluginInternalError, ValidationError
619619
from aiida.common.utils import validate_list_of_string_tuples
620-
from aiida.orm import (
621-
AbstractCode,
622-
Code,
623-
Computer,
624-
InstalledCode,
625-
InstalledContainerizedCode,
626-
PortableCode,
627-
load_node,
628-
)
620+
from aiida.orm import AbstractCode, Computer, PortableCode
629621
from aiida.schedulers.datastructures import JobTemplate, JobTemplateCodeInfo
630622

631623
inputs = self.node.base.links.get_incoming(link_type=LinkType.INPUT_CALC)

aiida/orm/nodes/data/code/containerized.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,16 @@ def _get_cli_options(cls) -> dict:
112112
"""Return the CLI options that would allow to create an instance of this class."""
113113
options = {
114114
'engine_command': {
115-
'required': True,
116-
'prompt': 'Engine command',
117-
'help':
118-
'The command to run the container. It must contain the placeholder {image} that will be replaced with the `image_name`.',
119-
'type': click.STRING,
115+
'required':
116+
True,
117+
'prompt':
118+
'Engine command',
119+
'help': (
120+
'The command to run the container. It must contain the placeholder '
121+
'{image} that will be replaced with the `image_name`.'
122+
),
123+
'type':
124+
click.STRING,
120125
},
121126
'image': {
122127
'required': True,

aiida/schedulers/scheduler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,7 @@ def _get_run_line(self, codes_info, codes_run_mode):
214214
to launch the multiple codes.
215215
:return: string with format: [executable] [args] {[ < stdin ]} {[ < stdout ]} {[2>&1 | 2> stderr]}
216216
"""
217+
# pylint: disable=too-many-locals
217218
from aiida.common.datastructures import CodeRunMode
218219

219220
list_of_runlines = []

docs/source/howto/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ How-To Guides
88
interact
99
plugins_install
1010
run_codes
11+
run_containerized_codes
1112
run_workflows
1213
ssh
1314
plugin_codes

0 commit comments

Comments
 (0)