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

misc(cli): use scallop instead of sumac #854

Merged
merged 2 commits into from
Aug 24, 2020
Merged

Conversation

szymonm
Copy link
Contributor

@szymonm szymonm commented Aug 11, 2020

Pull Request checklist

  • The commit(s) message(s) follows the contribution guidelines ?
  • Tests for the changes have been added (for bug fixes / features) ?
  • Docs have been added / updated (for bug fixes / features) ?

Current behavior :

Part of #457

quantifind.sumac is not being ported to Scala 2.12. Instead, I migrate CliMain to use scallop
that has already been used in gateway.

BREAKING CHANGES

Scallop uses different way of parsing lists and maps.
Specifically, uses space ( ) for list delimiter and equals (=) for value definition in map.
This applies to following parameters of CliMain:

  1. labelNames: instead of --labelNames a,b,c program expects --labelNames a b c.
  2. shards: instead of --shards a,b,c program expects --shards a b c.
  3. labelFilter: instead of --labelFilter key1:value1,key2:value2 it expects --labelFilter key1=value1 key2=value2.

@szymonm szymonm changed the title misc(cli): Use scallop instead of sumac misc(cli): use scallop instead of sumac Aug 11, 2020
@broneill
Copy link
Contributor

You might need to rebase from the develop branch for the build to pass.

@szymonm
Copy link
Contributor Author

szymonm commented Aug 12, 2020

Fixed, @broneill

@broneill broneill requested a review from velvia August 12, 2020 20:49
@broneill broneill self-assigned this Aug 12, 2020
@szymonm
Copy link
Contributor Author

szymonm commented Aug 14, 2020

Are there any concerns?

Are the breaking changes OK? I can do some trickery to keep backwards compatibility, but that will be less elegant.

Also, I see that some docs around this will need to be changed.

@broneill
Copy link
Contributor

I'd like to get some feedback from @velvia .

@velvia
Copy link
Member

velvia commented Aug 14, 2020 via email

@szymonm
Copy link
Contributor Author

szymonm commented Aug 19, 2020

Pinging @velvia

Copy link
Member

@velvia velvia left a comment

Choose a reason for hiding this comment

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

@szymonm thanks, this is a great change. Sumac development has stopped and scallop has much more support, and this will give us much more flexibility to improve the verbosity of the CLI going forward.

Since the options aren't changing I don't think any changes to README are needed...

require(args.host.isDefined && args.dataset.isDefined && args.labelNames.isDefined, "--host, --dataset and --labelName must be defined")
val remote = Client.standaloneClient(system, args.host(), args.port())
val options = QOptions(args.limit(), args.sampleLimit(), args.everyNSeconds.map(_.toInt).toOption,
timeout, args.shards.map(_.map(_.toInt)).toOption, args.spread.toOption.map(Integer.valueOf))
Copy link
Member

Choose a reason for hiding this comment

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

Is Integer.valueOf for args.spread necessary? Spread is declared with opt[Int]....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

QOptions constructor takes Option[Integer] (don't know the reason, seems like unfounded inconsistency).

@broneill broneill merged commit bd629df into filodb:develop Aug 24, 2020
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.

None yet

3 participants