@@ -99,9 +99,35 @@ def __init__(self, *args, **kwargs):
9999
100100 super ().__init__ (* args , ** kwargs )
101101
102- def on_start (self ) -> None :
103- response = self .client .get ("/v0/me" , auth = self ._auth ) # fail fast
104- response .raise_for_status ()
102+ def on_stop (self ) -> None :
103+ if self ._script_uuid is not None :
104+ response = self .client .delete (
105+ f"/v0/files/{ self ._script_uuid } " ,
106+ name = "/v0/files/[file_id]" ,
107+ auth = self ._auth ,
108+ )
109+ response .raise_for_status ()
110+ if self ._input_json_uuid is not None :
111+ response = self .client .delete (
112+ f"/v0/files/{ self ._input_json_uuid } " ,
113+ name = "/v0/files/[file_id]" ,
114+ auth = self ._auth ,
115+ )
116+ response .raise_for_status ()
117+ if self ._function_uid is not None :
118+ response = self .client .delete (
119+ f"/v0/functions/{ self ._function_uid } " ,
120+ name = "/v0/functions/[function_uid]" ,
121+ auth = self ._auth ,
122+ )
123+ response .raise_for_status ()
124+ if self ._run_uid is not None :
125+ response = self .client .delete (
126+ f"/v0/function_jobs/{ self ._run_uid } " ,
127+ name = "/v0/function_jobs/[function_run_uid]" ,
128+ auth = self ._auth ,
129+ )
130+ response .raise_for_status ()
105131
106132 @task
107133 def run_function (self ):
@@ -132,7 +158,7 @@ def run_function(self):
132158 f"/v0/functions/{ self ._function_uid } :run" ,
133159 json = {"input_1" : f"{ self ._input_json_uuid } " },
134160 auth = self ._auth ,
135- name = "/v0/functions/{ function_uid} :run" ,
161+ name = "/v0/functions/[ function_uid] :run" ,
136162 )
137163 response .raise_for_status ()
138164 self ._run_uid = response .json ().get ("uid" )
@@ -143,7 +169,7 @@ def run_function(self):
143169 response = self .client .get (
144170 f"/v0/function_jobs/{ self ._run_uid } /status" ,
145171 auth = self ._auth ,
146- name = "/v0/function_jobs/{ function_run_uid} /status" ,
172+ name = "/v0/function_jobs/[ function_run_uid] /status" ,
147173 )
148174 response .raise_for_status ()
149175 status = response .json ().get ("status" )
0 commit comments