コード例 #1
0
ファイル: __init__.py プロジェクト: sernst/cauldron
def execute_remote(context: cli.CommandContext, **kwargs) -> Response:
    """ """

    sync_response = sync_command.execute(cli.make_command_context(
        name=sync_command.NAME,
        remote_connection=context.remote_connection
    ))
    context.response.consume(sync_response)

    if sync_response.failed:
        return context.response

    environ.log('[STARTED]: Remote run execution', whitespace=1)

    thread = sync.send_remote_command(
        command=context.name,
        raw_args=context.raw_args,
        asynchronous=True,
        show_logs=True
    )

    thread.join()

    response = thread.responses[-1]
    return context.response.consume(response)
コード例 #2
0
def execute_remote(context: cli.CommandContext) -> Response:
    """ """
    thread = sync.send_remote_command(command=context.name,
                                      raw_args=context.raw_args,
                                      asynchronous=False)

    thread.join()

    response = thread.responses[0]
    return context.response.consume(response)
コード例 #3
0
ファイル: close.py プロジェクト: sernst/cauldron
def execute_remote(context: cli.CommandContext) -> Response:
    """ """
    thread = sync.send_remote_command(
        command=context.name,
        raw_args=context.raw_args,
        asynchronous=False
    )

    thread.join()

    response = thread.responses[0]
    return context.response.consume(response)
コード例 #4
0
ファイル: purge.py プロジェクト: selasley/cauldron
def remote_purge(context: cli.CommandContext) -> Response:
    """ """

    thread = sync.send_remote_command(
        command=context.name,
        raw_args='{} --force'.format(context.raw_args),
        asynchronous=False
    )

    thread.join()

    response = thread.responses[0]
    return context.response.consume(response)
コード例 #5
0
def execute_remote(context: cli.CommandContext, path: str = None) -> Response:
    """ """

    thread = sync.send_remote_command(
        command='save',
        remote_connection=context.remote_connection,
        show_logs=False,
        asynchronous=False
    )
    thread.join()
    save_response = thread.responses[-1]

    if save_response.failed:
        save_response.log_notifications()
        return context.response.consume(save_response)

    filename = os.path.basename(save_response.data.get('path'))
    project_title = save_response.data.get('project_title', 'Project')

    save_path = clean_path(
        project_title,
        path if path else get_default_path()
    )
    make_directory(save_path)

    download_response = sync.comm.download_file(
        filename=filename,
        save_path=save_path,
        remote_connection=context.remote_connection
    )

    if download_response.success:
        download_response.notify(
            kind='SAVED',
            code='DOWNLOAD_SAVED',
            message='Project has been saved to: {}'.format(save_path)
        )

    return context.response.consume(download_response)
コード例 #6
0
def execute_remote(context: cli.CommandContext, **kwargs) -> Response:
    """ """

    sync_response = sync_command.execute(
        cli.make_command_context(name=sync_command.NAME,
                                 remote_connection=context.remote_connection))
    context.response.consume(sync_response)

    if sync_response.failed:
        return context.response

    environ.log('[STARTED]: Remote run execution', whitespace=1)

    thread = sync.send_remote_command(command=context.name,
                                      raw_args=context.raw_args,
                                      asynchronous=True,
                                      show_logs=True)

    thread.join()

    response = thread.responses[-1]
    return context.response.consume(response)