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

🔃 REFACTOR: Move Scheduler/Transport behind Client API #5901

Closed
wants to merge 14 commits into from
Closed
2 changes: 1 addition & 1 deletion .github/workflows/tests_nightly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ verdi -p test_aiida run ${SYSTEM_TESTS}/test_containerized_code.py
bash ${SYSTEM_TESTS}/test_polish_workchains.sh
verdi daemon stop

AIIDA_TEST_PROFILE=test_aiida pytest -v tests -m 'nightly'
AIIDA_TEST_PROFILE=test_aiida pytest -v tests -m 'nightly' --timeout=200
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,6 @@ repos:
aiida/common/extendeddicts.py|
aiida/common/hashing.py|
aiida/common/utils.py|
aiida/engine/daemon/execmanager.py|
aiida/engine/processes/calcjobs/manager.py|
aiida/engine/processes/calcjobs/monitors.py|
aiida/engine/processes/calcjobs/tasks.py|
aiida/engine/processes/control.py|
aiida/engine/processes/functions.py|
aiida/engine/processes/ports.py|
Expand All @@ -120,7 +116,6 @@ repos:
aiida/manage/tests/main.py|
aiida/manage/tests/pytest_fixtures.py|
aiida/orm/comments.py|
aiida/orm/computers.py|
aiida/orm/implementation/storage_backend.py|
aiida/orm/nodes/caching.py|
aiida/orm/nodes/comments.py|
Expand All @@ -137,7 +132,6 @@ repos:
aiida/orm/utils/builders/computer.py|
aiida/orm/utils/calcjob.py|
aiida/orm/utils/node.py|
aiida/orm/utils/remote.py|
aiida/repository/backend/disk_object_store.py|
aiida/repository/backend/sandbox.py|
aiida/restapi/common/utils.py|
Expand Down
4 changes: 2 additions & 2 deletions aiida/calculations/importers/arithmetic/add.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ def parse_remote_data(remote_data: RemoteData, **kwargs) -> Dict[str, Union[Node
:returns: a dictionary with the parsed inputs nodes that match the input spec of the associated ``CalcJob``.
"""
with NamedTemporaryFile('w+') as handle:
with remote_data.get_authinfo().get_transport() as transport:
with remote_data.get_client() as client:
filepath = Path(remote_data.get_remote_path()) / 'aiida.in'
transport.getfile(filepath, handle.name)
client.getfile(str(filepath), handle.name)

handle.seek(0)
data = handle.read()
Expand Down
8 changes: 4 additions & 4 deletions aiida/calculations/monitors/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@

import tempfile

from aiida.client import ComputeClientOpenProtocol
from aiida.orm import CalcJobNode
from aiida.transports import Transport


def always_kill(node: CalcJobNode, transport: Transport) -> str | None: # pylint: disable=unused-argument
def always_kill(node: CalcJobNode, client: ComputeClientOpenProtocol) -> str | None: # pylint: disable=unused-argument
"""Retrieve and inspect files in working directory of job to determine whether the job should be killed.

This particular implementation is just for demonstration purposes and will kill the job as long as there is a
submission script that contains some content, which should always be the case.

:param node: The node representing the calculation job.
:param transport: The transport that can be used to retrieve files from remote working directory.
:param client: The client that can be used to retrieve files from remote working directory.
:returns: A string if the job should be killed, `None` otherwise.
"""
with tempfile.NamedTemporaryFile('w+') as handle:
transport.getfile('_aiidasubmit.sh', handle.name)
client.getfile('_aiidasubmit.sh', handle.name)
handle.seek(0)
output = handle.read()

Expand Down
5 changes: 5 additions & 0 deletions aiida/client/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# -*- coding: utf-8 -*-
"""Module containing compute clients."""
from .protocol import ComputeClientOpenProtocol, ComputeClientProtocol

__all__ = ['ComputeClientProtocol', 'ComputeClientOpenProtocol']
Loading