@@ -116,16 +116,16 @@ def _handle_requests(self):
116116 # Mock consumption status check - all consumed
117117 response_body = {
118118 "partition_id" : request_msg .body .get ("partition_id" ),
119- "global_index" : torch .tensor ([0 ,1 , 2 ]),
120- "consumption_status" : torch .tensor ([1 ,1 , 1 ]),
119+ "global_index" : torch .tensor ([0 , 1 , 2 ]),
120+ "consumption_status" : torch .tensor ([1 , 1 , 1 ]),
121121 }
122122 response_type = ZMQRequestType .CONSUMPTION_RESPONSE
123123 elif request_msg .request_type == ZMQRequestType .GET_PRODUCTION :
124124 # Mock production status check - all produced
125125 response_body = {
126126 "partition_id" : request_msg .body .get ("partition_id" ),
127- "global_index" : torch .tensor ([0 ,1 , 2 ]),
128- "production_status" : torch .tensor ([[1 ,1 , 1 ],[1 ,1 , 1 ]]),
127+ "global_index" : torch .tensor ([0 , 1 , 2 ]),
128+ "production_status" : torch .tensor ([[1 , 1 , 1 ], [1 , 1 , 1 ]]),
129129 }
130130 response_type = ZMQRequestType .PRODUCTION_RESPONSE
131131 elif request_msg .request_type == ZMQRequestType .GET_LIST_PARTITIONS :
@@ -469,6 +469,52 @@ def test_check_production_status(client_setup):
469469 assert is_produced is True
470470
471471
472+ def test_get_consumption_status (client_setup ):
473+ """Test get_consumption_status - returns global_index and consumption_status tensors"""
474+ client , _ , _ = client_setup
475+
476+ # Test synchronous get_consumption_status
477+ global_index , consumption_status = client .get_consumption_status (
478+ task_name = "generate_sequences" , partition_id = "train_0"
479+ )
480+
481+ # Verify return types
482+ assert global_index is not None
483+ assert consumption_status is not None
484+
485+ # Verify global_index contains expected values
486+ assert torch .equal (global_index , torch .tensor ([0 , 1 , 2 ], dtype = torch .long ))
487+
488+ # Verify consumption_status (mock returns all consumed)
489+ expected_status = torch .tensor ([1 , 1 , 1 ], dtype = torch .int8 )
490+ assert torch .equal (consumption_status , expected_status )
491+
492+ print ("✓ get_consumption_status returns correct global_index and consumption_status" )
493+
494+
495+ def test_get_production_status (client_setup ):
496+ """Test get_production_status - returns global_index and production_status tensors"""
497+ client , _ , _ = client_setup
498+
499+ # Test synchronous get_production_status
500+ global_index , production_status = client .get_production_status (
501+ data_fields = ["prompt_ids" , "attention_mask" ], partition_id = "train_0"
502+ )
503+
504+ # Verify return types
505+ assert global_index is not None
506+ assert production_status is not None
507+
508+ # Verify global_index contains expected values
509+ assert torch .equal (global_index , torch .tensor ([0 , 1 , 2 ], dtype = torch .long ))
510+
511+ # Verify production_status shape (mock returns 2x3 matrix)
512+ expected_status = torch .tensor ([[1 , 1 , 1 ], [1 , 1 , 1 ]], dtype = torch .int8 )
513+ assert torch .equal (production_status , expected_status )
514+
515+ print ("✓ get_production_status returns correct global_index and production_status" )
516+
517+
472518def test_get_partition_list (client_setup ):
473519 """Test partition list retrieval"""
474520 client , _ , _ = client_setup
@@ -504,6 +550,54 @@ async def test_async_check_production_status(client_setup):
504550 assert is_produced is True
505551
506552
553+ @pytest .mark .asyncio
554+ async def test_async_get_consumption_status (client_setup ):
555+ """Test async get_consumption_status - returns global_index and consumption_status tensors"""
556+ client , _ , _ = client_setup
557+
558+ # Test async_get_consumption_status
559+ global_index , consumption_status = await client .async_get_consumption_status (
560+ task_name = "generate_sequences" , partition_id = "train_0"
561+ )
562+
563+ # Verify return types
564+ assert global_index is not None
565+ assert consumption_status is not None
566+
567+ # Verify global_index contains expected values
568+ assert torch .equal (global_index , torch .tensor ([0 , 1 , 2 ], dtype = torch .long ))
569+
570+ # Verify consumption_status (mock returns all consumed)
571+ expected_status = torch .tensor ([1 , 1 , 1 ], dtype = torch .int8 )
572+ assert torch .equal (consumption_status , expected_status )
573+
574+ print ("✓ async_get_consumption_status returns correct global_index and consumption_status" )
575+
576+
577+ @pytest .mark .asyncio
578+ async def test_async_get_production_status (client_setup ):
579+ """Test async get_production_status - returns global_index and production_status tensors"""
580+ client , _ , _ = client_setup
581+
582+ # Test async_get_production_status
583+ global_index , production_status = await client .async_get_production_status (
584+ data_fields = ["prompt_ids" , "attention_mask" ], partition_id = "train_0"
585+ )
586+
587+ # Verify return types
588+ assert global_index is not None
589+ assert production_status is not None
590+
591+ # Verify global_index contains expected values
592+ assert torch .equal (global_index , torch .tensor ([0 , 1 , 2 ], dtype = torch .long ))
593+
594+ # Verify production_status shape (mock returns 2x3 matrix)
595+ expected_status = torch .tensor ([[1 , 1 , 1 ], [1 , 1 , 1 ]], dtype = torch .int8 )
596+ assert torch .equal (production_status , expected_status )
597+
598+ print ("✓ async_get_production_status returns correct global_index and production_status" )
599+
600+
507601@pytest .mark .asyncio
508602async def test_async_get_partition_list (client_setup ):
509603 """Test async partition list retrieval"""
0 commit comments