[Tutor] is this doable
Mats Wichmann
mats at wichmann.us
Fri May 31 23:30:16 EDT 2019
On 5/31/19 1:41 PM, nathan tech wrote:
> Hi there,
>
> So for a future project of mine, I was wondering something.
>
> Is it possible, in python, to store a running task id in the registry?
>
> I might be using the complete wrong terms here, because I'm only used to
> doing this with a specific language, but here's what I want to do:
>
>
> python mytest.py:
>
> if(registry.taskid==valid_task):
>
> print 'already open'
>
> send to open program to make a ding noise.
>
>
> I understand that the second part, the "send to program" requires the
> program to handle being sent a "wake up!" event, which is fine, it's the
> "is it already running" which I am not sure on.
there's a lot your question leaves unasked... do you want to just code
your own apps and have one be able to poke another? that's one problem,
you can define the interface yourself. Or do you want to be able to
poke arbitrary running tasks? that ends up more complicated. many
systems have notification APIs that you can make use of, some of those
are more oriented to that model (the mobile systems Android and Tizen),
some a little less but still support it (Windows - it's a more prevalent
thing in the UWP model).
the psutil module can let you find things out about processes, might be
useful in your "is the task running" query.
if it's okay to start processes together and it's not arbitrary, the
multiprocessing module may be of some help.
More information about the Tutor
mailing list