Example #1
0
def check(
        file,  # pylint:disable=redefined-builtin
        version,
        definition,
        params):
    """Check a polyaxonfile."""
    file = file or 'polyaxonfile.yaml'
    specification = check_polyaxonfile(file, params=params).specification

    if version:
        Printer.decorate_format_value('The version is: {}',
                                      specification.version, 'yellow')

    if definition:
        job_condition = (specification.is_job or specification.is_build
                         or specification.is_notebook
                         or specification.is_tensorboard)
        if specification.is_experiment:
            Printer.decorate_format_value('This polyaxon specification has {}',
                                          'One experiment', 'yellow')
        if job_condition:
            Printer.decorate_format_value(
                'This {} polyaxon specification is valid', specification.kind,
                'yellow')
        if specification.is_group:
            experiments_def = specification.experiments_def
            click.echo(
                'This polyaxon specification has experiment group with the following definition:'
            )
            get_group_experiments_info(**experiments_def)

    return specification
Example #2
0
def check(
        file,  # pylint:disable=redefined-builtin
        version,
        definition):
    """Check a polyaxonfile."""
    file = file or 'polyaxonfile.yml'
    specification = check_polyaxonfile(file).specification

    if version:
        Printer.decorate_format_value('The version is: {}',
                                      specification.version, 'yellow')

    if definition:
        if specification.is_experiment:
            Printer.decorate_format_value('This polyaxon specification has {}',
                                          'One experiment', 'yellow')
        if specification.is_plugin:
            Printer.decorate_format_value(
                'This is {} polyaxon specification has', 'plugin job',
                'yellow')
        if specification.is_group:
            experiments_def = specification.experiments_def
            click.echo(
                'This polyaxon specification has experiment group with the following definition:'
            )
            get_group_experiments_info(**experiments_def)

    return specification
Example #3
0
def check(file, all, version, run_type, project, log_path, matrix,
          experiments):
    """Check a polyaxonfile."""
    plx_file = check_polyaxonfile(file)

    if version:
        Printer.decorate_format_value('The version is: {}', plx_file.version,
                                      'yellow')

    if run_type:
        Printer.decorate_format_value('The run-type is: {}', plx_file.run_type,
                                      'yellow')

    if project:
        Printer.decorate_format_value('The project is: {}',
                                      plx_file.project.name, 'yellow')
    if log_path:
        Printer.decorate_format_value('The project logging path is: {}',
                                      plx_file.project_path, 'yellow')
    if matrix:
        declarations = '\n'.join(
            [str(d) for d in plx_file.matrix_declarations])
        Printer.decorate_format_value('The matrix definition is:\n{}',
                                      declarations, 'yellow')

    if experiments:
        num_experiments, concurrency = plx_file.experiments_def
        if num_experiments == 1:
            Printer.decorate_format_value('This polyaxon specification has {}',
                                          'One experiment', 'yellow')
        elif concurrency == 1:
            Printer.decorate_format_value(
                'he matrix-space has {} experiments, with {} runs',
                [num_experiments, 'sequential'], 'yellow')
        else:
            Printer.decorate_format_value(
                'he matrix-space has {} experiments, '
                'with {} concurrent runs', [num_experiments, concurrency],
                'yellow')
    if all:
        click.echo("Validated file:\n{}".format(plx_file.parsed_data))

    return plx_file