File tree Expand file tree Collapse file tree
python/fusion_engine_client/utils Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import fnmatch
22import glob
3+ import json
34import os
45
56from . import trace as logging
@@ -303,11 +304,26 @@ def _search_directory(dir_path):
303304 _logger .info ("File '%s' not found. Searching for a matching log." % input_path )
304305
305306 try :
307+ candidate_files = list (candidate_files ) + [MANIFEST_FILE_NAME ]
306308 matches = find_log_by_pattern (input_path , log_base_dir = log_base_dir ,
307309 log_test_filenames = candidate_files , return_test_file = True )
308310 log_dir = matches [0 ][0 ]
309311 log_id = matches [0 ][1 ]
310312 input_path = matches [0 ][2 ]
313+
314+ # If we didn't find one of the recognized log filenames, but instead found a manifest file, load the
315+ # manifest and use that to infer the input filename.
316+ if os .path .basename (input_path ) == MANIFEST_FILE_NAME :
317+ manifest_path = input_path
318+ input_path = None
319+ with open (manifest_path , 'rt' ) as f :
320+ manifest = json .load (f )
321+ channels = manifest .get ('channels' , [])
322+ if len (channels ) > 0 :
323+ input_path = os .path .join (log_dir , channels [0 ])
324+ if input_path is None or not os .path .exists (input_path ):
325+ raise FileNotFoundError (
326+ "Found manifest file in '%s' but could not find corresponding log file." % log_dir )
311327 except RuntimeError as e :
312328 # Multiple matching directories found.
313329 raise e
You can’t perform that action at this time.
0 commit comments