Skip to content
This repository was archived by the owner on Jan 21, 2026. It is now read-only.

Sync with dev 0830 - #5

Merged
0oshowero0 merged 2 commits into
mainfrom
dev
Aug 30, 2025
Merged

0oshowero0 merged 2 commits into
mainfrom
dev

Conversation

@0oshowero0

Copy link
Copy Markdown
Member

No description provided.

Copilot AI review requested due to automatic review settings August 30, 2025 07:30
@0oshowero0
0oshowero0 merged commit bcda21b into main Aug 30, 2025

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR synchronizes changes from the dev branch, focusing on refactoring the data storage system to improve data handling efficiency and code organization. The changes replace the previous row/column-based data structure with a more structured approach using global/local indexes and column data dictionaries.

Key changes include:

  • Refactored data storage structure from row/column-based to global/local index-based approach
  • Added new StorageUnitData class for improved data management
  • Removed unused PUT_FULL_ERROR enum value and simplified response structures

Reviewed Changes

Copilot reviewed 3 out of 21 changed files in this pull request and generated 4 comments.

File Description
transfer_queue/zmq_utils.py Removes unused PUT_FULL_ERROR enum value
transfer_queue/data_system.py Major refactoring of data storage system with new StorageUnitData class and improved data handling
recipe/simple_use_case/start_transferqueue.py Minor adjustments to parent directory path and sleep timing

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

"""
def __init__(self, storage_size: int):
# Dict containing column names and corresponding data in the column (e.g. {"column_name1": [data1, data2, ...]})
self.column_data: Dict[str: List] = {}

Copilot AI Aug 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The type annotation syntax is incorrect. It should be Dict[str, List] instead of Dict[str: List] (missing comma).

Suggested change
self.column_data: Dict[str: List] = {}
self.column_data: Dict[str, List] = {}

Copilot uses AI. Check for mistakes.
# Number of elements stored in storage unit
self.storage_size = storage_size

def get_data(self, columns: List[str], local_indexes: List[int]) -> TensorDict[str, List]:

Copilot AI Aug 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return type annotation TensorDict[str, List] is inconsistent. Based on the implementation, it should return TensorDict without generic parameters, as TensorDict is being used as a constructor in the return statement.

Suggested change
def get_data(self, columns: List[str], local_indexes: List[int]) -> TensorDict[str, List]:
def get_data(self, columns: List[str], local_indexes: List[int]) -> TensorDict:

Copilot uses AI. Check for mistakes.

for col in columns:
if len(local_indexes) == 1:
result[col] = list(self.column_data[col][local_indexes[0]])

Copilot AI Aug 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When len(local_indexes) == 1, wrapping the result in list() may cause unexpected behavior if self.column_data[col][local_indexes[0]] is already a single item rather than an iterable. This could raise a TypeError.

Suggested change
result[col] = list(self.column_data[col][local_indexes[0]])
result[col] = [self.column_data[col][local_indexes[0]]]

Copilot uses AI. Check for mistakes.
Comment on lines +503 to 504
self.data_production_status[indexes, [self.column_name_mapping.get(col) for col in columns]] = 1

Copilot AI Aug 30, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The indexes parameter should be converted to a tensor and the column mapping list should handle potential None values. If any column is not in the mapping, get() returns None which will cause indexing errors.

Suggested change
self.data_production_status[indexes, [self.column_name_mapping.get(col) for col in columns]] = 1
# Convert indexes to tensor if not already
if not isinstance(indexes, torch.Tensor):
indexes_tensor = torch.tensor(indexes, dtype=torch.long, device=self.data_production_status.device)
else:
indexes_tensor = indexes
column_indices = [self.column_name_mapping.get(col) for col in columns]
if any(idx is None for idx in column_indices):
missing = [col for col, idx in zip(columns, column_indices) if idx is None]
raise ValueError(f"Columns not found in column_name_mapping: {missing}")
self.data_production_status[indexes_tensor, column_indices] = 1

Copilot uses AI. Check for mistakes.
LLLLxmmm referenced this pull request in LLLLxmmm/TransferQueue Oct 24, 2025
… (#5)

* docs: improve docstrings for clarity and consistency across client.py

* Update transfer_queue/client.py

Co-authored-by: Copilot <[email protected]>

* fix comments

* fix comments

---------

Co-authored-by: liuximeng <[email protected]>
Co-authored-by: Han Zhenyu 韩振宇 <[email protected]>
Co-authored-by: Copilot <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants