thorbjorn444 commented on a change in pull request #16641:
URL: https://github.com/apache/beam/pull/16641#discussion_r795054678



##########
File path: sdks/python/apache_beam/runners/dataflow/internal/apiclient.py
##########
@@ -421,10 +422,16 @@ def _build_default_job_name(user_name):
     user_name = re.sub('[^-a-z0-9]', '', user_name.lower())
     date_component = datetime.utcnow().strftime('%m%d%H%M%S-%f')
     app_user_name = 'beamapp-{}'.format(user_name)
-    job_name = '{}-{}'.format(app_user_name, date_component)
+    # append 8 random alphanumeric characters to avoid collisions.
+    random_component = ''.join(
+        random.choices(str(uuid.uuid4()).replace('-', ''), k=8))

Review comment:
       That makes total sense to me. The previous implementation is a bit 
path-dependent ("We can resolve this by appending a UUID" -> "That's too long, 
I'll just select a few random characters from the sequence").
   
   Please see the updated implementation. 




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to