def before_run(self): source_file = self._obj.channel_handler.rcache_handler.abspath( self._fname) target_file = self._obj.channel_handler.ccache_handler.abspath( self._fname) File.force_move(source_file, target_file)
def write(self, data, cache_path=None, suffix='json'): path = self.get_realpath(cache_path) uuid = Random.get_uuid() name = '{0}.{1}'.format(uuid, suffix) temp = '{0}.{1}'.format(uuid, 'temp') file_path = os.path.join(path, name) temp_path = os.path.join(path, temp) File.write_content(data, temp_path) File.force_move(temp_path, file_path)
def put_ccache(self, fname): source_file = self.channel_handler.rcache_handler.abspath(fname) target_file = self.channel_handler.ccache_handler.abspath(fname) File.force_move(source_file, target_file)