@@ -119,12 +119,35 @@ def run_function(self):
119119 function = Function (
120120 title = "Test function" ,
121121 description = "Test function" ,
122- default_inputs = {},
122+ default_inputs = {"input_0" : f" { self . _script_uuid } " },
123123 )
124124 response = self .client .post (
125125 "/v0/functions" , json = function .model_dump (), auth = self ._auth
126126 )
127127 response .raise_for_status ()
128+ self ._function_uid = response .json ().get ("uid" )
129+ assert self ._function_uid is not None
130+
131+ response = self .client .post (
132+ f"/v0/functions/{ self ._function_uid } :run" ,
133+ json = {"input_1" : f"{ self ._input_json_uuid } " },
134+ auth = self ._auth ,
135+ name = "/v0/functions/{function_uid}:run" ,
136+ )
137+ response .raise_for_status ()
138+ self ._run_uid = response .json ().get ("uid" )
139+ assert self ._run_uid is not None
140+
141+ is_done = False
142+ while not is_done :
143+ response = self .client .get (
144+ f"/v0/function_jobs/{ self ._run_uid } /status" ,
145+ auth = self ._auth ,
146+ name = "/v0/function_jobs/{function_run_uid}/status" ,
147+ )
148+ response .raise_for_status ()
149+ status = response .json ().get ("status" )
150+ is_done = status in ["DONE" , "FAILED" ]
128151
129152 def upload_file (self , file : Path ) -> UUID :
130153 assert file .is_file ()
0 commit comments