コード例 #1
0
ファイル: pause.py プロジェクト: sumitk1/voltdb
def pause(runner):
    # Check the STATUS column. runner.call_proc() detects and aborts on errors.
    status = runner.call_proc('@Pause', [], []).table(0).tuple(0).column_integer(0)
    if status == 0:
        utility.info('The cluster is paused.')
    else:
        utility.error('The cluster has failed to pause with status: %d' % status)
コード例 #2
0
    def _create_package(self, output_dir, name, version, description, force):
        # Internal method to create a runnable Python package.
        output_path = os.path.join(output_dir, name)
        utility.info('Creating compressed executable Python program: %s' %
                     output_path)
        zipper = utility.Zipper(excludes=['[.]pyc$'])
        zipper.open(output_path,
                    force=force,
                    preamble='#!/usr/bin/env python\n')
        try:
            # Generate the __main__.py module for automatic execution from the zip file.
            standalone = str(environment.standalone)
            main_script = ('''\
import sys
from voltcli import runner
runner.main('%(name)s', '', '%(version)s', '%(description)s',
            package = True, standalone = %(standalone)s, *sys.argv[1:])''' %
                           locals())
            zipper.add_file_from_string(main_script, '__main__.py')
            # Recursively package lib/python as lib in the zip file.
            zipper.add_directory(environment.volt_python, '')
            # Add <verbspace-name>.d subdirectory if found under the command directory.
            command_d = os.path.join(environment.command_dir, '%s.d' % name)
            if os.path.isdir(command_d):
                dst = os.path.join('voltcli', os.path.basename(command_d))
                zipper.add_directory(command_d, dst)
        finally:
            zipper.close(make_executable=True)
コード例 #3
0
ファイル: runner.py プロジェクト: bear000s/voltdb
    def _create_package(self, output_dir, name, version, description, force):
        # Internal method to create a runnable Python package.
        output_path = os.path.join(output_dir, name)
        utility.info('Creating compressed executable Python program: %s' % output_path)
        zipper = utility.Zipper(excludes = ['[.]pyc$'])
        zipper.open(output_path, force = force, preamble = '#!/usr/bin/env python\n')
        try:
            # Generate the __main__.py module for automatic execution from the zip file.
            standalone = str(environment.standalone)
            main_script = ('''\
import sys
from voltcli import runner
runner.main('%(name)s', '', '%(version)s', '%(description)s',
            package = True, standalone = %(standalone)s, *sys.argv[1:])'''
                    % locals())
            zipper.add_file_from_string(main_script, '__main__.py')
            # Recursively package lib/python as lib in the zip file.
            zipper.add_directory(environment.volt_python, '')
            # Add <verbspace-name>.d subdirectory if found under the command directory.
            command_d = os.path.join(environment.command_dir, '%s.d' % name)
            if os.path.isdir(command_d):
                dst = os.path.join('voltcli', os.path.basename(command_d))
                zipper.add_directory(command_d, dst)
        finally:
            zipper.close(make_executable = True)
コード例 #4
0
ファイル: update.py プロジェクト: sumitk1/voltdb
def update(runner):
    columns    = [VOLT.FastSerializer.VOLTTYPE_STRING, VOLT.FastSerializer.VOLTTYPE_STRING]
    catalog    = VOLT.utility.File(runner.opts.catalog).read_hex()
    deployment = VOLT.utility.File(runner.opts.deployment).read()
    params     = [catalog, deployment]
    # call_proc() aborts with an error if the update failed.
    runner.call_proc('@UpdateApplicationCatalog', columns, params)
    utility.info('The catalog update succeeded.')
コード例 #5
0
def pause(runner):
    # Check the STATUS column. runner.call_proc() detects and aborts on errors.
    status = runner.call_proc('@Pause', [],
                              []).table(0).tuple(0).column_integer(0)
    if status == 0:
        utility.info('The cluster is paused.')
    else:
        utility.error('The cluster has failed to pause with status: %d' %
                      status)
コード例 #6
0
def restore(runner):
    columns = [
        VOLT.FastSerializer.VOLTTYPE_STRING,
        VOLT.FastSerializer.VOLTTYPE_STRING
    ]
    params = [runner.opts.directory, runner.opts.nonce]
    response = runner.call_proc('@SnapshotRestore', columns, params)
    utility.info('The snapshot was restored.')
    print response.table(0).format_table(caption='Snapshot Restore Results')
コード例 #7
0
ファイル: voltify.py プロジェクト: YUFAN2GA/voltdb
def run_config_reset(runner):
#===============================================================================
    """
    Implementation of "config reset" sub-command.
    """
    utility.info('Clearing configuration settings...')
    # Perform the reset.
    get_config(runner, reset=True)
    # Display the help.
    get_config(runner)
コード例 #8
0
ファイル: voltify.py プロジェクト: YUFAN2GA/voltdb
 def generate_all(self):
     self.generate_readme()
     self.generate_deployment()
     self.generate_run_script()
     self.generate_ddl()
     self.generate_sample_client()
     #self.generate_sample_procedure()
     utility.info('Project files were generated successfully.',
                  'Please examine the following files thoroughly before using.',
                  self.generated)
コード例 #9
0
def run_config_reset(runner):
#===============================================================================
    """
    Implementation of "config reset" sub-command.
    """
    utility.info('Clearing configuration settings...')
    # Perform the reset.
    get_config(runner, reset=True)
    # Display the help.
    get_config(runner)
コード例 #10
0
 def generate_all(self):
     self.generate_readme()
     self.generate_deployment()
     self.generate_run_script()
     self.generate_ddl()
     self.generate_sample_client()
     #self.generate_sample_procedure()
     utility.info('Project files were generated successfully.',
                  'Please examine the following files thoroughly before using.',
                  self.generated)
コード例 #11
0
ファイル: config.py プロジェクト: sumitk1/voltdb
def config(runner):
    bad = []
    for arg in runner.opts.keyvalue:
        if arg.find('=') == -1:
            bad.append(arg)
    if bad:
        utility.abort('Bad arguments (must be KEY=VALUE format):', bad)
    for arg in runner.opts.keyvalue:
        key, value = [s.strip() for s in arg.split('=', 1)]
        # Default to 'volt.' if simple name is given.
        if key.find('.') == -1:
            key = 'volt.%s' % key
        runner.config.set_local(key, value)
        utility.info('Configuration: %s=%s' % (key, value))
コード例 #12
0
def config(runner):
    bad = []
    for arg in runner.opts.keyvalue:
        if arg.find('=') == -1:
            bad.append(arg)
    if bad:
        utility.abort('Bad arguments (must be KEY=VALUE format):', bad)
    for arg in runner.opts.keyvalue:
        key, value = [s.strip() for s in arg.split('=', 1)]
        # Default to 'volt.' if simple name is given.
        if key.find('.') == -1:
            key = 'volt.%s' % key
        runner.config.set_local(key, value)
        utility.info('Configuration: %s=%s' % (key, value))
コード例 #13
0
 def info(self, *msgs):
     """
     Display INFO level messages.
     """
     utility.info(*msgs)
コード例 #14
0
ファイル: runner.py プロジェクト: bear000s/voltdb
 def info(self, *msgs):
     """
     Display INFO level messages.
     """
     utility.info(*msgs)
コード例 #15
0
ファイル: restore.py プロジェクト: sumitk1/voltdb
def restore(runner):
    columns = [VOLT.FastSerializer.VOLTTYPE_STRING, VOLT.FastSerializer.VOLTTYPE_STRING]
    params = [runner.opts.directory, runner.opts.nonce]
    response = runner.call_proc("@SnapshotRestore", columns, params)
    utility.info("The snapshot was restored.")
    print response.table(0).format_table(caption="Snapshot Restore Results")