Exemplo n.º 1
0
    def _generate_status(self):
        ret = {
            "author": get_user(),
            "generated": get_time_str(),
            "gofed_version": VERSION,
            "hostname": get_hostname(),
            "topology": []
        }
        system = System(self.get_config(), self.get_system_json_path())

        for service_name in system.get_services_list():
            try:
                registry_response = system.get_service_location(service_name)
            except Exception as e:
                log.warning("Encountered error while querying for service '%s', skipping this service ('%s')"
                            % (service_name, str(e)))
            for response in registry_response:
                ret['topology'].append({
                    'service': service_name,
                    'host': response[0],
                    'port': response[1],
                    'type': 'computational' if system.is_computational(service_name) else 'storage'
                })

        ret['topology'].append({
            'type': 'registry',
            'host': system.get_registry_host(),
            'port': system.get_registry_port()
        })

        print dict2json(ret)
Exemplo n.º 2
0
    def main(self):
        with self.get_system() as system:

            golang_pkgs = system.async_call.goland_package_listing()
            stored_projects = system.async_call.api_project_listing()

            for pkg in golang_pkgs.result:

                if not pkg['name'].startswith('golang-github-'):
                    log.warning("Skipping %s" % pkg['name'])
                    # TODO: remove once support for mercurial and full package->upstream translation will be available
                    continue

                print("Inspecting '%s'" % pkg['name'])
                upstream_url = system.async_call.golang_package2upstream(pkg['name'])

                if pkg['name'] in stored_projects.result:
                    stored_commits = system.async_call.api_project_commit_listing(pkg['name'])
                else:
                    stored_commits = None

                scm_log = system.async_call.scm_log(upstream_url.result)

                for commit in tqdm(scm_log.result):
                    log.debug("Commit %s project %s" % (commit['hash'], pkg['name']))
                    if not stored_commits or commit not in stored_commits.result:
                        file_id = system.async_call.scm_store(upstream_url.result, commit['hash'])
                        api = system.async_call.api_analysis(file_id.result)
                        system.async_call.api_store_project(pkg['name'], commit['hash'], commit['time'],
                                                            api.result, api.meta)
Exemplo n.º 3
0
    def main(self):
        with self.get_system() as system:

            golang_pkgs = system.async_call.goland_package_listing()
            stored_projects = system.async_call.deps_project_listing()

            for pkg in golang_pkgs.result:

                if not pkg['name'].startswith('golang-github-'):
                    log.warning("Skipping %s" % pkg['name'])
                    # TODO: remove once support for mercurial and full package->upstream translation will be available
                    continue

                try:
                    raise ValueError("value error")
                    print("Inspecting '%s'" % pkg['name'])
                    upstream_url = system.async_call.golang_package2upstream(
                        pkg['name'])

                    if pkg['name'] in stored_projects.result:
                        stored_commits = system.async_call.deps_project_commit_listing(
                            pkg['name'])
                    else:
                        stored_commits = None

                    scm_log = system.async_call.scm_log(
                        upstream_url.result,
                        max_depth=self.max_depth,
                        since_date=self.since_date)

                    for commit in tqdm(scm_log.result):
                        log.debug("Commit %s project %s" %
                                  (commit['hash'], pkg['name']))
                        if not stored_commits or commit not in stored_commits.result:
                            file_id = system.async_call.scm_store(
                                upstream_url.result, commit['hash'])
                            deps = system.async_call.deps_analysis(
                                file_id.result)
                            system.async_call.deps_store_project(
                                pkg['name'], commit['hash'], commit['time'],
                                deps.result, deps.meta)
                except:
                    exc_info = sys.exc_info()
                    if self.skip_errors:
                        log.error(exc_info[2].print_exc())
                    else:
                        raise exc_info
Exemplo n.º 4
0
    def main(self):
        with self.get_system() as system:

            golang_pkgs = system.async_call.goland_package_listing()
            stored_projects = system.async_call.deps_project_listing()

            for pkg in golang_pkgs.result:

                if not pkg['name'].startswith('golang-github-'):
                    log.warning("Skipping %s" % pkg['name'])
                    # TODO: remove once support for mercurial and full package->upstream translation will be available
                    continue

                try:
                    raise ValueError("value error")
                    print("Inspecting '%s'" % pkg['name'])
                    upstream_url = system.async_call.golang_package2upstream(pkg['name'])

                    if pkg['name'] in stored_projects.result:
                        stored_commits = system.async_call.deps_project_commit_listing(pkg['name'])
                    else:
                        stored_commits = None

                    scm_log = system.async_call.scm_log(upstream_url.result,
                                                        max_depth=self.max_depth,
                                                        since_date=self.since_date)

                    for commit in tqdm(scm_log.result):
                        log.debug("Commit %s project %s" % (commit['hash'], pkg['name']))
                        if not stored_commits or commit not in stored_commits.result:
                            file_id = system.async_call.scm_store(upstream_url.result, commit['hash'])
                            deps = system.async_call.deps_analysis(file_id.result)
                            system.async_call.deps_store_project(pkg['name'], commit['hash'], commit['time'],
                                                                 deps.result, deps.meta)
                except:
                    exc_info = sys.exc_info()
                    if self.skip_errors:
                        log.error(exc_info[2].print_exc())
                    else:
                        raise exc_info
Exemplo n.º 5
0
    def _generate_status(self):
        ret = {
            "author": get_user(),
            "generated": get_time_str(),
            "gofed_version": VERSION,
            "hostname": get_hostname(),
            "topology": []
        }
        system = System(self.get_config(), self.get_system_json_path())

        for service_name in system.get_services_list():
            try:
                registry_response = system.get_service_location(service_name)
            except Exception as e:
                log.warning(
                    "Encountered error while querying for service '%s', skipping this service ('%s')"
                    % (service_name, str(e)))
            for response in registry_response:
                ret['topology'].append({
                    'service':
                    service_name,
                    'host':
                    response[0],
                    'port':
                    response[1],
                    'type':
                    'computational'
                    if system.is_computational(service_name) else 'storage'
                })

        ret['topology'].append({
            'type': 'registry',
            'host': system.get_registry_host(),
            'port': system.get_registry_port()
        })

        print dict2json(ret)