@@ -160,23 +160,12 @@ def store_custom_data(self, key, value):
160160 assert (
161161 self .env .JOB_NAME == "Config Workflow"
162162 ), "Custom data can be stored only in Config Workflow Job"
163- custom_data = {key : value }
164- if Path (Settings .CUSTOM_DATA_FILE ).is_file ():
165- with open (Settings .CUSTOM_DATA_FILE , "r" , encoding = "utf8" ) as f :
166- custom_data = json .load (f )
167- custom_data [key ] = value
168- with open (Settings .CUSTOM_DATA_FILE , "w" , encoding = "utf8" ) as f :
169- json .dump (custom_data , f , indent = 4 )
163+ workflow_config = RunConfig .from_fs (self .env .WORKFLOW_NAME )
164+ workflow_config .custom_data [key ] = value
165+ workflow_config .dump ()
170166
171167 def get_custom_data (self , key = None ):
172- # todo: remove intermediary file CUSTOM_DATA_FILE and store/get directly to/from RunConfig
173- if Path (Settings .CUSTOM_DATA_FILE ).is_file ():
174- # first check CUSTOM_DATA_FILE in case data is not yet in RunConfig
175- # might happen if data stored in one pre-hook and fetched in another
176- with open (Settings .CUSTOM_DATA_FILE , "r" , encoding = "utf8" ) as f :
177- custom_data = json .load (f )
178- else :
179- custom_data = RunConfig .from_fs (self .env .WORKFLOW_NAME ).custom_data
168+ custom_data = RunConfig .from_fs (self .env .WORKFLOW_NAME ).custom_data
180169 if key :
181170 return custom_data .get (key , None )
182171 return custom_data
0 commit comments