gpt4 book ai didi

org.apache.samza.zk.ZkKeyBuilder.getJobModelPath()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-14 20:25:31 27 4
gpt4 key购买 nike

本文整理了Java中org.apache.samza.zk.ZkKeyBuilder.getJobModelPath()方法的一些代码示例,展示了ZkKeyBuilder.getJobModelPath()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkKeyBuilder.getJobModelPath()方法的具体详情如下:
包路径:org.apache.samza.zk.ZkKeyBuilder
类名称:ZkKeyBuilder
方法名:getJobModelPath

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);
 }
}

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com