@@ -74,6 +74,22 @@ def annotation_groups(self):
74
74
lambda client , res : AnnotationGroup (client , self .model_id , res ),
75
75
['annotationGroups' , 'pageInfo' , 'endCursor' ])
76
76
77
+ def delete_model_runs (self ):
78
+ """ Deletes specified model run.
79
+
80
+ Returns:
81
+ Query execution success.
82
+ """
83
+ ids_param = "ids"
84
+ query_str = """mutation DeleteModelRunPyApi($%s: [ID!]! {
85
+ deleteModelRuns(where: {ids: $%s}) {%s}}""" % (
86
+ ids_param , ids_param
87
+ )
88
+ res = self .client .execute (query_str , {
89
+ ids_param : self .uid
90
+ })
91
+ return res
92
+
77
93
78
94
class AnnotationGroup (DbObject ):
79
95
label_id = Field .String ("label_id" )
@@ -89,3 +105,23 @@ def url(self):
89
105
app_url = self .client .app_url
90
106
endpoint = f"{ app_url } /models/{ self .model_id } /{ self .model_run_id } /AllDatarowsSlice/{ self .uid } ?view=carousel"
91
107
return endpoint
108
+
109
+ def delete_annotation_groups (self , data_row_ids ):
110
+ """ Deletes annotation groups by data row ids for a model run.
111
+
112
+ Args:
113
+ data_row_ids (list): List of data row ids to delete annotation groups.
114
+ Returns:
115
+ Query execution success.
116
+ """
117
+ model_run_id_param = "modelRunId"
118
+ data_row_ids_param = "dataRowIds"
119
+ query_str = """mutation DeleteModelRunDataRowsPyApi($%s: ID!, $%s: [ID!]! {
120
+ deleteModelRunDataRows(where: {modelRunId: $%s, dataRowIds: $%s}) {%s}}""" % (
121
+ model_run_id_param , data_row_ids_param , model_run_id_param , data_row_ids_param
122
+ )
123
+ res = self .client .execute (query_str , {
124
+ model_run_id_param : self .model_run_id ,
125
+ data_row_ids_param : data_row_ids
126
+ })
127
+ return res
0 commit comments