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

debugging in algoscript #431

Merged
merged 2 commits into from Nov 11, 2014

Conversation

Projects
None yet
2 participants
@llllllllll
Member

llllllllll commented Nov 10, 2014

Because the file name was not properly set, debuggers would fail to find the source code for the user's algorithm.

llllllllll added some commits Nov 10, 2014

ENH: Makes breakpoints work in algoscripts started with the run_algo.py
script.

Adds an option kwarg to TradingAlgorithm named 'algo_filename' that
represents the file where the algoscript came from (if any). The
run_algo.py script will pass this argument with the value passed to the
'-f' flag. The default name is '<string>' to represent that the script
is coming from a string in python and not a file. This matches the
behavior of exec and the python convention for compiling code objects.
@@ -197,7 +197,9 @@ def __init__(self, *args, **kwargs):
self.event_manager = EventManager()

if self.algoscript is not None:
exec_(self.algoscript, self.namespace)
filename = kwargs.pop('algo_filename', '<string>')

This comment has been minimized.

@twiecki

twiecki Nov 11, 2014

Contributor

why does this default to <string>?

This comment has been minimized.

@llllllllll

llllllllll Nov 11, 2014

Member

This is the convention for compiling code that did not come from a file.

@twiecki

This comment has been minimized.

Contributor

twiecki commented Nov 11, 2014

It is kinda odd that we set the file name incorrectly but it could still be run. How did that happen?

@llllllllll

This comment has been minimized.

Member

llllllllll commented Nov 11, 2014

You could still pass in just a script that did not originate from a file. For example, a lot of the unit tests do this.

@twiecki

This comment has been minimized.

Contributor

twiecki commented Nov 11, 2014

Got it. OK, this looks great!

@twiecki twiecki added Ready to Merge and removed Needs Review labels Nov 11, 2014

@llllllllll llllllllll merged commit 54b1f15 into master Nov 11, 2014

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details

@llllllllll llllllllll deleted the debugging-in-algoscript branch Nov 11, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment