Skip to content

Conversation

@richardsun0713
Copy link
Contributor

  • Added new entity TaskQueue
  • Added new methods in Project:
    • Obtain a list of TaskQueues owned by the Project
    • Move a list of data rows to a specified TaskQueue

if status != "COMPLETE":
raise LabelboxError(f"Data rows were not moved successfully")

def _wait_for_task(self, task_id: str):
Copy link
Contributor

Choose a reason for hiding this comment

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

Have you considered using our existing Task class for this? _wait_for_task looks similar to Task.refresh()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The Task class is specialized to handle data rows as the result type, but I can make it work without breaking existing usages

"""
data_rows = [dr.uid for dr in list(dataset.data_rows())]
batch_project.create_batch("test-batch", data_rows)
editor = list(
Copy link
Contributor

Choose a reason for hiding this comment

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

Looks like a lot of the code after this is shared between this and configured_project_with_label. Could you create a helper function for the ontology setup + label creation part?

for field_values in task_queue_values
]

def move_data_rows_to_task(self, data_row_ids: List[str],
Copy link
Contributor

@kkim-labelbox kkim-labelbox Feb 16, 2023

Choose a reason for hiding this comment

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

nit: move_data_rows_to_task_queue sounds more accurate, or even add_data_rows_to_task_queue?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update it to move_data_rows_to_task_queue, but keep the action as move for consistency with the UI equivalent


status = self._wait_for_task(task_id)
if status != "COMPLETE":
raise LabelboxError(f"Data rows were not moved successfully")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a way we can show the error message from the task to users?

from labelbox.orm.model import Field


class TaskQueue(DbObject):
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add this class as an entry in docs/source/index.rst to be indexed for readthedocs.
More details https://labelbox.atlassian.net/wiki/spaces/AIENG/pages/1721139216/Release+a+new+Python+SDK+Version#Documentation-Updates

project.create_label = create_label
project.create_label()
label = wait_for_label_processing(project)[0]
ontology = _setup_ontology(project)
Copy link
Contributor

Choose a reason for hiding this comment

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

So clean!

raise LabelboxError(f"Data rows were not moved successfully")
task = self._wait_for_task(task_id)
if task.status != "COMPLETE":
raise LabelboxError(f"Data rows were not moved successfully: " +
Copy link
Contributor

Choose a reason for hiding this comment

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

What type of Task is this job? Currently, Task.errors only returns value for a JSON Import task

"""
# TODO: We should handle error messages for export v2 tasks in the future.
if self.name != 'JSON Import':
if (self.name != 'JSON Import') & (self.name != 'Move data rows to step'):
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mnoszczak I'm going to add another exception here so we don't break your test, but let's aim to fix this for all tasks soon

Copy link
Contributor

@kkim-labelbox kkim-labelbox left a comment

Choose a reason for hiding this comment

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

Code looks good to me. Please resolve the merge conflict, and make sure the SDK tests run

@richardsun0713 richardsun0713 force-pushed the rsun/QQC-1484 branch 2 times, most recently from 079dfbe to f51cf8d Compare February 18, 2023 01:10
@richardsun0713 richardsun0713 merged commit db4e5ba into develop Feb 20, 2023
@richardsun0713 richardsun0713 deleted the rsun/QQC-1484 branch February 20, 2023 18:02
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.

3 participants