def diff(self, ulabel, vlabel, flags=['--name-only']): pulls = list(self.__get_pulls__()) ud, = filter(lambda x: ulabel == x['message'].split(':')[1], pulls) vd, = filter(lambda x: vlabel == x['message'].split(':')[1], pulls) with util.chinto(self.repo_path): res = util.__readProc__(['git', 'diff', '--color'] + flags + [ud['commit'], vd['commit']]) print("These files are different:") print(res)
def flor_plan(self, label): # Deprecated: keeping for backward compatibility pulls = self.__get_pulls__() with util.chinto(self.repo_path): for i, pull_d in enumerate(pulls): if label == pull_d['message'].split(':')[1]: util.__runProc__(['git', 'checkout', pull_d['commit']]) if not interactive: Source.from_file('output.gv').view() else: output_image = Source.from_file('output.gv') break util.__runProc__(['git', 'checkout', 'master']) return output_image
def __get_pulls__(self): with util.chinto(self.repo_path): ld = util.git_log() ld4 = [] d4 = {} for i, d in enumerate(ld): if ((i % 4) == 0): if i > 0: ld4.append(d4) d4 = {} d4.update(d) ld4.append(d4) pulls = filter(lambda x: 'pull' == x['message'].split(':')[0], ld4) return pulls
def summarize(self): # For now summarizes everything # TODO: get_next_block access method (history may be very long) pulls = self.__get_pulls__() semistructured_rep = [] columns = [ 'label', ] artifacts = [] with util.chinto(self.repo_path): for i, pull_d in enumerate(pulls): util.__runProc__(['git', 'checkout', pull_d['commit']]) eg = ExperimentGraph.deserialize() sinks = eg.sinks semistructured_rep.append({}) for sink_action in eg.actions_at_depth[max( eg.actions_at_depth.keys())]: if eg.d[sink_action].issubset(sinks): response = eg.summary_back_traverse(sink_action) for sink in eg.d[sink_action]: if type(sink).__name__[0:len('Literal' )] == "Literal": if sink.name not in columns: columns.insert(1, sink.name) response['Literal'] |= { sink, } else: response['Artifact'] |= { sink, } for v in response['Literal']: if v.name not in columns: columns.append(v.name) for v in response['Artifact']: if v.name not in columns: columns.append(v.name) artifacts.append(v.name) try: semistructured_rep[i][pull_d['message'] + ':' + str(id(sink))] = set( map( lambda x: (x.name, x.v), response['Literal'])) semistructured_rep[i][ pull_d['message'] + ':' + str(id(sink))] |= set( map( lambda x: (x.name, os.path.basename(x.isolated_loc)), response['Artifact'])) except: continue util.__runProc__(['git', 'checkout', 'master']) ltuples = [] for pull_container in semistructured_rep: for kee in pull_container: tuple = {} tuple['label'] = kee.split(':')[1] for name, value in pull_container[kee]: tuple[name] = value ltuples.append(tuple) # return pd.DataFrame(ltuples, columns=columns) return FlorFrame(data=ltuples, columns=columns, artifacts=artifacts)