[英]Azure dev spaces to debug python code running in kubernetes pod
如何使用 kubernetes 的 azure dev 空间在容器中调试用 python 编写的代码?
Debugging should be similar just like we have it in Dot net core.In dot net , we used to debug something like this调试应该和我们在 Dot net core 中的类似。在 dot net 中,我们曾经调试过这样的东西
Setting and using breakpoints for debugging设置和使用断点进行调试
If Visual Studio 2017 is still connected to your dev space, click the stop button.如果 Visual Studio 2017 仍连接到您的开发空间,请单击停止按钮。 Open Controllers/HomeController.cs and click somewhere on line 20 to put your cursor there.打开 Controllers/HomeController.cs 并单击第 20 行的某个位置将光标放在那里。 To set a breakpoint hit F9 or click Debug then Toggle Breakpoint.要设置断点,请按 F9 或单击调试,然后单击切换断点。 To start your service in debugging mode in your dev space, hit F5 or click Debug then Start Debugging.要在开发空间中以调试模式启动服务,请按 F5 或单击调试,然后单击启动调试。
Open your service in a browser and notice no message is displayed.在浏览器中打开您的服务并注意没有显示任何消息。 Return to Visual Studio 2017 and observe line 20 is highlighted.返回 Visual Studio 2017 并观察第 20 行是否突出显示。 The breakpoint you set has paused the service at line 20. To resume the service, hit F5 or click Debug then Continue.您设置的断点已在第 20 行暂停服务。要恢复服务,请按 F5 或单击调试,然后单击继续。 Return to your browser and notice the message is now displayed.返回浏览器并注意现在显示消息。
While running your service in Kubernetes with a debugger attached, you have full access to debug information such as the call stack, local variables, and exception information.在带有调试器的 Kubernetes 中运行您的服务时,您可以完全访问调试信息,例如调用堆栈、局部变量和异常信息。
Remove the breakpoint by putting your cursor on line 20 in Controllers/HomeController.cs and hitting F9.通过将光标放在 Controllers/HomeController.cs 中的第 20 行并按 F9 来移除断点。
Try something like this and see if it works.尝试这样的事情,看看它是否有效。
Here is an article which explains debugging python code in visual studio 2017这是一篇解释在 Visual Studio 2017 中调试 python 代码的文章
https://docs.microsoft.com/en-us/visualstudio/python/tutorial-working-with-python-in-visual-studio-step-04-debugging?view=vs-2017 https://docs.microsoft.com/en-us/visualstudio/python/tutorial-working-with-python-in-visual-studio-step-04-debugging?view=vs-2017
Hope it helps.希望能帮助到你。
Currently debugging in Azure Dev Spaces only lists Node.js, .NET Core, and Java as officially supported.目前在 Azure Dev Spaces 中调试只列出了官方支持的 Node.js、.NET Core 和 Java。 The documentation for how to debug these 3 types of environments was written pretty recently (Quickstarts published on 7/7/2019).关于如何调试这 3 种环境的文档是最近编写的(快速入门于 2019 年 7 月 7 日发布)。 I am assuming that a guide for Python should be on the way shortly, but I have been unable to find any published timeline for this.我假设 Python 指南很快就会发布,但我一直无法找到任何已发布的时间表。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.