cognite-sdk-python icon indicating copy to clipboard operation
cognite-sdk-python copied to clipboard

feat: Added support for new task type Tag Detection for Workflows

Open ronpal opened this issue 3 months ago • 10 comments

Description

Added new task type to Workflows based on spec

https://pr-2871.specs.preview.cogniteapp.com/20230101-internal.json.html#tag/Workflow-versions/operation/CreateOrUpdateWorkflowVersion

Checklist:

  • [x] Tests added/updated.
  • [x] Documentation updated. Documentation is generated from docstrings - these must be updated according to your change. If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.
  • [ ] The PR title follows the Conventional Commit spec.

ronpal avatar Sep 24 '25 10:09 ronpal

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with :thumbsup: and :thumbsdown: on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

gemini-code-assist[bot] avatar Sep 24 '25 10:09 gemini-code-assist[bot]

Codecov Report

:x: Patch coverage is 93.75000% with 5 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 90.98%. Comparing base (489c703) to head (16d9738). :warning: Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
cognite/client/data_classes/workflows.py 93.75% 5 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2342      +/-   ##
==========================================
+ Coverage   90.96%   90.98%   +0.01%     
==========================================
  Files         192      192              
  Lines       26138    26217      +79     
==========================================
+ Hits        23777    23853      +76     
- Misses       2361     2364       +3     
Files with missing lines Coverage Δ
cognite/client/data_classes/workflows.py 96.12% <93.75%> (+0.17%) :arrow_up:

... and 4 files with indirect coverage changes

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Sep 25 '25 07:09 codecov[bot]

Description

Added new task type to Workflows based on spec

https://pr-2871.specs.preview.cogniteapp.com/20230101-internal.json.html#tag/Workflow-versions/operation/CreateOrUpdateWorkflowVersion

Checklist:

  • [x] Tests added/updated.
  • [x] Documentation updated. Documentation is generated from docstrings - these must be updated according to your change. If a new method has been added it should be referenced in cognite.rst in order to generate docs based on its docstring.
  • [ ] The PR title follows the Conventional Commit spec.

Seems the taskType is not updated in the API docs: image

doctrino avatar Sep 26 '25 07:09 doctrino

One thing to consider, should we have raise an alpha warning everytime a TagDetectionParameter is initialized? I assume this feature is in alpha?

doctrino avatar Sep 26 '25 08:09 doctrino

One thing to consider, should we have raise an alpha warning everytime a TagDetectionParameter is initialized? I assume this feature is in alpha?

It is in private beta, does the same apply?

ronpal avatar Sep 26 '25 09:09 ronpal

This looks good. Could you please add unit tests for the new classes? Since they contain custom logic for serialization/deserialization in methods like _load and dump, it's important to ensure that logic is covered.

Just to narrow this a bit, any object inheriting from e.g. CogniteObject or -Resource are automatically picked up and tested in a variety of ways.

Other class hierarchies must be tested, e.g. subclasses of WorkflowTaskOutput which just inherits from ABC.

haakonvt avatar Sep 29 '25 12:09 haakonvt

Sorry for the late review, was on vacation.

Making some last changes to the API spec before the testing is commencing (out-of-sync updates and some small breaking changes). Will write a summary here when ready.

Waiting for this PR to be merged on the Jazz side: https://github.com/cognitedata/jazz-api/pull/1913

VerstraeteBert avatar Oct 01 '25 13:10 VerstraeteBert

The pr above has been merged. @ronpal @VerstraeteBert

queCognite avatar Oct 08 '25 12:10 queCognite

@ronpal Summary of changes:

  • More possible statuses for a Tag Detection Job:
                  [
                   "Queued",
                   "Distributing",
                   "Distributed",
                   "Loading Entities",
                   "Loaded Entities",
                   "Running",
                   "Detected",
                   "Annotated",
                   "Collecting",
                   "Completed",
                   "Failed",
                   "Timeout",
                 ]
  • An errorMessage (str | null) is added to both the Job and SubJobs.
  • A minimum of 1 file is expected for the fileInstanceIds
  • entityFilters takes [1; 10] filters.

VerstraeteBert avatar Oct 08 '25 13:10 VerstraeteBert

@ronpal Summary of changes:

  • More possible statuses for a Tag Detection Job:
                  [
                   "Queued",
                   "Distributing",
                   "Distributed",
                   "Loading Entities",
                   "Loaded Entities",
                   "Running",
                   "Detected",
                   "Annotated",
                   "Collecting",
                   "Completed",
                   "Failed",
                   "Timeout",
                 ]
  • An errorMessage (str | null) is added to both the Job and SubJobs.
  • A minimum of 1 file is expected for the fileInstanceIds
  • entityFilters takes [1; 10] filters.

@VerstraeteBert can you please review again? These are the commits that address these changes 👆

https://github.com/cognitedata/cognite-sdk-python/pull/2342/commits/94c180166c81565d75206a15050f0753956fa78a https://github.com/cognitedata/cognite-sdk-python/pull/2342/commits/8f15c0ad8b1aba17cea38cbf494c39249ac1bfd9 https://github.com/cognitedata/cognite-sdk-python/pull/2342/commits/cbc70087cdc615a06de4f499ef7cf625fa64f7fb

ronpal avatar Oct 09 '25 08:10 ronpal

/gemini review

thorkildcognite avatar Nov 16 '25 22:11 thorkildcognite