Beispiel #1
0
def info_cmd(args_):
    """Queries the info endpoint."""
    info_api = ZoeInfoAPI(utils.zoe_url(), utils.zoe_user(), utils.zoe_pass())
    info = info_api.info()
    print("Zoe version: ", info['version'])
    print("Zoe API version: ", info['api_version'])
    print("ZApp format version: ", info['application_format_version'])
    print("Deployment name: ", info['deployment_name'])
Beispiel #2
0
def info_cmd(auth, args_):
    """Queries the info endpoint."""
    info_api = ZoeInfoAPI(auth['url'], auth['user'], auth['pass'])
    info = info_api.info()
    print("Zoe version: ", info['version'])
    print("Zoe API version: ", info['api_version'])
    print("ZApp format version: ", info['application_format_version'])
    print("Deployment name: ", info['deployment_name'])
def info_cmd(args_):
    """Queries the info endpoint."""
    info_api = ZoeInfoAPI(utils.zoe_url(), utils.zoe_user(), utils.zoe_pass())
    info = info_api.info()
    print("Zoe version: ", info['version'])
    print("Zoe API version: ", info['api_version'])
    print("ZApp format version: ", info['application_format_version'])
    print("Deployment name: ", info['deployment_name'])
Beispiel #4
0
def _check_api_version(auth):
    """Checks if there is a version mismatch between server and client."""
    info_api = ZoeInfoAPI(auth['url'], auth['user'], auth['pass'])
    info = info_api.info()
    if info['api_version'] != ZOE_API_VERSION:
        print(
            'Warning: this client understands ZOE API v. {}, but server talks v. {}'
            .format(ZOE_API_VERSION, info['api_version']))
        print('Warning: certain commands may not work correctly')
        print(
            'Warning: please upgrade or downgrade your client to match the server version'
        )
Beispiel #5
0
    def __init__(self, workspace_base_path, identity, name):
        self.identity = identity
        self.name = name
        self.workspace = ZoeWorkspace(workspace_base_path, identity, name)

        self.exec_api = ZoeExecutionsAPI(self.identity['zoe_url'], self.identity['username'], self.identity['password'])
        self.cont_api = ZoeServiceAPI(self.identity['zoe_url'], self.identity['username'], self.identity['password'])

        info_api = ZoeInfoAPI(self.identity['zoe_url'], self.identity['username'], self.identity['password'])
        zoe_info = info_api.info()
        self.hostname_prefix = zoe_info['name_prefix']

        self.exec_counter = 0
Beispiel #6
0
def load_configuration(test_conf=None):
    global _conf
    if test_conf is None:
        argparser = ArgumentParser(
            description=
            "Zoe Observer - Container Analytics as a Service Swarm Observer component",
            default_config_files=config_paths,
            auto_env_var_prefix="ZOE_OBSERVER_",
            args_for_setting_config_path=["--config"],
            args_for_writing_out_config_file=["--write-config"])
        argparser.add_argument('--debug',
                               action='store_true',
                               help='Enable debug output')
        argparser.add_argument(
            '--swarm',
            help=
            'Swarm/Docker API endpoint (ex.: zk://zk1:2181,zk2:2181 or http://swarm:2380)',
            default='http://localhost:2375')
        argparser.add_argument('--master-url',
                               help='URL of the master\'s REST API',
                               default='http://127.0.0.1:4850')
        argparser.add_argument(
            '--zoeadmin-password',
            help='Password used to login as the master Zoe administrator',
            default='changeme')
        argparser.add_argument(
            '--spark-activity-timeout',
            help=
            'Number of seconds of inactivity (no jobs run) before a Spark cluster is terminated',
            type=int,
            default=18000)
        argparser.add_argument('--loop-time',
                               help='Time between consecutive check',
                               type=int,
                               default=300)

        opts = argparser.parse_args()
        if opts.debug:
            argparser.print_values()
        _conf = opts

        info_api = ZoeInfoAPI(opts.master_url, 'zoeadmin',
                              opts.zoeadmin_password)
        info = info_api.info()
        opts.deployment_name = info['deployment_name']
        # FIXME: check compatibility for API versions
    else:
        _conf = test_conf
Beispiel #7
0
def _check_api_version(auth):
    """Checks if there is a version mismatch between server and client."""
    info_api = ZoeInfoAPI(auth['url'], auth['user'], auth['pass'])
    try:
        info_api.info()
        return True
    except ZoeAPIException:
        print(
            'Error: this client can talk to ZOE v. {}, but server is reporting an error'
            .format(ZOE_VERSION, ))
        print(
            'Error: your client is too old (or too new) to speak with the configured server'
        )
        print(
            'Error: check the version this server is running at the bottom of this web page: {}'
            .format(auth['url']))
        return False
Beispiel #8
0
    def __init__(self, workspace_base_path, identity, name):
        self.identity = identity
        self.name = name
        self.workspace = ZoeWorkspace(workspace_base_path, identity, name)

        self.exec_api = ZoeExecutionsAPI(self.identity['zoe_url'],
                                         self.identity['username'],
                                         self.identity['password'])
        self.cont_api = ZoeServiceAPI(self.identity['zoe_url'],
                                      self.identity['username'],
                                      self.identity['password'])

        info_api = ZoeInfoAPI(self.identity['zoe_url'],
                              self.identity['username'],
                              self.identity['password'])
        zoe_info = info_api.info()
        self.hostname_prefix = zoe_info['name_prefix']

        self.exec_counter = 0