Skip to content

chore: add multipart dep for fastapi - #895

Merged
zhyncs merged 1 commit into
sgl-project:mainfrom
zhyncs:dep
Aug 2, 2024
Merged

zhyncs merged 1 commit into
sgl-project:mainfrom
zhyncs:dep

Conversation

@zhyncs

@zhyncs zhyncs commented Aug 2, 2024

Copy link
Copy Markdown
Contributor

Motivation

fix

root@hostname:/# python -m sglang.launch_server --model-path  casperhansen/llama-3-8b-instruct-awq  --disable-radix-cache
Form data requires "python-multipart" to be installed.
You can install "python-multipart" with:

pip install python-multipart

Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/usr/local/lib/python3.10/dist-packages/sglang/launch_server.py", line 5, in <module>
    from sglang.srt.server import launch_server
  File "/usr/local/lib/python3.10/dist-packages/sglang/srt/server.py", line 162, in <module>
    async def openai_v1_files(file: UploadFile = File(...), purpose: str = Form("batch")):
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 944, in decorator
    self.add_api_route(
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 883, in add_api_route
    route = route_class(
  File "/usr/local/lib/python3.10/dist-packages/fastapi/routing.py", line 519, in __init__
    self.body_field = get_body_field(dependant=self.dependant, name=self.unique_id)
  File "/usr/local/lib/python3.10/dist-packages/fastapi/dependencies/utils.py", line 817, in get_body_field
    check_file_field(final_field)
  File "/usr/local/lib/python3.10/dist-packages/fastapi/dependencies/utils.py", line 100, in check_file_field
    raise RuntimeError(multipart_not_installed_error) from None
RuntimeError: Form data requires "python-multipart" to be installed.
You can install "python-multipart" with:

pip install python-multipart

Modification

as titled

Checklist

  1. Ensure pre-commit pre-commit run --all-files or other linting tools are used to fix potential lint issues.
  2. Confirm that modifications are covered by complete unit tests. If not, please add more unit tests for correctness.
  3. Modify documentation as needed, such as docstrings or example tutorials.

@zhyncs
zhyncs merged commit 046c2b3 into sgl-project:main Aug 2, 2024
@zhyncs
zhyncs deleted the dep branch August 2, 2024 14:50
timethink pushed a commit to timethink/sglang that referenced this pull request Mar 9, 2025
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 26, 2026
…e, and record the re-run's known limit

The exit-6 comment still said the serial lane is not re-run; it is, since the
same commit's later cut. And the limit found by the live run belongs next to
the code it limits: the re-run happens on this box seconds after the lane it
classifies, so it inherits the lane's residue. test_pp_admission_wraparound_
never_blocks is 5/5 green alone on a settled box and failed the gate's own
re-run straight after the serial lane. The error runs toward GENUINE, toward
red -- the re-run can call a load artefact real, never the reverse. A settling
delay or a quarantine re-run is owed, not built.

Arms re-run after the edit: 11/11 pass.
efschu pushed a commit to efschu/htsglang that referenced this pull request Aug 26, 2026
…nrecorded failure ALONE and says which kind it is) into the flip train
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 3, 2026
…the stashed-frame budget is keyed to the frame and counts arrivals at its own slot

Both reviewer BLOCKERS fixed at their root, not at the symptom.

BLOCKER A -- the launched-pass set survived the ring rebuild.
`_pp_launched_pending` is ring-scoped bookkeeping (slot numbers of the
ring that launched them), but `pp_flip_forget_ring_scoped_slots` -- the
function whose own sgl-project#829 docstring claims to own exactly that class --
did not clear it. A retraction rebuilds the ring, `arm()`'s quiescence
precondition then reads a slot from the DEAD ring and defers for ever:
the TP-sticky shape the reviewer named. Fix is one statement in the
designated authority, and it CLEARS rather than intersects with
`range(pp_loop_size)` -- the ring is rebuilt EMPTY two statements after
the call, so an in-range survivor would be exactly as wrong as an
out-of-range one.

BLOCKER B -- the stashed-frame budget could stop the group falsely.
The counter was neither keyed to a frame nor to an armed window, and
counted loop VISITS. Three corrections, each with its own test:

  (a) keyed to (arm epoch, frame stamp) -- back-to-back frames each get
      their own budget instead of summing into a false STOP, and a
      disarm cannot leave a count for the next window. Every early
      return of `_pp_flip_hold_slot` now forgets the window through
      `_1173_forget_stashed_frame`; in the TP phase the bound is 4, so a
      single inherited visit changes the verdict.

  (b) a visit counts only when the loop ARRIVES AT THE SLOT THE FRAME
      NAMES. That is what the STOP claims -- "the receive kept getting
      the chance and still did not take it" -- and it is the only form
      that is reachable on the TP ring: `pp_loop_size` is 1 there,
      `mb_id` is 0 on every iteration and never CHANGES, so an
      mb_id-change detector would have been structurally unfireable
      exactly where the bound is smallest. Own mutant M6 proves it.

  (c) unreadable live slot or unreadable frame slot => the budget does
      not advance at all. An instrument that cannot measure the chance
      it counts must never fire a group stop.

Arm side: the deferral was unbounded and its warning unrated. It is now
bounded on FORWARD PROGRESS -- a frozen (outstanding slots, fwd_ct) for
longer than `launched_pass_stall_s` (default 120 s) escalates to the
same named STOP, ring progress restarts the clock. Bounding on deferral
COUNT was rejected: `arm()` is driven from the receive poll, so a count
bound fires at a rate set by client traffic. The ARM DEFERRED warning is
rate-limited like the sibling sgl-project#1020 guard (<=3 or every 512) and carries
`deferrals=` and `streak=` so a suppressed gap stays readable.

Non-blocking items taken: N4 (the reported `queue=` term is the same
reading the verdict used, not a re-derivation), N5 (the sgl-project#731 argument
restated for all three in-flight pairs at the loop), N8
(`pending_prefill_terms` declared rank-DIVERGENT by construction --
weg1b4 measured 5739 on PP0 vs 3827 on PP1 -- reporting only, no
cross-rank ballot), N9 (the in-flight billing test now uses a request
whose `extend_range.end` is below its total, so removing the resident
dedup guard actually changes the number).

EVIDENCE
  red-first, reviewed HEAD c32eac6 (test file copied into a scratch
    worktree): 16 failed / 8 passed of 24. 13 are blocker-targeted; 3
    are collateral (the file now passes `launched_pass_stall_s` to the
    runtime constructor, which does not exist there) -- named, not
    hidden.
  fixed tree: 24 passed.
  mutants, all against the fixed tree, all DEAD:
    M1 launched-set clear removed              -> 2 failed
    M2 count every visit, not arrivals         -> 1 failed
    M3 frame identity dropped from the key     -> 1 failed
    M4 arm-side escalation neutralised         -> 1 failed
    M5 early returns no longer forget          -> 1 failed
    M6 mb_id-change detector instead of arrival-> 2 failed
    M7 stall clock never restarts on progress  -> 1 failed
    M3 and M5 SURVIVED a first round and drove two of the corrections
    above -- recorded, not quietly re-run.
  sibling test_pp_flip_slot_hold_631.py: 8 failed / 11 passed on both
    the reviewed HEAD and the fixed tree (its stand-in now binds
    `_1173_forget_stashed_frame`; without that it was 15 failed).
  ruff check parity over python/sglang/srt/managers/ +
    test/registered/unit/managers/: 466 == 466 errors on both trees
    (all pre-existing); ruff format: the three production files were
    already dirty on the parent, both new test additions are formatted.
  matched check (D1) re-run on the fixed tree: the three tests of
    TestTheDrainedPremiseCountsLaunchedWork pass -- an empty
    waiting_queue with chunked remainder 1912 and a launched slot reads
    pending == 1912, not 0. Its mutant M-D1 (drop the in-flight
    remainder term at scheduler.py `pending += inflight_tokens`) turns
    exactly those assertions red: 2 failed / 22 passed. Tree restored
    and re-verified byte-identical afterwards.
  bounded suite, test/registered/unit/managers, -n 8, one run each:
    parent scratch c32eac6: 263 failed / 4678 passed / 18 skipped /
      12 errors / 565 subtests passed (568.75 s)
    fixed tree:                248 failed / 4693 passed / 18 skipped /
      12 errors / 565 subtests passed (573.82 s)
    comm of the sorted FAILED/ERROR node-id sets: 16 names cured (all
    of them the red-first test_arm_quiescence_1173.py cases -- the
    count matches the red-first tally exactly), and ONE name appears
    only on the fixed side:
      test_pp_proxy_readiness_contract_789.py::PPProxyReadinessContract789
        ::test_shipped_gate_raises_named_diagnostic_instead_of_wedging
    That is NOT a regression and was verified, not assumed: run solo,
    that test PASSES on the fixed tree while a DIFFERENT member of the
    same file fails -- and the parent scratch produces the identical
    solo result (1 failed / 3 passed, same member). The failing member
    of that module wanders between runs; this diff touches neither the
    module nor its production file. Known sgl-project#899/sgl-project#895 PP-proxy family
    (NOT_CROWDING_PROVABLE).

DEVIATIONS
  N2 is implemented here, not deferred as the earlier report said.
  N3 (drain-and-flip queue axis) stays open by design; N6 (D2b is a
  rank-local refinement of a rank-local predicate) and N7 (two
  authorities for one notion: `_inflight_ids` slot occupancy vs
  `_pp_launched_pending` launch bookkeeping) stand as named residue.
  N11: the earlier report's red-first arithmetic was wrong and is
  re-measured above. N12: the follower-side raise is rank-local by
  construction and its message now says what it counted.
  No boot. Desk only.
efschu pushed a commit to efschu/htsglang that referenced this pull request Sep 12, 2026
…precondition is named

(D) THE GAP, measured on a real run: `union - recorded` is what gets
adjudicated, so a RECORDED failure never reaches a solo re-run and never reaches
a verdict class. Boot-gate reader weg2xsn19 hit it: the two
`test_acceptance_emitters_758.py::RefillTiming` names sat in a 246-name failure
set while the summary said 240 genuine + 4 inconclusive, and the two were in
NEITHER. A diff taken against the GENUINE list instead of the failure set would
have read them as NEW the moment they surfaced on the other side -- a false
regression verdict out of a bookkeeping gap.

This is item 5 of this module's own docstring turned on its head: that one
forbids handing an UNRECORDED failure to the reader unclassified (sgl-project#895), and the
leak was an unclassified RECORDED one. Same rule, other axis.

THE CHANGE IS REPORT-ONLY: `rc` untouched, the adjudication set untouched, the
names stay in `union` exactly as before. They now leave the run under a printed
`RECORDED` class naming the module whose `ref_failures` they belong to, the way
EXCLUDED and DEMOTED are already reported rather than footnoted.

DOCSTRING CORRECTED WITH ITS COUNTER-EXAMPLE, not just marked stale: the claim
"every recorded failure belongs to an EXCLUDED module, so ... EVERY desk failure
is unrecorded" held when written and does not now. Of the four modules carrying
`ref_failures`, three are EXCLUDED and
`test/registered/unit/mem_cache/test_acceptance_emitters_758.py` is PARALLEL --
it runs at the desk and brings two recorded failures with it.

COUNT CHECK ON THE REAL base.log, not a synthetic fixture:
  union (failure set)        246
  RECORDED & ran               2   (both RefillTiming, 1 module)
  unrecorded (adjudicated)   244 = 240 GENUINE + 4 INCONCLUSIVE
  2 + 244 = 246                    and the 240 GENUINE are disjoint from the pair
That also retroactively explains the "two names in no class" finding: they were
never adjudicated BECAUSE they are recorded. Now they carry a class.

GUARD PROVEN LOAD-BEARING by mutation: with a wrong `ran`, bare `recorded` would
print 15 names from the three EXCLUDED modules that never ran; `recorded & union`
holds at 2. The intersection is what keeps a recorded failure of a module that
did not fail here out of the printed class.

NO UNIT TEST AND NO HELPER EXTRACTION, BY OPERATOR RULING -- recorded here so it
is not read as an omission. Making a print testable would mean extracting a
helper from the gate script while TWO verdict pairs are running on exactly that
script, which is the wrong order. The print path executes on the next gate run
anyway, so it will be METAL-PROVEN rather than unit-tested, and for a report
line that is the cheaper truth. The arithmetic behind it is already proven
against the real base.log above, which is the part that could be wrong.

(C) NO CODE CHANGE, AND THE PROPOSED ANCHOR WOULD HAVE BEEN A REGRESSION.
The ^ERROR trap is MINE, not the harness's: my ad-hoc `grep -c '^ERROR '` read
26 where pytest reported 11. `gate_partition_lib.parse_log` already strips ANSI
first, matches the keyword only -- deliberately, because pytest-subtests builds
`SUBFAILED(abandon="'no_quorum'")` with arbitrary user text, so a field-position
rule cannot find the name on every real line -- and requires a NODE_ID shape that
rejects `file.py:LINE`, which is exactly the product-logger form. Keyword lines
without a node id are counted as `unnamed_lines` and PRINTED in the tally gate,
not dropped. Measured on the real wide.log: errors=4 distinct / error_lines=11 /
unnamed_lines=15 -- and 26 - 11 = 15, so the whole difference is already
accounted for by name. Anchoring on `^ERROR test/` would have BROKEN the
rootdir-relative ERROR form that COLLECT_BANNER documents, and SUBFAILED's
arbitrary description. All three axes were already pinned by
test_gate_partition_lib_1207.py (t2 product-logger, t1/t7 SUBFAILED shapes, ANSI
at :555); 31/31 pass. FAILED and SUBFAILED do NOT share an anchor deficiency:
it is one form on three axes and it was already fixed as one.

CAN-FAIL IN BOTH DIRECTIONS, executed:
  planted product-logger ERROR -> errors unchanged, unnamed 0->1   (must not move)
  planted real pytest ERROR    -> errors 1->2                      (must move)
  planted real fixture ERROR   -> errors 1->2                      (must move)
  ANSI-wrapped FAILED          -> counted                          (must move)
  SUBFAILED(desc)              -> counted                          (must move)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant