Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Stuck with on create new stub. On make client query #309

Closed
ilham-bintang opened this issue Oct 7, 2019 · 5 comments
Closed

Stuck with on create new stub. On make client query #309

ilham-bintang opened this issue Oct 7, 2019 · 5 comments

Comments

@ilham-bintang
Copy link

ilham-bintang commented Oct 7, 2019

Explanation

Hi. I has been implement the demo-poems-ir. And it is working properly. Right now I want to use the sample for my custom class.
here the class:

class FaqClient(CLIClient):

    @property
    def bytes_generator(self):
        num_rows = 0

        for rr in csv.DictReader(self.args.txt_file, delimiter='\t'):
            yield json.dumps(rr['answer']).encode()
            num_rows += 1
            if num_rows > self.args.num_poems:
                return

    def query_callback(self, req, resp):
        print(colored(req.search.query, 'green'))
        for k in resp.search.topk_results:
            print(colored(k.doc.doc_id, 'magenta'))
            print(colored(k.doc.raw_text, 'yellow'))
            print(colored(k.score.value, 'blue'))
            pprint.pprint(json.loads(k.score.explained))
            input('press any key to continue...')

        if self.args.prompt:
            input('on to next query, press any key to continue...')

Problem

When I run make client_query or make client_index it will stuck in:

I:FaqClient:[bas:__i:136]:create new stub...

Here the screenshot
Screen Shot 2019-10-07 at 23 36 31

Questions

What's exactly happened when the Client info create new stub...? I read the source it only init GnesRPCStub with the channel. It stuck there and can not passing the

self.logger.critical('gnes client ready at %s:%d!' % (self.args.grpc_host, self.args.grpc_port))

Kindly advise

@hanxiao
Copy link
Collaborator

hanxiao commented Oct 10, 2019

this usually happens when https_proxy or http_proxy set.
unset them and try again.

unset http_proxy && unset https_proxy

or in python

os.unsetenv('http_proxy')
os.unsetenv('https_proxy')

@ilham-bintang
Copy link
Author

this usually happens when https_proxy or http_proxy set.
unset them and try again.

unset http_proxy && unset https_proxy

or in python

os.unsetenv('http_proxy')
os.unsetenv('https_proxy')

Actually I has been unset the https_proxy and unset http_proxy before run the client image. Here my client-query.sh:

unset https_proxy && unset http_proxy && docker run -it --rm --network host -v ${PWD}/data:/data/ nullphantom/faq-gnes:client --mode query --txt_file /data/questions.csv --prompt

@hanxiao
Copy link
Collaborator

hanxiao commented Oct 17, 2019

thanks again ❤️ for trying GNES and giving feedback at the early stage. I'd like to introduce you the new GNES Flow API (available since v0.0.46), enables a pythonic and intuitive way for building workflow in GNES. As an example, an indexing workflow can be simply defined as:

flow = (Flow(check_version=False, ctrl_with_ipc=True)
        .add_preprocessor(name='prep', yaml_path='yaml/prep.yml', replicas=3)
        .add_encoder(yaml_path='yaml/incep.yml', replicas=6)
        .add_indexer(name='vec_idx', yaml_path='yaml/vec.yml')
        .add_indexer(name='doc_idx', yaml_path='yaml/doc.yml', recv_from='prep')
        .add_router(name='sync', yaml_path='BaseReduceRouter', num_part=2, recv_from=['vec_idx', 'doc_idx']))

# then use it for indexing
with flow(backend='process') as fl:
    fl.index(bytes_gen=read_flowers(), batch_size=64)

🔰 You can find some resources here to help you getting started quickly:

🙇 Give it a try and we welcome your feedback and contribution.

@ilham-bintang
Copy link
Author

Okay I will migrate my yml specs to pythonic gnes Flow new classes. Thank you gnes team!!

@ilham-bintang
Copy link
Author

This issue raised because there is another process on grpc port: 8800
try to kill all process and rerun

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants