lablup / backend.ai

Backend.AI is a streamlined, container-based computing cluster platform that hosts popular computing/ML frameworks and diverse programming languages, with pluggable heterogeneous accelerator support including CUDA GPU, ROCm GPU, TPU, IPU and other NPUs.
https://www.backend.ai
GNU Lesser General Public License v3.0
513 stars 152 forks source link

Add tags for compute sessions #390

Open adrysn opened 2 years ago

adrysn commented 2 years ago

It will be useful for users or admins to add, remove, or filter compute sessions with tags just like we can tag AWS EC2 instances.

This issue depends on #325 to allow making foreign key refs to sessions, as tags will be represented as a many-to-many relation.

achimnol commented 2 years ago

Here is an old article about database schema design options for tags: http://howto.philippkeller.com/2005/04/24/Tags-Database-schemas/

Yaminyam commented 10 months ago

Currently, tags are implemented by simply adding a string. AWS is similarly implemented in the form of writing a string, but the difference is that it is stored in key-value format. It seems to be far from the many-to-many relationship discussed in the issue.

There is a need to discuss how to implement it, either using it in AWS or managing it as a many-to-many relationship.

Yaminyam commented 10 months ago

And since the tag function is currently implemented only in core, the webui must also respond to changes.

achimnol commented 10 months ago

Let's implement this as a simple one-level key-value JSON object (using the postgres JSONB column with a custom TypeDecorator), following the EC2's tag specification and the more formal ECS tag specification. Migrate the existing simple-string tags as {"Comment": "..."} by stripping the values to 256 characters.

To use it as filter from the web UI and control panel, we also need to implement several JSONB operators as the queryfilter minilang operators. Also we need to update the FieldSpec in the client SDK.