MCPcopy
hub / github.com/hpcaitech/ColossalAI / check_running_list

Function check_running_list

tests/test_infer/test_request_handler.py:11–53  ·  view source on GitHub ↗

Test the RunningList Structure.

()

Source from the content-addressed store, hash-verified

9
10
11def check_running_list():
12 """
13 Test the RunningList Structure.
14 """
15 running_list = RunningList(prefill_ratio=1.2)
16 seq1 = Sequence(
17 request_id=1,
18 prompt="abc",
19 input_token_id=[1, 2, 3],
20 block_size=16,
21 eos_token_id=0,
22 pad_token_id=0,
23 sample_params=None,
24 )
25 seq2 = Sequence(
26 request_id=2,
27 prompt="abc",
28 input_token_id=[1, 2, 3],
29 block_size=16,
30 eos_token_id=0,
31 pad_token_id=0,
32 sample_params=None,
33 )
34 running_list.append(seq1)
35 running_list.append(seq2)
36 assert running_list.ready_for_prefill()
37 assert len(running_list.decoding) == 0
38 assert len(running_list.prefill) > 0 and running_list.prefill[0] == seq1
39
40 seq = running_list.find_seq(seq1.request_id)
41 assert seq == seq1
42
43 running_list.mark_prefill_running()
44 for seq in running_list.prefill:
45 assert seq.status == RequestStatus.RUNNING
46
47 running_list.move_prefill_to_decoding([seq1.request_id, seq2.request_id])
48 assert len(running_list.prefill) == 0
49 assert len(running_list.decoding) > 0 and running_list.decoding[0] == seq1
50
51 running_list.remove(seq1)
52 running_list.remove(seq2)
53 assert running_list.is_empty()
54
55
56def check_request_handler():

Callers 1

run_distFunction · 0.85

Calls 9

appendMethod · 0.95
ready_for_prefillMethod · 0.95
find_seqMethod · 0.95
mark_prefill_runningMethod · 0.95
removeMethod · 0.95
is_emptyMethod · 0.95
RunningListClass · 0.90
SequenceClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…