本文整理了Java中org.apache.samza.zk.ZkKeyBuilder.getJobModelPath()
方法的一些代码示例,展示了ZkKeyBuilder.getJobModelPath()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkKeyBuilder.getJobModelPath()
方法的具体详情如下:
包路径:org.apache.samza.zk.ZkKeyBuilder
类名称:ZkKeyBuilder
方法名:getJobModelPath
暂无
代码示例来源:origin: org.apache.samza/samza-core_2.11
/**
* get the job model from ZK by version
* @param jobModelVersion jobModel version to get
* @return job model for this version
*/
public JobModel getJobModel(String jobModelVersion) {
LOG.info("Read the model ver=" + jobModelVersion + " from " + keyBuilder.getJobModelPath(jobModelVersion));
Object data = zkClient.readData(keyBuilder.getJobModelPath(jobModelVersion));
metrics.reads.inc();
ObjectMapper mmapper = SamzaObjectMapper.getObjectMapper();
JobModel jm;
try {
jm = mmapper.readValue((String) data, JobModel.class);
} catch (IOException e) {
throw new SamzaException("failed to read JobModel from ZK", e);
}
return jm;
}
代码示例来源:origin: apache/samza
@Test
public void testJobModelPath() {
ZkKeyBuilder builder = new ZkKeyBuilder("test");
Assert.assertEquals("/test/" + ZkKeyBuilder.JOBMODEL_GENERATION_PATH + "/jobModelVersion", builder.getJobModelVersionPath());
Assert.assertEquals("/test/" + ZkKeyBuilder.JOBMODEL_GENERATION_PATH + "/jobModels", builder.getJobModelPathPrefix());
String version = "2";
Assert.assertEquals("/test/" + ZkKeyBuilder.JOBMODEL_GENERATION_PATH + "/jobModels/" + version, builder.getJobModelPath(version));
Assert.assertEquals("/test/" + ZkKeyBuilder.JOBMODEL_GENERATION_PATH + "/" + ZkKeyBuilder.JOB_MODEL_UPGRADE_BARRIER_PATH + "/versionBarriers", builder.getJobModelVersionBarrierPrefix());
}
}
代码示例来源:origin: apache/samza
/**
* get the job model from ZK by version
* @param jobModelVersion jobModel version to get
* @return job model for this version
*/
public JobModel getJobModel(String jobModelVersion) {
LOG.info("Read the model ver=" + jobModelVersion + " from " + keyBuilder.getJobModelPath(jobModelVersion));
Object data = zkClient.readData(keyBuilder.getJobModelPath(jobModelVersion));
metrics.reads.inc();
ObjectMapper mmapper = SamzaObjectMapper.getObjectMapper();
JobModel jm;
try {
jm = mmapper.readValue((String) data, JobModel.class);
} catch (IOException e) {
throw new SamzaException("failed to read JobModel from ZK", e);
}
return jm;
}
代码示例来源:origin: org.apache.samza/samza-core_2.10
/**
* get the job model from ZK by version
* @param jobModelVersion jobModel version to get
* @return job model for this version
*/
public JobModel getJobModel(String jobModelVersion) {
LOG.info("Read the model ver=" + jobModelVersion + " from " + keyBuilder.getJobModelPath(jobModelVersion));
Object data = zkClient.readData(keyBuilder.getJobModelPath(jobModelVersion));
metrics.reads.inc();
ObjectMapper mmapper = SamzaObjectMapper.getObjectMapper();
JobModel jm;
try {
jm = mmapper.readValue((String) data, JobModel.class);
} catch (IOException e) {
throw new SamzaException("failed to read JobModel from ZK", e);
}
return jm;
}
代码示例来源:origin: org.apache.samza/samza-core_2.12
/**
* get the job model from ZK by version
* @param jobModelVersion jobModel version to get
* @return job model for this version
*/
public JobModel getJobModel(String jobModelVersion) {
LOG.info("Read the model ver=" + jobModelVersion + " from " + keyBuilder.getJobModelPath(jobModelVersion));
Object data = zkClient.readData(keyBuilder.getJobModelPath(jobModelVersion));
metrics.reads.inc();
ObjectMapper mmapper = SamzaObjectMapper.getObjectMapper();
JobModel jm;
try {
jm = mmapper.readValue((String) data, JobModel.class);
} catch (IOException e) {
throw new SamzaException("failed to read JobModel from ZK", e);
}
return jm;
}
代码示例来源:origin: org.apache.samza/samza-core
/**
* get the job model from ZK by version
* @param jobModelVersion jobModel version to get
* @return job model for this version
*/
public JobModel getJobModel(String jobModelVersion) {
LOG.info("Read the model ver=" + jobModelVersion + " from " + keyBuilder.getJobModelPath(jobModelVersion));
Object data = zkClient.readData(keyBuilder.getJobModelPath(jobModelVersion));
metrics.reads.inc();
ObjectMapper mmapper = SamzaObjectMapper.getObjectMapper();
JobModel jm;
try {
jm = mmapper.readValue((String) data, JobModel.class);
} catch (IOException e) {
throw new SamzaException("failed to read JobModel from ZK", e);
}
return jm;
}
代码示例来源:origin: apache/samza
/**
* Publishes new job model into ZK.
* This call should FAIL if the node already exists.
* @param jobModelVersion version of the jobModeL to publish
* @param jobModel jobModel to publish
*
*/
public void publishJobModel(String jobModelVersion, JobModel jobModel) {
try {
ObjectMapper mmapper = SamzaObjectMapper.getObjectMapper();
String jobModelStr = mmapper.writerWithDefaultPrettyPrinter().writeValueAsString(jobModel);
LOG.info("jobModelAsString=" + jobModelStr);
zkClient.createPersistent(keyBuilder.getJobModelPath(jobModelVersion), jobModelStr);
LOG.info("wrote jobModel path =" + keyBuilder.getJobModelPath(jobModelVersion));
} catch (Exception e) {
LOG.error("JobModel publish failed for version=" + jobModelVersion, e);
throw new SamzaException(e);
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.12
/**
* Publishes new job model into ZK.
* This call should FAIL if the node already exists.
* @param jobModelVersion version of the jobModeL to publish
* @param jobModel jobModel to publish
*
*/
public void publishJobModel(String jobModelVersion, JobModel jobModel) {
try {
ObjectMapper mmapper = SamzaObjectMapper.getObjectMapper();
String jobModelStr = mmapper.writerWithDefaultPrettyPrinter().writeValueAsString(jobModel);
LOG.info("jobModelAsString=" + jobModelStr);
zkClient.createPersistent(keyBuilder.getJobModelPath(jobModelVersion), jobModelStr);
LOG.info("wrote jobModel path =" + keyBuilder.getJobModelPath(jobModelVersion));
} catch (Exception e) {
LOG.error("JobModel publish failed for version=" + jobModelVersion, e);
throw new SamzaException(e);
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.10
/**
* Publishes new job model into ZK.
* This call should FAIL if the node already exists.
* @param jobModelVersion version of the jobModeL to publish
* @param jobModel jobModel to publish
*
*/
public void publishJobModel(String jobModelVersion, JobModel jobModel) {
try {
ObjectMapper mmapper = SamzaObjectMapper.getObjectMapper();
String jobModelStr = mmapper.writerWithDefaultPrettyPrinter().writeValueAsString(jobModel);
LOG.info("jobModelAsString=" + jobModelStr);
zkClient.createPersistent(keyBuilder.getJobModelPath(jobModelVersion), jobModelStr);
LOG.info("wrote jobModel path =" + keyBuilder.getJobModelPath(jobModelVersion));
} catch (Exception e) {
LOG.error("JobModel publish failed for version=" + jobModelVersion, e);
throw new SamzaException(e);
}
}
代码示例来源:origin: org.apache.samza/samza-core_2.11
/**
* Publishes new job model into ZK.
* This call should FAIL if the node already exists.
* @param jobModelVersion version of the jobModeL to publish
* @param jobModel jobModel to publish
*
*/
public void publishJobModel(String jobModelVersion, JobModel jobModel) {
try {
ObjectMapper mmapper = SamzaObjectMapper.getObjectMapper();
String jobModelStr = mmapper.writerWithDefaultPrettyPrinter().writeValueAsString(jobModel);
LOG.info("jobModelAsString=" + jobModelStr);
zkClient.createPersistent(keyBuilder.getJobModelPath(jobModelVersion), jobModelStr);
LOG.info("wrote jobModel path =" + keyBuilder.getJobModelPath(jobModelVersion));
} catch (Exception e) {
LOG.error("JobModel publish failed for version=" + jobModelVersion, e);
throw new SamzaException(e);
}
}
代码示例来源:origin: org.apache.samza/samza-core
/**
* Publishes new job model into ZK.
* This call should FAIL if the node already exists.
* @param jobModelVersion version of the jobModeL to publish
* @param jobModel jobModel to publish
*
*/
public void publishJobModel(String jobModelVersion, JobModel jobModel) {
try {
ObjectMapper mmapper = SamzaObjectMapper.getObjectMapper();
String jobModelStr = mmapper.writerWithDefaultPrettyPrinter().writeValueAsString(jobModel);
LOG.info("jobModelAsString=" + jobModelStr);
zkClient.createPersistent(keyBuilder.getJobModelPath(jobModelVersion), jobModelStr);
LOG.info("wrote jobModel path =" + keyBuilder.getJobModelPath(jobModelVersion));
} catch (Exception e) {
LOG.error("JobModel publish failed for version=" + jobModelVersion, e);
throw new SamzaException(e);
}
}
内容来源于网络,如有侵权,请联系作者删除!