Skip to content

Modular nvmsgbroker pipeline#95

Merged
r83575 merged 4 commits into
mainfrom
modular-nvmsgbroker-pipeline
Nov 4, 2025
Merged

Modular nvmsgbroker pipeline#95
r83575 merged 4 commits into
mainfrom
modular-nvmsgbroker-pipeline

Conversation

@chani0343

Copy link
Copy Markdown
Collaborator

Task #91: Make nvmsgbroker_pipeline modular for future use

Changes Made:

  • Refactored buffer_probe function into two separate modular functions:
    • process_tensor_operations() - handles tensor processing, softmax normalization, and classification
    • create_message_metadata() - creates nvmsgbroker metadata for MQTT transmission
  • Fixed Consumer Dockerfile - corrected path from consumer.py to database/consumer.py

Testing:

End-to-end testing completed successfully:

  • Pipeline → nvmsgbroker → MQTT → Consumer → MongoDB
  • Identical functionality maintained as original monolithic code
  • All components working as expected

Benefits:

  • Modularity: Functions can be reused in future pipelines
  • Maintainability: Clear separation of concerns
  • Testability: Each function can be unit tested separately

DoD Completed:

✅ Modular probe function working in the same way as before

Closes #91

chani0343 added 3 commits November 2, 2025 14:32
- Refactored buffer_probe into process_tensor_operations and create_message_metadata
- Fixed Consumer Dockerfile path: database/consumer.py
- End-to-end testing successful: Pipeline → nvmsgbroker → MQTT → Consumer → MongoDB
- Ready for code reuse in future pipelines
Comment thread src/nvmsgbroker_pipeline.py Outdated
l_user = l_user.next
return classification_results

def create_message_metadata(batch_meta, frame_meta, frame_number, classification_results):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this function isn't just creating - it also adds new info in-place. Please change the name to represent this

Comment thread src/nvmsgbroker_pipeline.py Outdated
Comment on lines +34 to +37
probs = np.ctypeslib.as_array(ptr, shape=(83,))
exp_probs = np.exp(probs - np.max(probs))
normalized_probs = exp_probs / np.sum(exp_probs)
top_indices = np.argsort(normalized_probs)[-5:][::-1]

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this seems to me also as a standalone function

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

please add typings

- Added type hints to all functions
- Renamed create_message_metadata to create_and_add_message_metadata
- Extracted apply_softmax_normalization as separate function
- Added docstrings for better code documentation
- Updated documentation with simplified script paths
@r83575 r83575 merged commit 3c19d68 into main Nov 4, 2025
1 check failed
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.

Make nvmsgbroker_pipeline modular for the future use in the pipeline

3 participants