You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2019/06/26 12:39:14 UTC

[GitHub] [flink] knaufk commented on a change in pull request #8741: [FLINK-12752] Add Option to Pass Seed for JobID Hash for StandaloneJobClusterEntrypoint

knaufk commented on a change in pull request #8741: [FLINK-12752] Add Option to Pass Seed for JobID Hash for StandaloneJobClusterEntrypoint
URL: https://github.com/apache/flink/pull/8741#discussion_r297641812
 
 

 ##########
 File path: flink-core/src/main/java/org/apache/flink/api/common/JobID.java
 ##########
 @@ -64,27 +65,40 @@ public JobID(long lowerPart, long upperPart) {
 	public JobID(byte[] bytes) {
 		super(bytes);
 	}
-	
+
 	// ------------------------------------------------------------------------
 	//  Static factory methods
 	// ------------------------------------------------------------------------
 
 	/**
 	 * Creates a new (statistically) random JobID.
-	 * 
+	 *
 	 * @return A new random JobID.
 	 */
 	public static JobID generate() {
 		return new JobID();
 	}
 
+	/**
+	 * Creates a new JobID based on the given seed. The JobIDs returned by two invocations of this
+	 * method with the same seed will be equal.
+	 *
+	 * @param seed the seed to base the generation of the JobID
+	 *
+	 * @return A new JobID based on the given seed.
+	 */
+	public static JobID fromSeed(String seed) {
+		Random rnd = new Random(seed.hashCode());
 
 Review comment:
   1) Yes. 
   2) Fair point. I don't think we need a cryptographic hash though. Will update accordingly.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services