@Test public void testKeySerialization() { JobKeyConverter conv = new JobKeyConverter(); JobKey key = new JobKey("cluster1@identifier1", "user1", "app1", 13, "job_20120101235959_0001"); byte[] keyBytes = conv.toBytes(key); JobKey key2 = conv.fromBytes(keyBytes); assertEquals(key.getCluster(), key2.getCluster()); assertEquals(key.getUserName(), key2.getUserName()); assertEquals(key.getAppId(), key2.getAppId()); assertEquals(key.getRunId(), key2.getRunId()); assertEquals(key.getJobId(), key2.getJobId()); byte[][] keyParts = ByteUtil.split(keyBytes, Constants.SEP_BYTES); assertEquals(5, keyParts.length); long encodedRunId = Bytes.toLong(keyParts[3]); assertEquals(key.getRunId(), Long.MAX_VALUE - encodedRunId); key = new JobKey("c1@local", "user1", "app1", 15, (String)null); keyBytes = conv.toBytes(key); key2 = conv.fromBytes(keyBytes); assertEquals(key.getCluster(), key2.getCluster()); assertEquals(key.getUserName(), key2.getUserName()); assertEquals(key.getAppId(), key2.getAppId()); assertEquals(key.getRunId(), key2.getRunId()); assertEquals(key.getJobId(), key2.getJobId()); keyBytes = ByteUtil.join(Constants.SEP_BYTES, Bytes.toBytes("c1@local"), Bytes.toBytes("user1"), Bytes.toBytes("app1"), Bytes.toBytes(Long.MAX_VALUE-15L)); key2 = conv.fromBytes(keyBytes); assertEquals("c1@local", key2.getCluster()); assertEquals("user1", key2.getUserName()); assertEquals("app1", key2.getAppId()); assertEquals(15L, key2.getRunId()); assertEquals(0L, key2.getJobId().getJobEpoch()); assertEquals(0L, key2.getJobId().getJobSequence()); key = new JobKey("c1@local", "user1", "", 1234L, "job_201206201718_1941"); keyBytes = conv.toBytes(key); key2 = conv.fromBytes(keyBytes); assertKey(key, key2); }
public JobId getJobId() { return jobId; }
JobKey extends FlowKey implements Comparable<Object> { public JobId getJobId() { return jobId; } }
JobKey extends FlowKey implements Comparable<Object> { public JobId getJobId() { return jobId; } JobKey(String cluster, String userName, String appId, long runId,
      String jobId); @JsonCreator  JobKey(@JsonProperty("cluster") String cluster,
                @JsonProperty("userName") String userName,
                @JsonProperty("appId") String appId,
                @JsonProperty("runId") long runId,
                @JsonProperty("jobId") JobId jobId);  JobKey(QualifiedJobId qualifiedJobId, String userName, String appId,
      long runId);  JobKey(JobDesc jobDesc); }
JobKey extends FlowKey implements Comparable<Object> { public JobId getJobId() { return jobId; } JobKey(String cluster, String userName, String appId, long runId,
      String jobId); @JsonCreator  JobKey(@JsonProperty("cluster") String cluster,
                @JsonProperty("userName") String userName,
                @JsonProperty("appId") String appId,
                @JsonProperty("runId") long runId,
                @JsonProperty("jobId") JobId jobId);  JobKey(QualifiedJobId qualifiedJobId, String userName, String appId,
      long runId);  JobKey(JobDesc jobDesc); QualifiedJobId getQualifiedJobId(); JobId getJobId(); String toString(); @Override int compareTo(Object other); @Override boolean equals(Object other); @Override int hashCode(); }
JobKey extends FlowKey implements Comparable<Object> { public JobId getJobId() { return jobId; } JobKey(String cluster, String userName, String appId, long runId,
      String jobId); @JsonCreator  JobKey(@JsonProperty("cluster") String cluster,
                @JsonProperty("userName") String userName,
                @JsonProperty("appId") String appId,
                @JsonProperty("runId") long runId,
                @JsonProperty("jobId") JobId jobId);  JobKey(QualifiedJobId qualifiedJobId, String userName, String appId,
      long runId);  JobKey(JobDesc jobDesc); QualifiedJobId getQualifiedJobId(); JobId getJobId(); String toString(); @Override int compareTo(Object other); @Override boolean equals(Object other); @Override int hashCode();  }