snet-cli icon indicating copy to clipboard operation
snet-cli copied to clipboard

"open-init" channel at "client call"

Open arturgontijo opened this issue 5 years ago • 4 comments

$ snet client call snet sentiment-analysis Analyze test.json -y
Read call params from the file: test.json
# Initilize service with org_id=snet and service_id=sentiment-analysis
Error: Cannot find initialized channel for service with org_id=snet service_id=sentiment-analysis and signer=0xFF2a327ed1Ca40CE93F116C5d6646b56991c0ddE
If you want to see full Traceback then run:
snet --print-traceback [parameters]

We should provide an option here that allows user to open-init or/and add-extend a new/existing channel.

arturgontijo avatar Jun 17 '19 11:06 arturgontijo

It is relatively easy to make, but it will add two optional parameters (amount and expiration) which might be confusing.

astroseger avatar Jun 17 '19 11:06 astroseger

What if we prompt the options like this:

# Initilize service with org_id=snet and service_id=sentiment-analysis
Error: Cannot find initialized channel for service with org_id=snet service_id=sentiment-analysis and signer=0xFF2a327ed1Ca40CE93F116C5d6646b56991c0ddE
Do you want to open-init a new channel (y/n)? (Or Do you want to extend-add channel 987 (y/n)?)

If user input "y" we then prompt the other things, like:

Do you want to open-init a new channel (y/n)? y
Amount (AGI): 0.5
Expiration (eg 10days): 20days

I know that this can be a like bit overwhelming but some users (advanced) will leverage this.

arturgontijo avatar Jun 17 '19 12:06 arturgontijo

Personally, I don't like such interactive command line dialogs. It should be easy to use snet-cli from bash script.

So I would make it like this:

snet client call snet sentiment-analysis Analyze test.json -y --auto-refound-amout 0.001 --auto-refound-expiration 20days  

@vforvalerio87 we can use auto-refound strategies from SDK here.

astroseger avatar Jun 17 '19 13:06 astroseger

Yeah, your way is much better than mine!

arturgontijo avatar Jun 17 '19 13:06 arturgontijo