Skip to content

Add tasks to organization and TaskStatus to filter tasks #1958

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

Merged
merged 5 commits into from
Mar 20, 2025

Conversation

paulnoirel
Copy link
Contributor

@paulnoirel paulnoirel commented Mar 14, 2025

Description

To help customers with monitoring their tasks (especially the number of tasks in progress) we are adding the following:

  • Organization.tasks() to list all tasks in the Organization
  • TaskStatus which is a new enumeration, useful to filter tasks
  • Task.status_as_enum attribute of type TaskStatus to match the type used in GraphQL and allow filters. Updating the type of Task.status (string) would introduce a breaking change.

cancel_type() is also updated to useTaskStatus to check if the task is in progress, and throw an error if the task does not have a cancelable type.

Example:

# Organization level: all tasks visible, like in the Notifications tab in the UI
organization = client.get_organization()
org_tasks_in_progress = organization.tasks(where=Task.status_as_enum == TaskStatus.In_Progress)

# Filter on user created tasks
user = client.get_user()
user_task_failed = user.created_tasks(where=Task.status_as_enum == TaskStatus.Failed)

Notes:

  • TaskStatus uses the Unknow attribute if the value for Tasks.status_as_enum doesn't match an existing type.
  • OrganizationTasksWhereInput will require some changes for Task filtering to reach its full potential (aka filtering with AND at least)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [ X] New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Document change (fix typo or modifying any markdown files, code comments or anything in the examples folder only)

All Submissions

  • [ X] Have you followed the guidelines in our Contributing document?
  • [ X] Have you provided a description?
  • [ X] Are your changes properly formatted?

New Feature Submissions

  • [ X] Does your submission pass tests?
  • [ X] Have you added thorough tests for your new feature?
  • [ X] Have you commented your code, particularly in hard-to-understand areas?
  • Have you added a Docstring?

Changes to Core Features

  • Have you written new tests for your core changes, as applicable?
  • Have you successfully run tests with your changes locally?
  • Have you updated any code comments, as applicable?

Copy link
Contributor

@mnoszczak mnoszczak left a comment

Choose a reason for hiding this comment

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

Well done, lgtm!

Copy link
Contributor

@mnoszczak mnoszczak left a comment

Choose a reason for hiding this comment

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

[gw16] [ 93%] FAILED [2025-03-20 13:10:06] tests/data/export/streamable/test_export_data_rows_streamable.py::TestExportDataRow::test_cancel_export_task

@paulnoirel paulnoirel merged commit bf3ff3a into develop Mar 20, 2025
24 of 26 checks passed
@paulnoirel paulnoirel deleted the pno/PLT-2505_organization_tasks branch March 20, 2025 14:30
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