Skip to content

Add DisconncetedTask #1767

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 1 commit into from
Aug 19, 2024
Merged

Add DisconncetedTask #1767

merged 1 commit into from
Aug 19, 2024

Conversation

vbrodsky
Copy link
Contributor

@vbrodsky vbrodsky commented Aug 12, 2024

Description

The idea is to improve user experience for long waits. For example, for large data upload tasks, they would have to use code similar to

    task = dataset.create_data_rows(data_rows)
    task.wait_till_done()
    assert task.status == "COMPLETE"

And for long waits the task times out

DisconnectedTask offers an alternative approach

  task = dataset.create_data_rows(data_rows) # record task.id

Some time later

    dt = DisconnectedTask(client, task.uid)
    assert dt.is_completed()
    assert dt.status() == "COMPLETE"
    dt.result()

Currently we just support Task and DataUpsertTask. We will support the ExportTask with this story

)

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • 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

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

New Feature Submissions

  • Does your submission pass tests?
  • Have you added thorough tests for your new feature?
  • 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?

@vbrodsky vbrodsky requested a review from a team as a code owner August 12, 2024 18:34
@vbrodsky vbrodsky force-pushed the VB/task-waiter_PLT-1077 branch 3 times, most recently from 8b7713d to eabad36 Compare August 14, 2024 17:23
return task


class DisconnectedTask:
Copy link
Contributor

Choose a reason for hiding this comment

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

What's the value add of DisconnectedTask?

The value add is being able to surface a Task by task_id which is provided by TaskFactory.

Personally, I would avoid adding an additional type if it's only purpose is delegation.

class TaskFactory:

@classmethod
def get(cls, client, task_id) -> SupportsTaskQueries:
Copy link
Contributor

Choose a reason for hiding this comment

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

This method is redundant as it has the same method parameters as get_task_by_id.

I would not include both as it will only create confusion.

@vbrodsky vbrodsky force-pushed the VB/task-waiter_PLT-1077 branch from eabad36 to 6c9ebbf Compare August 19, 2024 19:26
@vbrodsky vbrodsky requested a review from mrobers1982 August 19, 2024 19:26
Copy link
Contributor

@mrobers1982 mrobers1982 left a comment

Choose a reason for hiding this comment

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

Looks good, I would update the PR title and description to accurately reflect the (updated) implementation.

@vbrodsky vbrodsky merged commit 27c77b9 into develop Aug 19, 2024
15 of 25 checks passed
@vbrodsky vbrodsky deleted the VB/task-waiter_PLT-1077 branch August 19, 2024 21:01
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