Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Is it technically possible to give Python option of naming process ofrunning script?

Reply
Thread Tools

Is it technically possible to give Python option of naming process ofrunning script?

 
 
xliiv
Guest
Posts: n/a
 
      03-14-2012
Like the topic.. .
I use Python a lot, both Windows and Linux, and it's little weird to have many python process without fast distinction which is what.
 
Reply With Quote
 
 
 
 
Chris Angelico
Guest
Posts: n/a
 
      03-14-2012
On Thu, Mar 15, 2012 at 1:43 AM, xliiv <(E-Mail Removed)> wrote:
> Like the topic.. .
> I use Python a lot, both Windows and Linux, and it's little weird to have many python process without fast distinction which is what.


I've no idea if it's even possible on Windows. On Linux, what you want
is the prctl function, which (AFAIK) isn't directly available.

Google is your friend, though. Question's already been asked on Stack
Overflow and such, and has a few answers. Nothing that looks
cut-and-dried ready, but several that might work. Look for 'prctl' and
'PR_SET_NAME', which are the C-level function and constant that do the
job; a cursory examination of PyPI shows a module with prctl in the
name, so that may be of value.

ChrisA
 
Reply With Quote
 
 
 
 
Grant Edwards
Guest
Posts: n/a
 
      03-14-2012
On 2012-03-14, Chris Angelico <(E-Mail Removed)> wrote:
> On Thu, Mar 15, 2012 at 1:43 AM, xliiv <(E-Mail Removed)> wrote:
>> Like the topic.. .
>> I use Python a lot, both Windows and Linux, and it's little weird to have many python process without fast distinction which is what.

>
> I've no idea if it's even possible on Windows. On Linux, what you want
> is the prctl function, which (AFAIK) isn't directly available.
>
> Google is your friend, though. Question's already been asked on Stack
> Overflow and such, and has a few answers. Nothing that looks
> cut-and-dried ready, but several that might work.


The question of how to set the application name comes up somewhat
regularly. It would be awfully nice if there was a way for python
applications to set their application name. It's especially useful
for daemons, and makes it much easier when you can kill them by name
instead of having to look up the PID.

It seems like an excellent thing to add to the "os" module.

> Look for 'prctl' and 'PR_SET_NAME', which are the C-level function
> and constant that do the job; a cursory examination of PyPI shows a
> module with prctl in the name, so that may be of value.


--
Grant Edwards grant.b.edwards Yow! TONY RANDALL! Is YOUR
at life a PATIO of FUN??
gmail.com
 
Reply With Quote
 
Terry Reedy
Guest
Posts: n/a
 
      03-14-2012
On 3/14/2012 12:02 PM, Grant Edwards wrote:

> It seems like an excellent thing to add to the "os" module.


If 'prctl' is a standard POSIX system call, then it should be a
candidate for inclusion in the os module if someone opens a tracker
enhancement issue and presents an argument in favor.

--
Terry Jan Reedy

 
Reply With Quote
 
Prasad, Ramit
Guest
Posts: n/a
 
      03-14-2012
> > It seems like an excellent thing to add to the "os" module.

>
> If 'prctl' is a standard POSIX system call, then it should be a
> candidate for inclusion in the os module if someone opens a tracker
> enhancement issue and presents an argument in favor.



I think this request was already denied: http://bugs.python.org/issue5672

Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston, TX 77002
work phone: 713 - 216 - 5423

--

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
 
Reply With Quote
 
Prasad, Ramit
Guest
Posts: n/a
 
      03-14-2012


> > > It seems like an excellent thing to add to the "os" module.

> >
> > If 'prctl' is a standard POSIX system call, then it should be a
> > candidate for inclusion in the os module if someone opens a tracker
> > enhancement issue and presents an argument in favor.

>
>
> I think this request was already denied: http://bugs.python.org/issue5672


Also take a look at: https://github.com/dvarrazzo/py-setproctitle
Though since they just create a Named Object in Windows, I am not sure
it would work for something like killall.


Ramit


Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
712 Main Street | Houston,TX 77002
work phone: 713 - 216 - 5423

--

This email is confidential and subject to important disclaimers and
conditions including on offers for the purchase or sale of
securities, accuracy and completeness of information, viruses,
confidentiality, legal privilege, and legal entity disclaimers,
available at http://www.jpmorgan.com/pages/disclosures/email.
 
Reply With Quote
 
Alain Ketterlin
Guest
Posts: n/a
 
      03-14-2012
Terry Reedy <(E-Mail Removed)> writes:

> On 3/14/2012 12:02 PM, Grant Edwards wrote:
>
>> It seems like an excellent thing to add to the "os" module.

>
> If 'prctl' is a standard POSIX system call, then it should be a
> candidate for inclusion in the os module if someone opens a tracker
> enhancement issue and presents an argument in favor.


It's not. The man page says "This call is Linux-specific."

-- Alain.
 
Reply With Quote
 
Dave Angel
Guest
Posts: n/a
 
      03-15-2012
On 03/14/2012 01:27 PM, Prasad, Ramit wrote:
>>>> It seems like an excellent thing to add to the "os" module.
>>> If 'prctl' is a standard POSIX system call, then it should be a
>>> candidate for inclusion in the os module if someone opens a tracker
>>> enhancement issue and presents an argument in favor.

>>
>> I think this request was already denied: http://bugs.python.org/issue5672

> Also take a look at: https://github.com/dvarrazzo/py-setproctitle
> Though since they just create a Named Object in Windows, I am not sure
> it would work for something like killall.
>
>


There is/was a project called exemaker for Windows. (see Pypi for
link). I don't use Windows any more, but it was a nice trick, when it
worked. Not all python scripts could be wrapped in it, but basically it
let you wrap a python script in a tiny Windows program which launched
the usual python dll's. You could call it anything you liked, and
that's what the task manager saw as the process name.




--

DaveA

 
Reply With Quote
 
xliiv
Guest
Posts: n/a
 
      03-15-2012
> >> Like the topic.. .
> >> I use Python a lot, both Windows and Linux, and it's little weird to have many python process without fast distinction which is what.

> >
> > I've no idea if it's even possible on Windows. On Linux, what you want
> > is the prctl function, which (AFAIK) isn't directly available.
> >
> > Google is your friend, though. Question's already been asked on Stack
> > Overflow and such, and has a few answers. Nothing that looks
> > cut-and-dried ready, but several that might work.

>
> The question of how to set the application name comes up somewhat
> regularly. It would be awfully nice if there was a way for python
> applications to set their application name. It's especially useful
> for daemons, and makes it much easier when you can kill them by name
> instead of having to look up the PID.
>
> It seems like an excellent thing to add to the "os" module.
>
> > Look for 'prctl' and 'PR_SET_NAME', which are the C-level function
> > and constant that do the job; a cursory examination of PyPI shows a
> > module with prctl in the name, so that may be of value.



I did google, I've played with Exemaker (it works perfect, but not py3) and i've seen questions on Stackoverflow.
The thing I mean is a build feature of python to give such a name. Not 3rd part or etc. like Grant Edwards said. Is it possible?
 
Reply With Quote
 
xliiv
Guest
Posts: n/a
 
      03-15-2012
> >> Like the topic.. .
> >> I use Python a lot, both Windows and Linux, and it's little weird to have many python process without fast distinction which is what.

> >
> > I've no idea if it's even possible on Windows. On Linux, what you want
> > is the prctl function, which (AFAIK) isn't directly available.
> >
> > Google is your friend, though. Question's already been asked on Stack
> > Overflow and such, and has a few answers. Nothing that looks
> > cut-and-dried ready, but several that might work.

>
> The question of how to set the application name comes up somewhat
> regularly. It would be awfully nice if there was a way for python
> applications to set their application name. It's especially useful
> for daemons, and makes it much easier when you can kill them by name
> instead of having to look up the PID.
>
> It seems like an excellent thing to add to the "os" module.
>
> > Look for 'prctl' and 'PR_SET_NAME', which are the C-level function
> > and constant that do the job; a cursory examination of PyPI shows a
> > module with prctl in the name, so that may be of value.



I did google, I've played with Exemaker (it works perfect, but not py3) and i've seen questions on Stackoverflow.
The thing I mean is a build feature of python to give such a name. Not 3rd part or etc. like Grant Edwards said. Is it possible?
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
(newbie)Technically what's the difference between memset() andmemcpy() functions? sam C++ 11 09-12-2008 12:47 PM
"row major" - technically no such thing in C? Lax C Programming 2 04-12-2008 11:22 PM
OOXML "Technically Inferior" peterwn NZ Computing 67 02-13-2008 07:16 PM
What was done right or wrong technically in this digital unmasking? Jeanette Guire Digital Photography 3 10-16-2007 04:21 PM
while executing my client program i get the exception javax.naming.LinkException: [Root exception is javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: remaining if plz anybody know how to solve this problem then mahesh Java 0 03-08-2007 12:26 PM



Advertisments