-
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| from labelbox.orm.db_object import DbObject | ||
| from labelbox.orm.model import Field | ||
|
|
||
|
|
||
| class TaskQueue(DbObject): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add this class as an entry in |
||
| """ | ||
| a task queue | ||
| Attributes | ||
| name | ||
| description | ||
| queue_type | ||
| data_row_count | ||
| Relationships | ||
| project | ||
| organization | ||
| pass_queue | ||
| fail_queue | ||
| """ | ||
|
|
||
| name = Field.String("name") | ||
| description = Field.String("description") | ||
| queue_type = Field.String("queue_type") | ||
| data_row_count = Field.Int("data_row_count") | ||
|
|
||
| def __init__(self, client, *args, **kwargs): | ||
| super().__init__(client, *args, **kwargs) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -311,18 +311,39 @@ def configured_project_with_label(client, rand_gen, image_url, project, dataset, | |
| One label is already created and yielded when using fixture | ||
| """ | ||
| project.datasets.connect(dataset) | ||
| editor = list( | ||
| project.client.get_labeling_frontends( | ||
| where=LabelingFrontend.name == "editor"))[0] | ||
|
|
||
| ontology_builder = OntologyBuilder(tools=[ | ||
| Tool(tool=Tool.Type.BBOX, name="test-bbox-class"), | ||
| ]) | ||
| project.setup(editor, ontology_builder.asdict()) | ||
| # TODO: ontology may not be synchronous after setup. remove sleep when api is more consistent | ||
| time.sleep(2) | ||
| ontology = _setup_ontology(project) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So clean! |
||
| label = _create_label(project, datarow, ontology, wait_for_label_processing) | ||
|
|
||
| yield [project, dataset, datarow, label] | ||
|
|
||
| for label in project.labels(): | ||
| label.delete() | ||
|
|
||
|
|
||
| @pytest.fixture | ||
| def configured_batch_project_with_label(client, rand_gen, image_url, | ||
| batch_project, dataset, datarow, | ||
| wait_for_label_processing): | ||
| """Project with a batch having one datarow | ||
| Project contains an ontology with 1 bbox tool | ||
| Additionally includes a create_label method for any needed extra labels | ||
| One label is already created and yielded when using fixture | ||
| """ | ||
| data_rows = [dr.uid for dr in list(dataset.data_rows())] | ||
| batch_project.create_batch("test-batch", data_rows) | ||
|
|
||
| ontology = _setup_ontology(batch_project) | ||
| label = _create_label(batch_project, datarow, ontology, | ||
| wait_for_label_processing) | ||
|
|
||
| yield [batch_project, dataset, datarow, label] | ||
|
|
||
| for label in batch_project.labels(): | ||
| label.delete() | ||
|
|
||
|
|
||
| ontology = ontology_builder.from_project(project) | ||
| def _create_label(project, datarow, ontology, wait_for_label_processing): | ||
| predictions = [{ | ||
| "uuid": str(uuid.uuid4()), | ||
| "schemaId": ontology.tools[0].feature_schema_id, | ||
|
|
@@ -342,7 +363,8 @@ def create_label(): | |
| Creates a LabelImport task which will create a label | ||
| """ | ||
| upload_task = LabelImport.create_from_objects( | ||
| client, project.uid, f'label-import-{uuid.uuid4()}', predictions) | ||
| project.client, project.uid, f'label-import-{uuid.uuid4()}', | ||
| predictions) | ||
| upload_task.wait_until_done(sleep_time_seconds=5) | ||
| assert upload_task.state == AnnotationImportState.FINISHED, "Label Import did not finish" | ||
| assert len( | ||
|
|
@@ -352,11 +374,20 @@ def create_label(): | |
| project.create_label = create_label | ||
| project.create_label() | ||
| label = wait_for_label_processing(project)[0] | ||
| return label | ||
|
|
||
| yield [project, dataset, datarow, label] | ||
|
|
||
| for label in project.labels(): | ||
| label.delete() | ||
| def _setup_ontology(project): | ||
| editor = list( | ||
| project.client.get_labeling_frontends( | ||
| where=LabelingFrontend.name == "editor"))[0] | ||
| ontology_builder = OntologyBuilder(tools=[ | ||
| Tool(tool=Tool.Type.BBOX, name="test-bbox-class"), | ||
| ]) | ||
| project.setup(editor, ontology_builder.asdict()) | ||
| # TODO: ontology may not be synchronous after setup. remove sleep when api is more consistent | ||
| time.sleep(2) | ||
| return ontology_builder.from_project(project) | ||
|
|
||
|
|
||
| @pytest.fixture | ||
|
|
||
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 Importtask