Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #92342

Re: Detect if specific Python.app instance is already running

From Laura Creighton <lac@openend.se>
Subject Re: Detect if specific Python.app instance is already running
References <a3be1707-0eae-46fa-9921-e9c145816ad5@googlegroups.com> <11e093d5-b78e-4ac6-9a7f-649cb2c2c942@googlegroups.com> <mailman.281.1433718479.13271.python-list@python.org><6651a781-abe1-4f25-b1f3-1f849776d060@googlegroups.com>
Date 2015-06-08 20:21 +0200
Newsgroups comp.lang.python
Message-ID <mailman.297.1433787707.13271.python-list@python.org> (permalink)

Show all headers | View raw


I needed to do something like this once.  What I needed was a way to
send a process a signal, and have it then spit out a huge amount
of stats about how long it had been running, how many page faults
it had suffered, and, goodness, I forget all the information that
was needed.  Lots.  So I just wrapped the code in something that
waited to see if it got the special signal from hell, and, when it
did spit out the information.

It was not pretty, but that is the sort of thing you do when somebody
comes by after you have written something with some new requirements
that basically mean you would have to rewrite the thing.

Of course, sending odd signals to random processes in your proc table,
asking them to identify themselves, runs the risk that the process
isn't set up to receive signals it doesn't expect gracefully, and may
fall over dead when you do so.  So I am not sure I can actually
recommend this technique, but it is one way to skin this particular cat.

Laura

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Detect if specific Python.app instance is already running Andrei <andrei.fokau@gmail.com> - 2015-06-07 07:31 -0700
  Re: Detect if specific Python.app instance is already running Andrei <andrei.fokau@gmail.com> - 2015-06-07 12:54 -0700
    Re: Detect if specific Python.app instance is already running Ned Deily <nad@acm.org> - 2015-06-07 16:07 -0700
      Re: Detect if specific Python.app instance is already running Andrei <andrei.fokau@gmail.com> - 2015-06-08 01:32 -0700
        Re: Detect if specific Python.app instance is already running Laura Creighton <lac@openend.se> - 2015-06-08 20:21 +0200
        Re: Detect if specific Python.app instance is already running Ned Deily <nad@acm.org> - 2015-06-12 12:08 -0700

csiph-web