-
Notifications
You must be signed in to change notification settings - Fork 68
[QQC-1484] Support move to task action #919
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
Conversation
richardsun0713
commented
Feb 16, 2023
- 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
labelbox/schema/project.py
Outdated
| if status != "COMPLETE": | ||
| raise LabelboxError(f"Data rows were not moved successfully") | ||
|
|
||
| def _wait_for_task(self, task_id: str): |
There was a problem hiding this comment.
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()
There was a problem hiding this comment.
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
tests/integration/conftest.py
Outdated
| """ | ||
| data_rows = [dr.uid for dr in list(dataset.data_rows())] | ||
| batch_project.create_batch("test-batch", data_rows) | ||
| editor = list( |
There was a problem hiding this comment.
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?
labelbox/schema/project.py
Outdated
| for field_values in task_queue_values | ||
| ] | ||
|
|
||
| def move_data_rows_to_task(self, data_row_ids: List[str], |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
labelbox/schema/project.py
Outdated
|
|
||
| status = self._wait_for_task(task_id) | ||
| if status != "COMPLETE": | ||
| raise LabelboxError(f"Data rows were not moved successfully") |
There was a problem hiding this comment.
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): |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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: " + |
There was a problem hiding this comment.
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
labelbox/schema/task.py
Outdated
| """ | ||
| # 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'): |
There was a problem hiding this comment.
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
af6baf0 to
f185f4b
Compare
kkim-labelbox
left a comment
There was a problem hiding this 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
079dfbe to
f51cf8d
Compare
f51cf8d to
7195550
Compare