Skip to content
MyDSHMy DSH Field Notes
中文
Independently maintained; not affiliated with DeepSeek. No association with mydsh.dev or other MyDSH sites.

Home/Workspace & files/Batches & deep folders

Ten first, then a hundred: let the success rate decide

A hundred files to process; running them all risks a crash halfway or discovering the format was wrong only at the end.

VerifiedVersion and environmentChecked 2026-11-14
Tool
pymupdf with Python 3.13
Sample
100 synthetic PDFs, 1 in 5 with no text layer
Checked
2026-11-14

Copyable command

# ten first; widen the range only after confirming

Measured numbers, results before method:

BatchTotalOKFailedTimePer file
Full run10080202.46 s25 ms
First 101082about 0.25 s25 ms

The key finding: two of the first ten failed, already exposing a 20 percent failure rate. You do not need the full hundred to know the data has a problem. That is the entire value of trying ten — not saving time, but saving the discovery that the direction was wrong.

Check the equation

A batch job must satisfy exactly one equation:

total = successes + failures

It sounds trivial, but it is the only check that catches silent skipping. Here 80 + 20 = 100 holds. If your script says it processed 78, two files vanished — worse than failing, because you do not know which.

How to phrase the recipe

Process the first 10 PDFs under pdfs/, extracting the first 200 characters of body text from each.
Output:
- A table with columns: filename, character count, first 200 characters
- A final line: total / ok / failed / list of failures

Requirements: files with no extractable text must still appear, marked 'read failed'. Do not skip them.
Do only these 10 first; I will confirm the format before you continue.

That last sentence is the heart of it: one all-or-nothing gamble becomes two small confirmations.

What to change when scaling

  • Change only the range (first 10 to all). Do not change the output format — changing it throws away the confirmation you did.
  • If the full run must be batched, state the batch boundaries and how results merge.
  • First thing after the run: check the equation, then argue about content.

What counts as working

Check every line. All of them pass or the job is not done.

  • total equals successes plus failures
  • Every file in the failure list exists in the input
  • The output format is identical before and after scaling

Where it fails

Symptom, cause, what to do — written in the order it actually happens.

SymptomCauseWhat to do
Successes plus failures is less than the totalFiles silently skipped (exception caught without recording)Write failures into the table too, even as 'read error'
The first ten all pass and the full run is 20 percent failingThe sample was not random; failures cluster laterSample ten at random instead of taking the first ten

Sources

Verified means measured here. Compiled means every line carries a source.