Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update marketplace cli commands with last version of service marketplace #853

Merged
merged 4 commits into from
Apr 9, 2019

Conversation

NicolasMahe
Copy link
Member

@NicolasMahe NicolasMahe commented Apr 5, 2019

Dependant on #844

Output of commands look like:

➜ ./dev-cli marketplace purchase influxdb
? Enter the account to use 0x978369695a3758abc8c0706a9b7cee4b1cb9652c
? Enter passphrase *
? Enter the offer index to purchase 0
? Are you sure to purchase service "influxdb" for 20 MESG Tokens and a duration of 60 seconds? Yes
✔ Offer index "0" of service "influxdb" purchased with success and expires on 2019-04-05 18:45:24 +0700 +07
➜ ./dev-cli marketplace create-offer com.mesg.bitcoin
? Enter the account to use 0x978369695a3758abc8c0706a9b7cee4b1cb9652c
? Enter passphrase *
? Enter the price (in MESG Token) of the offer 1000
? Enter the duration (in second) of the offer 30
? Are you sure to create offer for service "com.mesg.bitcoin" with a price of 1000 MESG Tokens and a duration of 30 seconds? Yes
✔ Offer created with success with index "0"
✔ See it on the marketplace: https://marketplace.mesg.com/services/com.mesg.bitcoin#offers
➜ ./dev-cli marketplace publish ../services/service-bitcoin
? Enter the account to use 0x978369695a3758abc8c0706a9b7cee4b1cb9652c
? Enter passphrase *
✔ Image built with success
✔ Service deployed with sid com.mesg.bitcoin and hash 55sdquWL8U6sujUyRjYS5xQFiSdGFemPjbtcYkdQXRgw
? Are you sure to publish a new version of service "com.mesg.bitcoin" from path "../services/service-bitcoin" using account "0x978369695a3758abc8c0706a9b7cee4b1cb9652c"? Yes
✔ Service published with success with sid "com.mesg.bitcoin" and marketplace hash "HNybfCZZw6uKSArfPjZbeF6R7FJznGLFC8dr3SvcFS13"
✔ See it on the marketplace: https://marketplace.mesg.com/services/com.mesg.bitcoin/HNybfCZZw6uKSArfPjZbeF6R7FJznGLFC8dr3SvcFS13
✔ To create a service offer, execute the command:
	mesg-core marketplace create-offer com.mesg.bitcoin

return output, p.call("createServiceOffer", input, &output)
var o marketplacePublishPublishServiceVersionTaskOutputs
err = p.call("publishPublishServiceVersion", input, &o)
return o.Sid, o.VersionHash, o.Manifest, o.ManifestProtocol, err
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not keeping the same pattern in the code. You could expose marketplacePublishPublishServiceVersionTaskOutputs and have something like that

var o marketplacePublishPublishServiceVersionTaskOutputs
return o, p.call("publishPublishServiceVersion", input, &o)

I feel a function that returns too much data should return a struct.

Same for the PublishCreateServiceOffer and PublishPurchase

Copy link
Member Author

@NicolasMahe NicolasMahe Apr 8, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the function has too many returned value but:

  • the CLI doesn't directly depend on the package provider, all the function are declared in commands.go
  • it returns only simple types
  • the commands actually only read 2 or 3 returned values. Should I only returned value useful for the commands?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the CLI doesn't directly depend on the package provider, all the function are declared in commands.go

It does on few functions already: UploadSource, PreparePublishServiceVersion, PrepareCreateServiceOffer, PreparePurchase, GetService... basically all except these ones

it returns only simple types

No it doesn't:

PreparePublishServiceVersion(service provider.MarketplaceManifestServiceData, from string) (provider.Transaction, error)
GetService(sid string) (provider.MarketplaceService, error)

the commands actually only read 2 or 3 returned values. Should I only returned value useful for the commands?

If we need only these data we could just return them but if we have the struct let's return the struct like that we have all the data without having a long list of outputs

Copy link
Contributor

@ilgooz ilgooz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

manual tests are ok

@krhubert
Copy link
Contributor

krhubert commented Apr 8, 2019

diff --git a/systemservices/marketplace/mesg.yml b/systemservices/marketplace/mesg.yml
index 1452a275..c1da8997 100644
--- a/systemservices/marketplace/mesg.yml
+++ b/systemservices/marketplace/mesg.yml
@@ -3,7 +3,7 @@ sid: marketplace
 description: ""
 configuration:
   env:
-    - PROVIDER_ENDPOINT=https://ropsten.infura.io/v3/6115ae2531f64c04a9a392cf500e5fbe
+    - PROVIDER_ENDPOINT=https://localhost:1234

If you change ENDPOINT then marketplace stucks on

⣯ Publishing service on the marketplace...

Forever (or maybe there is some timeout but it would be strange to have timeout to nonexisting port)

@NicolasMahe
Copy link
Member Author

diff --git a/systemservices/marketplace/mesg.yml b/systemservices/marketplace/mesg.yml
index 1452a275..c1da8997 100644
--- a/systemservices/marketplace/mesg.yml
+++ b/systemservices/marketplace/mesg.yml
@@ -3,7 +3,7 @@ sid: marketplace
 description: ""
 configuration:
   env:
-    - PROVIDER_ENDPOINT=https://ropsten.infura.io/v3/6115ae2531f64c04a9a392cf500e5fbe
+    - PROVIDER_ENDPOINT=https://localhost:1234

If you change ENDPOINT then marketplace stucks on

⣯ Publishing service on the marketplace...

Forever (or maybe there is some timeout but it would be strange to have timeout to nonexisting port)

Can you check the log of the service? ./dev-cli service logs marketplace.
I think the service throw an error and actually never properly start. This is not an issue only related to this service but to all service. The core doesn't check if the service is properly running before sending a task.

@krhubert
Copy link
Contributor

krhubert commented Apr 9, 2019

Yes it throws error, but at the same time

EQcbh3CqmjdxFatGao959tc5VQkX3j7DJToMYvQoR2VK marketplace Marketplace running

Is still running, so, in that case, can task return error as well, or service should be killed (and it will be seen as stopped )

EDIT:

ok, nvm,status is not tracked on service stop.

@antho1404 antho1404 merged commit ed3be0f into dev Apr 9, 2019
@antho1404 antho1404 deleted the cli/update-marketplace-tasks branch April 9, 2019 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants