2009/12/1 Iustin Pop <[email protected]>:
>> I suggest we use "${pid}:${time}:${random}":
>>
>> $ python -m timeit -s 'import os, time, random' '"%s:%0.6f:%s" %
>> (os.getpid(), time.time(), random.getrandbits(16))'
>> 100000 loops, best of 3: 7.8 usec per loop
>>
>> $ PYTHONPATH=. python -m timeit -s 'from ganeti import utils'
>> 'utils.NewUUID()'
>> 10000 loops, best of 3: 58.3 usec per loop
>>
>> Are you okay with this choice?
>
> Hmm, what pid is that? I was thinking parent_pid+child_pid+... so that we
> protect from both child pid recycling and parent restart.
The function call ID will be opaque to ganeti-noded (i.e. it won't try
to get any information from it), so I'm not sure whether it's
necessary to include the child's PID. Anyway:
--- a/doc/design-2.2.rst
+++ b/doc/design-2.2.rst
@@ -118,9 +118,10 @@ Function processes communicate with the parent
process via stdio and
possibly their exit status. Every function process has a unique
identifier, though it shouldn't be the process ID only (PIDs can be
recycled and are prone to race conditions for this use case). The
-proposed format is ``${pid}:${time}:${random}``, where ``pid`` is the
-current process ID, ``time`` the current Unix timestamp with decimal
-places and ``random`` at least 16 random bits.
+proposed format is ``${ppid}:${cpid}:${time}:${random}``, where ``ppid``
+is the ``ganeti-noded`` PID, ``cpid`` the child's PID, ``time`` the
+current Unix timestamp with decimal places and ``random`` at least 16
+random bits.
Thanks,
Michael