Skip to content

Commit c0e8e43

Browse files
author
Matt Sokoloff
committed
wip
1 parent 9c1782f commit c0e8e43

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

labelbox/schema/model_run.py

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class ModelRun(DbObject):
1717
created_by_id = Field.String("created_by_id", "createdBy")
1818
model_id = Field.String("model_id")
1919

20-
def upsert_labels(self, label_ids, timeout_seconds=600):
20+
def upsert_labels(self, label_ids, timeout_seconds=60):
2121
""" Calls GraphQL API to start the MEA labels registration process
2222
Args:
2323
label_ids (list): label ids to insert
@@ -32,17 +32,24 @@ def upsert_labels(self, label_ids, timeout_seconds=600):
3232
sleep_time = 5
3333

3434
mutation_name = 'createMEAModelRunLabelRegistrationTask'
35-
query_str = """mutation createMEAModelRunLabelRegistrationTaskByApi($modelRunId: ID!, $labelIds : [ID!]!) {
35+
create_task_query_str = """mutation createMEAModelRunLabelRegistrationTaskPyApi($modelRunId: ID!, $labelIds : [ID!]!) {
3636
%s(where : { id : $modelRunId}, data : {labelIds: $labelIds})}
37-
""" (mutation_name)
37+
""" % (mutation_name)
3838

39-
while True:
40-
res = self.client.execute(query_str, {
39+
res = self.client.execute(create_task_query_str, {
4140
'modelRunId': self.uid,
4241
'labelIds': label_ids
4342
})
43+
task_id = res[mutation_name]
44+
45+
status_query_str = """query MEALabelRegistrationTaskStatusPyApi($where: WhereUniqueIdInput!){
46+
MEALabelRegistrationTaskStatus(where: $where) {status errorMessage}
47+
}
48+
"""
4449

45-
res = res[mutation_name]
50+
while True:
51+
res = self.client.execute(status_query_str, {'where': {'id': task_id}})['MEALabelRegistrationTaskStatus']
52+
breakpoint()
4653
if res:
4754
return res
4855

0 commit comments

Comments
 (0)