Ejemplo n.º 1
0
    '-t', '--timeout', default=3000, type=int,
    help='Timeout after which the control client exits. Must be at least as long as '
         'one simulation cycle.')
optional_args.add_argument(
    '-n', '--print-none', action='store_true',
    help='By default, no output is generated if the remote function returns None. '
         'Specifying this flag will force the client to print those None-values.')
optional_args.add_argument(
    '-v', '--version', action='store_true',
    help='Prints the version and exits.')
optional_args.add_argument(
    '-h', '--h', action='help',
    help='Shows this help message and exits.')

__doc__ = 'To interact with the control server of a running simulation, use this script. ' \
          'Usage:\n\n.. code-block:: none\n\n{}'.format(get_usage_text(parser, indent=4))


def control_simulation(argument_list=None):
    args = parser.parse_args(argument_list or sys.argv[1:])

    if args.version:
        print(__version__)
        return

    try:
        remote = ControlClient(*args.rpc_host.split(':'),
                               timeout=args.timeout).get_object_collection()

        if not args.object:
            list_objects(remote)
Ejemplo n.º 2
0
         'compatible with.')
other_args.add_argument(
    '-v', '--version', action='store_true',
    help='Prints the version and exits.')
other_args.add_argument(
    '-h', '--h', action='help',
    help='Shows this help message and exits.')

deprecated_args = parser.add_argument_group('Deprecated arguments')
deprecated_args.add_argument(
    '-R', '--relaxed-versions', action='store_true',
    help='Renamed to --I/--ignore-versions. Using this old option produces an error '
         'and it will be removed in a future release.')

__doc__ = 'This script is the main interaction point of the user with Lewis. The usage ' \
          'is as follows:\n\n.. code-block:: none\n\n{}'.format(get_usage_text(parser, indent=4))


def parse_adapter_options(raw_adapter_options):
    if not raw_adapter_options:
        return {None: {}}

    protocols = {}

    for option_string in raw_adapter_options:
        try:
            adapter_options = yaml.load(option_string)
        except yaml.YAMLError:
            raise LewisException(
                'It was not possible to parse this adapter option specification:\n'
                '    %s\n'
Ejemplo n.º 3
0
                        help="Shows this help message and exits.")

deprecated_args = parser.add_argument_group("Deprecated arguments")
deprecated_args.add_argument(
    "-R",
    "--relaxed-versions",
    action="store_true",
    help=
    "Renamed to --I/--ignore-versions. Using this old option produces an error "
    "and it will be removed in a future release.",
)

__doc__ = (
    "This script is the main interaction point of the user with Lewis. The usage "
    "is as follows:\n\n.. code-block:: none\n\n{}".format(
        get_usage_text(parser, indent=4)))


def parse_adapter_options(raw_adapter_options):
    if not raw_adapter_options:
        return {None: {}}

    protocols = {}

    for option_string in raw_adapter_options:
        try:
            adapter_options = yaml.safe_load(option_string)
        except yaml.YAMLError:
            raise LewisException(
                "It was not possible to parse this adapter option specification:\n"
                "    %s\n"