Project

General

Profile

Actions

Feature #18574

closed

Helper methods for working with vocabularies

Added by Peter Amstutz about 3 years ago. Updated almost 3 years ago.

Status:
Resolved
Priority:
Normal
Assigned To:
Category:
SDKs
Target version:
Story points:
-
Release relationship:
Auto

Description

Add features to Python SDK to make it easier to work with the vocabularies introduced in 2.3.1. Should include fetching the vocabulary, and methods that make it simple to perform lookups using both standardized ids and aliases.

Use design from ticket #18651


Subtasks 2 (0 open2 closed)

Task #18776: Review 18574-pysdk-vocabulary-supportResolvedPeter Amstutz03/01/2022Actions
Task #18821: Add documentation to cookbookResolvedLucas Di Pentima03/01/2022Actions

Related issues 4 (2 open2 closed)

Related to Arvados Epics - Idea #17454: Vocabulary checking of properties by API server/controllerResolved10/01/202103/31/2022Actions
Related to Arvados - Feature #18576: arv-put converts properties aliases to vocabulary idsNewActions
Related to Arvados - Feature #18810: PySDK API Client wrapper methods that automatically translate properties using a vocabularyNewActions
Blocked by Arvados - Feature #18645: Design for search in dialogue window to select ProjectResolvedPeter Amstutz02/09/2022Actions
Actions #1

Updated by Peter Amstutz about 3 years ago

  • Status changed from New to In Progress
Actions #2

Updated by Peter Amstutz about 3 years ago

  • Description updated (diff)
Actions #3

Updated by Peter Amstutz about 3 years ago

  • Related to Idea #17454: Vocabulary checking of properties by API server/controller added
Actions #4

Updated by Peter Amstutz about 3 years ago

  • Related to Feature #18576: arv-put converts properties aliases to vocabulary ids added
Actions #5

Updated by Peter Amstutz about 3 years ago

  • Description updated (diff)
Actions #6

Updated by Peter Amstutz about 3 years ago

  • Target version set to 2022-02-02 sprint
Actions #7

Updated by Peter Amstutz about 3 years ago

  • Status changed from In Progress to New
Actions #8

Updated by Peter Amstutz almost 3 years ago

  • Blocked by Feature #18645: Design for search in dialogue window to select Project added
Actions #9

Updated by Peter Amstutz almost 3 years ago

  • Target version changed from 2022-02-02 sprint to 2022-02-16 sprint
Actions #11

Updated by Peter Amstutz almost 3 years ago

  • Description updated (diff)
Actions #12

Updated by Peter Amstutz almost 3 years ago

  • Target version changed from 2022-02-16 sprint to 2022-03-02 sprint
Actions #13

Updated by Lucas Di Pentima almost 3 years ago

  • Assigned To set to Lucas Di Pentima
Actions #14

Updated by Lucas Di Pentima almost 3 years ago

  • Status changed from New to In Progress
Actions #15

Updated by Lucas Di Pentima almost 3 years ago

Updates at 062d4e0 - branch 18574-pysdk-vocabulary-support
Test run: developer-run-tests: #2935

  • Updates arvados.api to be able to fetch the vocabulary definition exported by the controller.
  • Adds vocabulary.Vocabulary, vocabulary.VocabularyKey and vocabulary.VocabularyValue classes adding the following features:
    • Case-insensitive key/value indexing.
    • Conversion to/from identifiers/labels.
    • Preferred label retrieval for every key or value.
  • Adds vocabulary.load_vocabulary() function that accepts an API client object so that it loads the corresponding vocabulary definition.
  • Adds tests.

Pending

  • Wrapper methods that translates properties on get, list, update, create, etc as requested by Tom.
Actions #16

Updated by Lucas Di Pentima almost 3 years ago

Updates at 13c8401a8
Test run: developer-run-tests: #2936

  • Fixes doc test failures.
Actions #17

Updated by Lucas Di Pentima almost 3 years ago

Re-running failed test run: developer-run-tests-remainder: #3071

Actions #18

Updated by Lucas Di Pentima almost 3 years ago

From chat with Tom: We'll make a separate ticket for the wrapping functions on the api client object and look for feedback from developers on how this would be useful.

https://dev.arvados.org/issues/18810

Actions #19

Updated by Lucas Di Pentima almost 3 years ago

  • Related to Feature #18810: PySDK API Client wrapper methods that automatically translate properties using a vocabulary added
Actions #20

Updated by Peter Amstutz almost 3 years ago

18574-pysdk-vocabulary-support @ 13c8401a89d34cc412e76ade8f112a31b9988e4f

  • It looks like convert_to_identifiers() / convert_to_labels() doesn't handle lists in the "value" position.
Actions #21

Updated by Lucas Di Pentima almost 3 years ago

Updates at a480283b6 - developer-run-tests: #2939

  • Adds support for value list conversion.
  • Adds tests.
  • Generalize conversion code to avoid duplication.
Actions #22

Updated by Lucas Di Pentima almost 3 years ago

  • Target version changed from 2022-03-02 sprint to 2022-03-16 sprint
Actions #23

Updated by Lucas Di Pentima almost 3 years ago

Updates at b6ffac07e - developer-run-tests: #2940

  • Fixes a bug for cases when a key doesn't have any values defined.
  • Adds a couple of cookbook examples to the docs.
Actions #24

Updated by Peter Amstutz almost 3 years ago

What happens for when calling _convert_to_what with non-string property values:

  • null
  • a number
  • an object
  • a list containing these
Actions #25

Updated by Peter Amstutz almost 3 years ago

Also, the cookbook entries using the REPL are inconsistent with the other cookbook entries which are small standalone programs, I think a standalone code snippet showing "Translating between vocabulary identifiers and labels" would be most useful.

Actions #26

Updated by Lucas Di Pentima almost 3 years ago

Updates at 1d7078e64 - developer-run-tests: #2942

  • Fixes cookbook recipes formatting.
  • Improves type checking on keys & values.
  • Improves code's layout to minimize nesting try: except: blocks.
  • Adds tests.
Actions #27

Updated by Peter Amstutz almost 3 years ago

Lucas Di Pentima wrote:

Updates at 1d7078e64 - developer-run-tests: #2942

  • Fixes cookbook recipes formatting.
  • Improves type checking on keys & values.
  • Improves code's layout to minimize nesting try: except: blocks.
  • Adds tests.

LGTM

Actions #28

Updated by Lucas Di Pentima almost 3 years ago

  • % Done changed from 0 to 100
  • Status changed from In Progress to Resolved

Applied in changeset arvados-private:commit:arvados|a154e1e469ea09fd7a54b79367a811dac673d058.

Actions #29

Updated by Peter Amstutz almost 3 years ago

  • Release set to 46
Actions

Also available in: Atom PDF