Esempio n. 1
0
    sort = lambda user: user.email
    highlight = lambda x: x.email == default_user.email if default_user else None
    echo.echo_formatted_list(User.objects.all(),
                             attributes,
                             sort=sort,
                             highlight=highlight)


@verdi_user.command('configure')
@click.option(
    '--email',
    'user',
    prompt='User email',
    help=
    'Email address that serves as the user name and a way to identify data created by it.',
    type=types.UserParamType(create=True),
    cls=options.interactive.InteractiveOption)
@click.option('--first-name',
              prompt='First name',
              help='First name of the user.',
              type=click.STRING,
              contextual_default=partial(get_user_attribute_default,
                                         'first_name'),
              cls=options.interactive.InteractiveOption)
@click.option('--last-name',
              prompt='Last name',
              help='Last name of the user.',
              type=click.STRING,
              contextual_default=partial(get_user_attribute_default,
                                         'last_name'),
              cls=options.interactive.InteractiveOption)
Esempio n. 2
0
COMPUTER = OverridableArgument('computer', type=types.ComputerParamType())

COMPUTERS = OverridableArgument('computers', nargs=-1, type=types.ComputerParamType())

DATUM = OverridableArgument('datum', type=types.DataParamType())

DATA = OverridableArgument('data', nargs=-1, type=types.DataParamType())

GROUP = OverridableArgument('group', type=types.GroupParamType())

GROUPS = OverridableArgument('groups', nargs=-1, type=types.GroupParamType())

NODE = OverridableArgument('node', type=types.NodeParamType())

NODES = OverridableArgument('nodes', nargs=-1, type=types.NodeParamType())

PROCESS = OverridableArgument('process', type=types.CalculationParamType())

PROCESSES = OverridableArgument('processes', nargs=-1, type=types.CalculationParamType())

INPUT_FILE = OverridableArgument('input_file', metavar='INPUT_FILE', type=click.Path(exists=True))

OUTPUT_FILE = OverridableArgument('output_file', metavar='OUTPUT_FILE', type=click.Path())

LABEL = OverridableArgument('label')

USER = OverridableArgument('user', metavar='USER', type=types.UserParamType())

PROFILE_NAME = OverridableArgument('profile_name', type=click.STRING)
Esempio n. 3
0
    echo.echo_info('pk: {}, uuid: {}'.format(computer.pk, computer.uuid))

    echo.echo_info(
        "Note: before using it with AiiDA, configure it using the command")
    echo.echo_info("  verdi computer configure {} {}".format(
        computer.get_transport_type(), computer.name))
    echo.echo_info(
        "(Note: machine_dependent transport parameters cannot be set via ")
    echo.echo_info("the command-line interface at the moment)")


@verdi_computer.command('enable')
@click.option(
    '-u',
    '--only-for-user',
    type=types.UserParamType(),
    required=False,
    help=
    "Enable a computer only for the given user. If not specified, enables the computer globally."
)
@arguments.COMPUTER()
@with_dbenv()
def enable_computer(only_for_user, computer):
    """Enable a computer"""
    from aiida.common.exceptions import NotExistent

    if only_for_user is None:
        if computer.is_enabled():
            echo.echo_info("Computer '{}' already enabled.".format(
                computer.name))
        else: