예제 #1
0
def edit(dataset_id):
    """Edit dataset metadata."""
    edit_dataset(
        dataset_id, lambda dataset: editor.edit(
            contents=bytes(yaml.safe_dump(dataset.editable), encoding='utf-8')
        )
    )
예제 #2
0
def edit(short_name, title, description, creator, keyword):
    """Edit dataset metadata."""
    creators = creator or ()
    keywords = keyword or ()

    updated, no_email_warnings = edit_dataset(
        short_name=short_name,
        title=title,
        description=description,
        creators=creators,
        keywords=keywords,
    )

    if not updated:
        click.echo((
            'Nothing to update. '
            'Check available fields with `renku dataset edit --help`\n\n'
            'Hint: `renku dataset edit --title "new title"`'
        ))
    else:
        click.echo('Successfully updated: {}.'.format(', '.join(updated)))
        if no_email_warnings:
            click.echo(
                WARNING + 'No email or wrong format for: ' +
                ', '.join(no_email_warnings)
            )
예제 #3
0
def edit_dataset_view(user_data, cache):
    """Edit dataset metadata."""
    ctx = DatasetEditRequest().load(request.json)

    user = cache.ensure_user(user_data)
    project = cache.get_project(user, ctx["project_id"])

    if ctx.get("commit_message") is None:
        ctx["commit_message"] = "service: dataset edit {0}".format(ctx["name"])

    with chdir(project.abs_path):
        edited, warnings = edit_dataset(
            ctx["name"],
            ctx.get("title"),
            ctx.get("description"),
            ctx.get("creators"),
            keywords=ctx.get("keywords"),
            commit_message=ctx["commit_message"],
        )

    return result_response(
        DatasetEditResponseRPC(), {
            "edited": {field: ctx.get(field)
                       for field in edited},
            "warnings": warnings
        })
예제 #4
0
def edit_dataset_view(user_data, cache):
    """Edit dataset metadata."""
    ctx = DatasetEditRequest().load(request.json)

    user = cache.ensure_user(user_data)
    project = cache.get_project(user, ctx['project_id'])

    if ctx.get('commit_message') is None:
        ctx['commit_message'] = 'service: dataset edit {0}'.format(
            ctx['short_name'])

    with chdir(project.abs_path):
        edited, warnings = edit_dataset(ctx['short_name'],
                                        ctx.get('title'),
                                        ctx.get('description'),
                                        ctx.get('creators'),
                                        keywords=ctx.get('keywords'),
                                        commit_message=ctx['commit_message'])

    return result_response(
        DatasetEditResponseRPC(), {
            'edited': {field: ctx.get(field)
                       for field in edited},
            'warnings': warnings
        })
예제 #5
0
def edit(short_name, title, description, creator):
    """Edit dataset metadata."""
    creators = creator or ()

    updated, no_email_warnings = edit_dataset(
        short_name=short_name,
        title=title,
        description=description,
        creators=creators
    )

    if not updated:
        click.echo('Nothing to update.')
    else:
        click.echo('Successfully updated: {}.'.format(', '.join(updated)))
        if no_email_warnings:
            click.echo(
                WARNING + 'No email or wrong format for: ' +
                ', '.join(no_email_warnings)
            )
예제 #6
0
def edit(name, title, description, creators, keyword):
    """Edit dataset metadata."""
    creators = creators or ()
    keywords = keyword or ()

    updated, no_email_warnings = edit_dataset(
        name=name, title=title, description=description, creators=creators, keywords=keywords,
    )

    if not updated:
        click.echo(
            (
                "Nothing to update. "
                "Check available fields with `renku dataset edit --help`\n\n"
                'Hint: `renku dataset edit --title "new title"`'
            )
        )
    else:
        click.echo("Successfully updated: {}.".format(", ".join(updated)))
        if no_email_warnings:
            click.echo(WARNING + "No email or wrong format for: " + ", ".join(no_email_warnings))