99 "os"
1010 "path"
1111 "path/filepath"
12+ "slices"
1213 "strings"
1314 "time"
1415
@@ -76,6 +77,13 @@ func (s *Service) downloadOutputFiles(baseURL, runID, runOutputDir string) error
7677 "metrics-sequencer.json" ,
7778 }
7879
80+ requiredFiles := []string {
81+ "result-sequencer.json" ,
82+ "metrics-validator.json" ,
83+ "metrics-sequencer.json" ,
84+ "result-validator.json" ,
85+ }
86+
7987 // Structure output as output/<runId>/<outputDir>/
8088 localOutputDir := filepath .Join (s .config .OutputDir (), runID , runOutputDir )
8189 s .log .Info ("Downloading output files" , "runID" , runID , "runOutputDir" , runOutputDir , "localPath" , localOutputDir )
@@ -89,6 +97,9 @@ func (s *Service) downloadOutputFiles(baseURL, runID, runOutputDir string) error
8997 // Try to download the file
9098 err := s .downloadFile (fileURL , localFilePath )
9199 if err != nil {
100+ if ! slices .Contains (requiredFiles , fileName ) {
101+ return errors .Wrap (err , "failed to download file" )
102+ }
92103 s .log .Warn ("Failed to download file (continuing)" , "file" , fileName , "url" , fileURL , "error" , err )
93104 } else {
94105 s .log .Debug ("Downloaded file" , "file" , fileName , "localPath" , localFilePath )
@@ -150,15 +161,19 @@ func (s *Service) LoadSourceMetadata(source string) (*benchmark.RunGroup, error)
150161 // If we loaded from URL, download output files for each run
151162 if baseURL != "" {
152163 s .log .Info ("Downloading output files for all runs" , "baseURL" , baseURL )
164+ newMetadata := make ([]benchmark.Run , 0 , len (metadata .Runs ))
153165 for _ , run := range metadata .Runs {
154166 if run .OutputDir != "" {
155167 err := s .downloadOutputFiles (baseURL , run .ID , run .OutputDir )
156168 if err != nil {
157169 s .log .Warn ("Failed to download output files for run" , "runID" , run .ID , "outputDir" , run .OutputDir , "error" , err )
158170 // Continue with other runs even if one fails
171+ continue
159172 }
173+ newMetadata = append (newMetadata , run )
160174 }
161175 }
176+ metadata .Runs = newMetadata
162177 }
163178
164179 return & metadata , nil
0 commit comments