473,748 Members | 2,516 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

poking around a running program

I have a long-running program that has lots of net connections open on
separate threads. I'm twiddling my thumbs waiting for it to finish
(each run takes maybe an hour) and although I'm logging various info
that I can monitor as the run progresses, it would be cool to be able
to actually poke around the program's data while it's running.

I'm thinking of adding a "console" thread that would basically be a
read-eval-print loop that I could use to inspect data interactively.
Maybe it would just eval stuff or maybe it would use pdb. Of course
it would be a bit dangerous since I could mutate things with it but I
guess it would be enough to just be careful not to do that.

Is this kind of thing common? Has it been done before and are there
some recipes? I did a quick search and didn't find anything obvious.
One thing I'm wondering is how to examine the internal state of
iterators, especially the C implementations from itertools.

More advanced might be some kind of hot-patching scheme (to be able to
change the code without stopping it) but for now I think I'm ok just
restarting the program every so often, modifying the code between runs
based on what happens in a given run.
Jun 15 '07 #1
2 1423
En Thu, 14 Jun 2007 21:42:50 -0300, Paul Rubin
<"http://phr.cx"@NOSPAM. invalidescribió :
I have a long-running program that has lots of net connections open on
separate threads. I'm twiddling my thumbs waiting for it to finish
(each run takes maybe an hour) and although I'm logging various info
that I can monitor as the run progresses, it would be cool to be able
to actually poke around the program's data while it's running.

I'm thinking of adding a "console" thread that would basically be a
read-eval-print loop that I could use to inspect data interactively.
Maybe it would just eval stuff or maybe it would use pdb. Of course
it would be a bit dangerous since I could mutate things with it but I
guess it would be enough to just be careful not to do that.

Is this kind of thing common? Has it been done before and are there
some recipes? I did a quick search and didn't find anything obvious.
One thing I'm wondering is how to examine the internal state of
iterators, especially the C implementations from itertools.
I don't know how common it is, but for instance, Zope has a remote console
like this.
The code module may be useful.
More advanced might be some kind of hot-patching scheme (to be able to
change the code without stopping it) but for now I think I'm ok just
restarting the program every so often, modifying the code between runs
based on what happens in a given run.
That may be hard to do. For global functions, reload() may help, but if
you have many created instances, modifying and reloading the module that
contains the class definition won't automatically alter the existing
instances.

--
Gabriel Genellina

Jun 15 '07 #2
Paul Rubin wrote:
Is this kind of thing common? Has it been done before and are
there some recipes?
The Twisted framework offers an interactive Python shell inside the
application (Twisted manhole).

Regards,
Björn

--
BOFH excuse #249:

Unfortunately we have run out of bits/bytes/whatever. Don't worry,
the next supply will be coming next week.

Jun 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

18
3509
by: Adrian B. | last post by:
Does anyone know of a framework or library that will enable me to use publish/subscribe comms? I want to create a server (using Python) running on a Unix box that will accept client connections (from GUIs built with wxPython) and publish realtime data updates to them. Any advice on where to start? Thanks. A.B.
10
5169
by: Amit Nath | last post by:
Hi! I am running a C program and need to pause the program and change some of the variables. Is there any function that checks if there is a character in the Standard Input Buffer, else the program keeps on running. Can someone please help me on that. AN
7
2578
by: MgGuigg | last post by:
Hello all, This is my first time posting a question to this forum, so here is hoping I am following protocol. I am scraping the rust off my old Basic programming skills, and have just recently upgraded to VB.NET, and I have a lot of catching up to do. That being said, I have come a long way in a short while, however, I am stumped at the moment. I have read through days of posts, but have not been able to address my specific question, so...
1
4833
by: Mike | last post by:
I am consuming a web service hosted by one of our clients. One of the string properties of the object I am creating to pass to their web service is called CustomerName. The XML they re receiving I just a standatd xml elemnt: <CustomerName>Joe Friday</CustomerName> The client has told me that the customer name, Joe Firday, needs to have CDATA tags around it:
12
14535
by: tshad | last post by:
What would be a good way to check programmatically whether a service was running? We have a service that dies periodically and I need to check to see if this service is running. I know how to check to see if the status is in stopped or running mode. But that doesn't tell me if it is actually running. I need to know this so that if it happens I can programmatically start the same service on another machine.
4
3116
by: =?Utf-8?B?Um9iS2lubmV5MQ==?= | last post by:
Hello, My boss asked me if it is possible to wrap SSL around an existing socket which is running with a C++ program (I know it is, I have done it before). I am wondering if it is possible to do this in a C# application so that when the C# program is running in the background, it is able to intercept the socket communications from the C++ program, encrypt them, and pass it on through the C# SSL program I make to a receiving C# program to...
5
6587
by: Rymfax | last post by:
I have an application that will be used on both XP and Vista. One of the things this application needs to do is determine the exact operating system it is on. To get the correct "flavor" of Vista that might be running, there is a new function in Kernel32.dll called GetProductInfo(). The problem I'm running into is that if I include this function in my application, the app errors on XP at start up with the following message: The...
17
5816
by: Chris M. Thomasson | last post by:
I use the following technique in all of my C++ projects; here is the example code with error checking omitted for brevity: _________________________________________________________________ /* Simple Thread Object ______________________________________________________________*/ #include <pthread.h> extern "C" void* thread_entry(void*);
3
3875
by: len | last post by:
hi Have this code in my program; filename = 'custfile' codeline = filename + ' = .replace('-', '_').replace('.', '').lower() + \ ', ' + fieldline + '),\n' return code ...
0
8994
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8831
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9555
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9250
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8247
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6076
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4607
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2787
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2215
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.