@@ -30,23 +30,8 @@ proc replayMultitrace*(archivePath: string, indexDiff: bool = false): bool =
3030 echo fmt" ERROR: couldn't import the trace with name { traceDir.extractFilename} from the multitrace "
3131 quit (1 )
3232
33- # TODO : improve this: use paths or temp folder or read from zip
34- # currently we pass them through as CLI args, but they're probably with limited memory/size
35- var structuredDiffJson = " "
36- var indexDiffJson = " "
37-
3833 var structuredDiffPath = outputFolder / " diff.json"
39- try :
40- structuredDiffJson = readFile (structuredDiffPath)
41- except CatchableError : # assume file read error for now
42- # if no diff.json recorded: that's ok
43- # we might have just a multitrace to replay multiple traces at once without a diff
44- # in the future
45- structuredDiffPath = " "
46- structuredDiffJson = " "
47-
4834 var diffIndexPath = " "
49- echo " index diff " , indexDiff
5035
5136 if indexDiff:
5237 let backend = if trace.lang.isDbBased:
@@ -61,40 +46,38 @@ proc replayMultitrace*(archivePath: string, indexDiff: bool = false): bool =
6146
6247 var eventualDiffIndexPath = outputFolder / " diff_index.json"
6348 if not fileExists (eventualDiffIndexPath):
64- let process = startProcess (backend, args = @ [" index-diff" , structuredDiffJson , traceDir, outputFolder], options= {poParentStreams})
49+ let process = startProcess (backend, args = @ [" index-diff" , structuredDiffPath , traceDir, outputFolder], options= {poParentStreams})
6550 let exitCode = waitForExit (process)
6651
6752 if exitCode == 0 :
6853 # replace with an archive with the indexed data
6954 removeFile (archivePath)
7055 zipFolder (outputFolder, archivePath)
7156 diffIndexPath = eventualDiffIndexPath
72- indexDiffJson = readFile (diffIndexPath)
7357 else :
7458 echo " WARN: a problem with indexing diff: no diff index"
75- diffIndexPath = " " # some kind of a problem
76- indexDiffJson = " "
59+ diffIndexPath = " " # some kind of a problem # indexDiffJson = ""
7760
7861 # if ok: trace patched, diff indexed: archive still accessible
79- # remove only the temp extracted folder
62+ # remove only the temp extracted folder: ok here for index-diff; not for `replay` in the next case for now
8063 removeDir (outputFolder)
8164 return false # this means it shouldn't restart: for now restart maybe supported in dev mode only for replays
8265 else :
8366 var eventualDiffIndexPath = outputFolder / " diff_index.json"
8467 if fileExists (eventualDiffIndexPath):
8568 diffIndexPath = eventualDiffIndexPath
86- indexDiffJson = readFile (eventualDiffIndexPath)
8769 else :
8870 diffIndexPath = " "
89- indexDiffJson = " "
90-
71+
9172 # trace imported, diff and eventually index copied: archive still accessible
92- # remove only the temp extracted folder
93- removeDir (outputFolder)
73+ # remove only the temp extracted folder?
74+ # TODO : stopped removing it (or remove after replay):
75+ # decide what to do for this folder: for now depend on it for index/run:
76+ # removeDir(outputFolder)
9477
9578 let recordCore = envLoadRecordCore ()
9679
97- return runRecordedTrace (trace, test= false , structuredDiffJson = structuredDiffJson, indexDiffJson = indexDiffJson , recordCore= recordCore)
80+ return runRecordedTrace (trace, test= false , structuredDiffPath = structuredDiffPath, indexDiffPath = diffIndexPath , recordCore= recordCore)
9881
9982proc indexDiff * (multitracePath: string ) =
10083 discard replayMultitrace (multitracePath, indexDiff= true )
0 commit comments