Skip to content

Add trace decorator for "lazy" monitoring of functions #665

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

kzscisoft
Copy link
Collaborator

@kzscisoft kzscisoft commented Jan 21, 2025

trace decorator for quick function monitoring

Issue: #664

Python Version(s) Tested: 3.13

Operating System(s): Windows 11

Documentation PR: Issue on Docs repo.

📝 Summary

A decorator which allows the user to lazily track the variables within the function:

  • User can exclude variables using exclude=["glob_expr*"].
  • User can include variables using include=["glob_expr*"].
  • Variables prefixed with _ are ignored.
  • Use can attach an empty dictionary into which the decorator will pass session information.
import simvue.simlab as sv_lab
import time

@sv_lab.trace(include=["monitor_*"])
def run_simulation():
    monitor_x = 0
    monitor_y = 0

    for i in range(10):
         time.sleep(1)
         monitor_x = i
         monitor_y = monitor_x ** 2

🔄 Changes

Added new simlab sub-module, name pending review, the lab is either a user sandboxing module, or a place where new features are initially placed before becoming part of the main framework.

✔️ Checklist

  • Unit and integration tests passing.
  • Pre-commit hooks passing.
  • Quality checks passing.
  • Updated the documentation.

@kzscisoft kzscisoft added the enhancement New feature or request label Jan 21, 2025
@kzscisoft kzscisoft requested a review from alahiff January 21, 2025 23:27
@kzscisoft kzscisoft changed the base branch from dev to feature/api-repro January 21, 2025 23:27
Base automatically changed from feature/api-repro to dev February 10, 2025 14:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants