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

[CELEBORN-1764][CIP-11] Adding support for TagsQL for filtering workers tags #2980

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

s0nskar
Copy link
Contributor

@s0nskar s0nskar commented Dec 8, 2024

What changes were proposed in this pull request?

Added support for TagsQL, which uses key/value pair to give workers tags more context.
The TagsQL supports the following syntax:

  • Match single value: key:value
  • Negate single value: key:!value
  • Match list of values: key:{value1,value2}
  • Negate list of values: key:!{value1,value2}

Example tags expression: env:production region:{us-east,us-west} env:!sandbox
This tags expression will select all of the workers that have the following tags:

  • env=production
  • region=us-east or region=us-west

and will ignore all of the workers that have the following tags:

  • env=sandbox

Why are the changes needed?

Current/default supported tags expression is very basic which select the workers with all the mentioned tags. TagsQL will allow more flexibility and extensibility to workers tags.

Does this PR introduce any user-facing change?

NA

How was this patch tested?

UTs

@s0nskar s0nskar changed the title Adding support for TagsQL for filtering workers tags [CELEBORN-1764][CIP-11] Adding support for TagsQL for filtering workers tags Dec 8, 2024
@s0nskar s0nskar marked this pull request as ready for review December 8, 2024 13:58
/**
* TagsQL uses key/value pair to give your tags more context.
*
* The query language supports the following syntax:
Copy link
Contributor

Choose a reason for hiding this comment

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

In what scenarios might you need this functionality?

Can the following rules align with your goal?
tag1,tag2 | tag3,tag4 | tag5,tag6

In the expression above, tag1 and tag2 are combined using a logical AND, just like tag3 and tag4. The results of tag1 AND tag2 and tag3 AND tag4 are combined using a logical OR.


private def parseToken(token: String): Node = {
token match {
case Pattern(key, condition, values, value) =>
Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather not use regex, as there can always be bugs in regex engines that may lead to unexpected outcomes.

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.

2 participants