User-friendly operators
Una pull request collegata è già stata integrata.
- #2109 di @nuclearcat — integrata
Valutazione
- Difficoltà
- 5/5
- Tempo stimato
- Più di una settimana
- Idoneità per principianti
- 20/100
Direzione di ricerca
Inizia tracciando l'analisi delle query della riga di comando kci e la gestione degli operatori dell'URL API descritta nell'issue, quindi esamina gli operatori delle query MongoDB come riferimento. La modifica completata dovrebbe avere una progettazione chiaramente circoscritta di operatori e sintassi che gestisca gli operatori combinati e i vincoli pertinenti della CLI o dei nomi degli attributi, facendo sì che le query di esempio si comportino come previsto.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
The current syntax for operators on the command line is the same as in the API URLs, with a __ separator between the attribute name and an operator. For example, to count the number of kernel revisions (checkout nodes) since the beginning of the Early Access phase:
$ ./kci node count created__gt=2023-09-04 name=checkout
38
This works, however there are a few things that could be improved:
Combining operators doesn't work
This should return the number of nodes for the 1-day period, but instead it only takes into account the 2nd query parameter:
$ kci node count created__gt=2023-09-04 created__lt=2023-09-05 name=checkout
166
Deal with attributes that have __ in their name
Some test suites might well have __ in their name or particular jobs might generate custom data including it in their attributes. While we could make it invalid and the API would be rejecting such data, we could also look for other ways to encode the operators in the URLs. At the very least, we could just make it invalid to name attributes that end with an operator name. For example, foo_bar would still be valid, and even foo__bar__baz, but not foo_gte or foo_bar_lt as gte and lt as known operators.
Consider additional operators
The current 4 operators were added out of necessity for the initial use-cases we had. A fully-fledged system would need to be able to deal with a broader range of use cases and as such more operators are likely to be required. See the list of MongoDB operators as a reference, they could all be implemented very easily since internally the API uses MongoDB (at least the comparison ones).
Probably we could already just add the ne (not equal) operator to the list, in fact it's quite surprising we got this far without needing it.
Command-line syntax
While some improvements can be made on the API side to provide features and define any constraints with attribute names, the CLI syntax offered by kci could also be made simpler. Right now, it's quite easy to forget one underscore and doing created_lt=2024 will not match anything as that's looking for an attribute called created_lt.
If we wanted to keep it as-is and just pass the search parameters to the URL, we could have a check in kci if the attribute name ends with a known operator and print a warning to the user.
On top of this, we could also provide some symbols such as <, <=, == etc. as equivalents to the operator acronyms. A sample command line would then look like this:
$ kci node count "created > 2023-09-04" "created <= 2023-09-05" name=checkout
Please note that this would involve lots of characters that aren't very usable on the command line: < and > are used for redirecting streams, ! is a magic character in most shells to do things like running a previous command and = is used by parsers for arguments that take a value. So while making the queries more human-readable on the CLI is a good idea, it doesn't seem obviously better to just use these symbols. One option would be to create an interactive parser e.g. kci shell and then any characters could be used without interfering the main OS shell.
- Lingua principale
- Python
- Stelle
- 10
- Fork
- 21
- Merge medio
- 22m
- PR unite (30g)
- 1
Preparare l'ambiente
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di kernelci/kernelci-api
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
kernelci/kernelci-api#706 ·
-
Components/Maestro/API/Local instance says GET /latest/ should return some JSON, but it doesn'tForse di nuovo libera Una pull request per questa issue è stata chiusa senza essere unita. Apertadocumentation
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
kernelci/kernelci-api#632 · 1 commento ·
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 20/100
kernelci/kernelci-api#629 ·
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
kernelci/kernelci-api#608 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
kernelci/kernelci-api#597 · 2 commenti ·
Tutte le issue di kernelci/kernelci-api
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
NousResearch/hermes-agent#136483 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] LazyStackedTensorDictStore zeroes the last byte of a new key set on the last elementForse già presa @peterdsharpe l’ha presa oggi. Apertabug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
pytorch/tensordict#2307 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
GrokModel.generate/a_generate pass an OpenAI-style list-of-dicts to xai_sdk.chat.user(), so every call crashes with a protobuf TypeError before any network I/OForse già presa @Christian-Sidak l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
confident-ai/deepeval#3436 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno