Skip to content
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

Apply set_execution_file to specific traces such as forward/backward execution traces #1760

Open
crcrpar opened this issue Feb 11, 2025 · 0 comments
Labels
enhancement New feature or request

Comments

@crcrpar
Copy link
Collaborator

crcrpar commented Feb 11, 2025

With

def _set_execution_file(path: str) -> None:
, we can modify traces before execution, but it seems that every TraceCtx.python_callable() call gets affected by the function according to
def python_callable(self, *, global_dicts: None | dict = None, **kwargs: Any) -> Callable:
python_str: str
# Writes the program to allow it to be edited before execution
path: None | str = _get_execution_file()
if path is not None:
f = open(path, "w")
f.write(self.python(**kwargs))
f.close()
input(f"Trace written to {os.path.realpath(path)} Press Any key to execute it")
with open(path) as file:
python_str = file.read()
.

From my point of view, the number of traces we'd want to modify would be 1 or 2: forward execution trace and/or backward execution trace.
Thus I think it'd be helpful to have an option to only make set_execution_callback_file effective to the two traces mentioned above.

@crcrpar crcrpar added the enhancement New feature or request label Feb 11, 2025
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

No branches or pull requests

1 participant