Beispiel #1
0
"""

__all__ = ['commandline_operation']

import os
import shutil
import subprocess

import gmxapi as gmx
from gmxapi import exceptions
from gmxapi import logger as root_logger
from gmxapi.datamodel import NDArray
from gmxapi.operation import OutputCollectionDescription

# Module-level logger
logger = root_logger.getChild('commandline')
logger.info('Importing {}'.format(__name__))


# Create an Operation that consumes a list and a boolean to produce a string and an integer.
#
# Wrap the defined function using a decorator that
#    * strips the `output` parameter from the signature
#    * provides `output` publishing proxy to the inner function and
#    * produce a result with attributes for
#       * file: mapping of output flags to output filenames
#       * erroroutput: text results in case of error
#       * returncode: integer return code of wrapped command
#
# Note that the existence of the 'file' output map is expressed here, but
# the keys of the map are not implicit or set by the wrapped function.
Beispiel #2
0
import gmxapi
import gmxapi.abc
import gmxapi.operation as _op
from gmxapi import exceptions

# The following imports are not marked as public API.
from .abc import ModuleObject

from . import fileio
from . import workflow

# Initialize module-level logger
from gmxapi import logger as root_logger

logger = root_logger.getChild('mdrun')
logger.info('Importing {}'.format(__name__))

# Output in the gmxapi.operation Context.
# TODO: Consider using a single base class for the DataProxy, but have distinct
#  data descriptor behavior (or different descriptor implementations in different
#  subclasses) so that static code inspection can more easily determine the
#  attributes of the data proxies.
_output_descriptors = (_op.OutputDataDescriptor('_work_dir', str),
                       _op.OutputDataDescriptor('trajectory', str),
                       _op.OutputDataDescriptor('parameters', dict))
_publishing_descriptors = {
    desc._name: gmxapi.operation.Publisher(desc._name, desc._dtype)
    for desc in _output_descriptors
}
_output = _op.OutputCollectionDescription(**{
Beispiel #3
0
"""
Provide command line operation.
"""

__all__ = ['commandline_operation']

import shutil
import subprocess
from os import devnull

from gmxapi import exceptions
from gmxapi import logger as root_logger
from gmxapi.operation import function_wrapper, concatenate_lists, make_constant

# Module-level logger
logger = root_logger.getChild(__name__)
logger.info('Importing gmxapi.commandline_operation')


# Create an Operation that consumes a list and a boolean to produce a string and an integer.
#
# Wrap the defined function using a decorator that
#    * strips the `output` parameter from the signature
#    * provides `output` publishing proxy to the inner function and
#    * produce a result with attributes for
#       * file: mapping of output flags to output filenames
#       * erroroutput: text results in case of error
#       * returncode: integer return code of wrapped command
#
# Note that the existence of the 'file' output map is expressed here, but
# the keys of the map are not implicit or set by the wrapped function.
Beispiel #4
0
"""
Provide command line operation.
"""

__all__ = ['commandline_operation']

import shutil
import subprocess
from os import devnull

from gmxapi import exceptions
from gmxapi import logger as root_logger
from gmxapi.operation import function_wrapper, concatenate_lists, make_constant

# Module-level logger
logger = root_logger.getChild(__name__)
logger.info('Importing gmxapi.commandline_operation')


# Create an Operation that consumes a list and a boolean to produce a string and an integer.
#
# Wrap the defined function using a decorator that
#    * strips the `output` parameter from the signature
#    * provides `output` publishing proxy to the inner function and
#    * produce a result with attributes for
#       * file: mapping of output flags to output filenames
#       * erroroutput: text results in case of error
#       * returncode: integer return code of wrapped command
#
# Note that the existence of the 'file' output map is expressed here, but
# the keys of the map are not implicit or set by the wrapped function.
Beispiel #5
0
import collections
import inspect
import typing

import gmxapi
import gmxapi.abc
import gmxapi.exceptions
import gmxapi.operation as _op
import gmxapi.typing
from gmxapi.operation import InputCollectionDescription
from .abc import ModuleObject

# Initialize module-level logger
from gmxapi import logger as root_logger

logger = root_logger.getChild('modify_input')
logger.info('Importing {}'.format(__name__))

_output_descriptors = (
    _op.OutputDataDescriptor('_simulation_input', str),
    _op.OutputDataDescriptor('parameters', dict)
)
_publishing_descriptors = {desc._name: gmxapi.operation.Publisher(desc._name, desc._dtype) for desc in
                           _output_descriptors}
_output = _op.OutputCollectionDescription(**{descriptor._name: descriptor._dtype for descriptor in
                                             _output_descriptors})


class OutputDataProxy(ModuleObject,
                      _op.DataProxyBase,
                      descriptors=_output_descriptors):
Beispiel #6
0
import typing

import gmxapi
import gmxapi.abc
import gmxapi.exceptions
import gmxapi.operation as _op
import gmxapi.typing
from gmxapi.operation import InputCollectionDescription
from gmxapi.simulation.abc import ModuleObject

from . import fileio

# Initialize module-level logger
from gmxapi import logger as root_logger

logger = root_logger.getChild('read_tpr')
logger.info('Importing {}'.format(__name__))


#
# Interface classes and internal details
#

# TODO: The output of read_tpr and modify_input should be the same and part of the
#  simulation module specification. Such output is either a special type of output proxy
#  or Future.
_output_descriptors = (
    _op.OutputDataDescriptor('_simulation_input', str),
    _op.OutputDataDescriptor('parameters', dict)
)
_publishing_descriptors = {desc._name: gmxapi.operation.Publisher(desc._name, desc._dtype) for desc in