An untyped empty trace table can turn job-time subtraction into str minus str
Symptom#
analyze_trace() fails in get_job_time with TypeError: unsupported operand type(s) for -: 'str' and 'str' while Dask computes expression metadata.
Cause#
The read path can return an empty table without numeric column types. One reproduced trigger is a directory with no top-level .pfw or .pfw.gz files: the reader does not search subdirectories. An older in-process path can also produce an untyped empty table when files contain only profile events.
Fix#
For the no-file case, point trace_path at the directory directly containing the trace files. Reject zero discovered files in python/dftracer/analyzer/dftracer.py with No .pfw or .pfw.gz files found directly in <path> (subdirectories are not searched). Do not diagnose every str-minus-str report as a no-file case without checking the actual input.
Evidence#
Transcript 0c8b1fa03a reports reproducing the exact traceback with a subdirectory-only fixture, then a regression test in tests/test_read_paths.py that failed before and passed after the zero-file guard. The collaborator's actual input was unavailable. The older profile-only path was diagnosed but not fixed in this extract; the separate NullClient fix does not address this error.
Also found by searching
- TypeError: unsupported operand type(s) for -: 'str' and 'str' in get_job_time
- analyze_trace crashes with Dask metadata error on my trace directory
- why does dfanalyzer find no trace files in a directory with subfolders
- empty dataframe without numeric dtypes, pfw files not searched recursively
- analyze_trace fails in dask metadata computation with empty trace dataframe
- how do I fix analyze_trace when trace_path contains subfolders of .pfw.gz files?
- dftracer analyzer No .pfw or .pfw.gz files found, reader doesn't search subdirectories, empty table untyped