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

Multiple debugging session with voltron #275

Open
HarDToBelieve opened this issue Mar 16, 2020 · 1 comment
Open

Multiple debugging session with voltron #275

HarDToBelieve opened this issue Mar 16, 2020 · 1 comment

Comments

@HarDToBelieve
Copy link

Can we have a feature that support for multiple debugging session with voltron?

image

I suggest that we can choose a port randomly for Flask, and tell to voltron view client which one it needs to connect to

@eldipa
Copy link

eldipa commented Jul 19, 2020

I think that with a few modifications it can be done (please, correct me if I'm missing something):

First, the server (in the debugger) must choose a random port (tcp) or random domain (unix):

voltron/voltron/core.py

Lines 162 to 171 in 0b7a2fb

if voltron.config.server.listen.tcp:
run_listener('tcp', ThreadedVoltronWSGIServer, list(voltron.config.server.listen.tcp) + [self.app])
if voltron.config.server.listen.domain and sys.platform != 'win32':
path = os.path.expanduser(str(voltron.config.server.listen.domain))
try:
os.unlink(path)
except:
pass
run_listener('domain', ThreadedUnixWSGIServer, [path, self.app])

We could say "if you choose a port == 0 in the configuration, voltron will pick a random one for you". Something similar for the domain like "if the domain ends in a -, voltron will add a random postfix to it".

Then we should let the user know which port/domain was chosen:

print(blessed.Terminal().bold_red("Voltron loaded."))

The client side is a little more complex.

First, we should add a parameter to the views to change the port/domain.

voltron/voltron/view.py

Lines 148 to 153 in 0b7a2fb

def add_generic_arguments(cls, sp):
sp.add_argument('--show-header', '-e', dest="header", action='store_true', help='show header', default=None)
sp.add_argument('--hide-header', '-E', dest="header", action='store_false', help='hide header')
sp.add_argument('--show-footer', '-f', dest="footer", action='store_true', help='show footer', default=None)
sp.add_argument('--hide-footer', '-F', dest="footer", action='store_false', help='hide footer')
sp.add_argument('--name', '-n', action='store', help='named configuration to use', default=None)

Now, the problem is that the client expects the final URL, not an IP+port or a domain:

self.client = Client(url=voltron.config.view.api_url)

The simplest solution (but not human friendly) would create a parameter to change not the port/domain but the api_url and configure the client to use it.

Any thoughts? If there is interest on this I could write a PR.

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

No branches or pull requests

2 participants