@@ -17,7 +17,7 @@ class ModelRun(DbObject):
17
17
created_by_id = Field .String ("created_by_id" , "createdBy" )
18
18
model_id = Field .String ("model_id" )
19
19
20
- def upsert_labels (self , label_ids , timeout_seconds = 600 ):
20
+ def upsert_labels (self , label_ids , timeout_seconds = 60 ):
21
21
""" Calls GraphQL API to start the MEA labels registration process
22
22
Args:
23
23
label_ids (list): label ids to insert
@@ -32,17 +32,24 @@ def upsert_labels(self, label_ids, timeout_seconds=600):
32
32
sleep_time = 5
33
33
34
34
mutation_name = 'createMEAModelRunLabelRegistrationTask'
35
- query_str = """mutation createMEAModelRunLabelRegistrationTaskByApi ($modelRunId: ID!, $labelIds : [ID!]!) {
35
+ create_task_query_str = """mutation createMEAModelRunLabelRegistrationTaskPyApi ($modelRunId: ID!, $labelIds : [ID!]!) {
36
36
%s(where : { id : $modelRunId}, data : {labelIds: $labelIds})}
37
- """ (mutation_name )
37
+ """ % (mutation_name )
38
38
39
- while True :
40
- res = self .client .execute (query_str , {
39
+ res = self .client .execute (create_task_query_str , {
41
40
'modelRunId' : self .uid ,
42
41
'labelIds' : label_ids
43
42
})
43
+ task_id = res [mutation_name ]
44
+
45
+ status_query_str = """query MEALabelRegistrationTaskStatusPyApi($where: WhereUniqueIdInput!){
46
+ MEALabelRegistrationTaskStatus(where: $where) {status errorMessage}
47
+ }
48
+ """
44
49
45
- res = res [mutation_name ]
50
+ while True :
51
+ res = self .client .execute (status_query_str , {'where' : {'id' : task_id }})['MEALabelRegistrationTaskStatus' ]
52
+ breakpoint ()
46
53
if res :
47
54
return res
48
55
0 commit comments