Spaces:
Sleeping
Sleeping
John Segreto commited on
Commit ·
f10576c
1
Parent(s): e88b7dc
add time travel
Browse files602 unmodified lines6036046056066076086097 unmodified lines6176186196206216226238 unmodified lines63263363463563663763833 unmodified lines672673674675676677678602 unmodified linesfor state in self.graph.get_state_history(self.thread):if state.metadata['step'] < 1:continuethread_ts = state.config['configurable']['thread_ts']tid = state.config['configurable']['thread_id']count = state.values['count']lnode = state.values['lnode']7 unmodified linesdef find_config(self,thread_ts):for state in self.graph.get_state_history(self.thread):config = state.configif config['configurable']['thread_ts'] == thread_ts:return configreturn(None)8 unmodified linesstate = self.graph.get_state(config)self.graph.update_state(self.thread, state.values, as_node=state.values['lnode'])new_state = self.graph.get_state(self.thread) #should now matchnew_thread_ts = new_state.config['configurable']['thread_ts']tid = new_state.config['configurable']['thread_id']count = new_state.values['count']lnode = new_state.values['lnode']33 unmodified linesfor state in self.graph.get_state_history(self.thread):if state.metadata['step'] < 1: #ignore early statescontinues_thread_ts = state.config.get('configurable', {}).get('thread_ts', None)#s_thread_ts = state.config['configurable']['thread_ts']s_tid = state.config['configurable']['thread_id']s_count = state.values['count']602 unmodified lines6036046056066076086097 unmodified lines6176186196206216226238 unmodified lines63263363463563663763833 unmodified lines672673674675676677678602 unmodified linesfor state in self.graph.get_state_history(self.thread):if state.metadata['step'] < 1:continuethread_ts = state.config['configurable']['checkpoint_id']tid = state.config['configurable']['thread_id']count = state.values['count']lnode = state.values['lnode']7 unmodified linesdef find_config(self,thread_ts):for state in self.graph.get_state_history(self.thread):config = state.configif config['configurable']['checkpoint_id'] == thread_ts:return configreturn(None)8 unmodified linesstate = self.graph.get_state(config)self.graph.update_state(self.thread, state.values, as_node=state.values['lnode'])new_state = self.graph.get_state(self.thread) #should now matchnew_thread_ts = new_state.config['configurable']['checkpoint_id']tid = new_state.config['configurable']['thread_id']count = new_state.values['count']lnode = new_state.values['lnode']33 unmodified linesfor state in self.graph.get_state_history(self.thread):if state.metadata['step'] < 1: #ignore early statescontinues_thread_ts = state.config.get('configurable', {}).get('checkpoint_id', None)#s_thread_ts = state.config['configurable']['thread_ts']s_tid = state.config['configurable']['thread_id']s_count = state.values['count']
app.py+4-4