You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "Ken Kawamoto (JIRA)" <ji...@apache.org> on 2018/08/21 21:15:00 UTC

[jira] [Created] (AIRFLOW-2928) Use uuid.uuid4 to create unique job name

Ken Kawamoto created AIRFLOW-2928:
-------------------------------------

             Summary: Use uuid.uuid4 to create unique job name
                 Key: AIRFLOW-2928
                 URL: https://issues.apache.org/jira/browse/AIRFLOW-2928
             Project: Apache Airflow
          Issue Type: Improvement
            Reporter: Ken Kawamoto


some components in Airflow use the first 8 bytes of _uuid.uuid1_ to generate a unique job name. The first 8 bytes, however, seem to come from clock. so if this is called multiple times in a short time period, two ids will likely collide.
_uuid.uuid4_ provides random values.

{code}
Python 2.7.15 (default, Jun 17 2018, 12:46:58)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import uuid
>>> for i in range(10):
...   uuid.uuid1()
...
UUID('e8bc9959-a586-11e8-ab8c-8c859010d0c2')
UUID('e8c254e3-a586-11e8-ac39-8c859010d0c2')
UUID('e8c2560f-a586-11e8-8251-8c859010d0c2')
UUID('e8c256c2-a586-11e8-994a-8c859010d0c2')
UUID('e8c25759-a586-11e8-9ba6-8c859010d0c2')
UUID('e8c257e6-a586-11e8-a854-8c859010d0c2')
UUID('e8c2587d-a586-11e8-89e9-8c859010d0c2')
UUID('e8c2590a-a586-11e8-a825-8c859010d0c2')
UUID('e8c25994-a586-11e8-9421-8c859010d0c2')
UUID('e8c25a21-a586-11e8-83fd-8c859010d0c2')
>>> for i in range(10):
...   uuid.uuid4()
...
UUID('f1eba69f-18ea-467e-a414-b18d67f34a51')
UUID('aaa4e18e-d4e6-42c9-905c-3cde714c2741')
UUID('82f55c27-69ae-474b-ab9a-afcc7891587c')
UUID('fab63643-ad33-4307-837b-68444fce7240')
UUID('c4efca6c-3d1b-436c-8b09-e9b7f55ccefb')
UUID('58de3a76-9d98-4427-8232-d6d7df2a1904')
UUID('4f0a55e8-1357-4697-a345-e60891685b00')
UUID('0fed47a3-07b6-423e-ae2e-d821c440cb63')
UUID('144b2c55-a9bd-431d-b536-239fb2048a5e')
UUID('d47fd8a0-48e9-4dcc-87f7-42c022c309a8')
{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)