gpt4 book ai didi

org.apache.helix.task.WorkflowConfig.getRecord()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 02:07:05 26 4
gpt4 key购买 nike

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

WorkflowConfig.getRecord介绍

暂无

代码示例

代码示例来源:origin: apache/helix

@GET
@Path("{workflowId}/configs")
public Response getWorkflowConfig(@PathParam("clusterId") String clusterId,
  @PathParam("workflowId") String workflowId) {
 TaskDriver taskDriver = getTaskDriver(clusterId);
 WorkflowConfig workflowConfig = taskDriver.getWorkflowConfig(workflowId);
 ObjectNode workflowConfigNode = JsonNodeFactory.instance.objectNode();
 if (workflowConfig != null) {
  getWorkflowConfigNode(workflowConfigNode, workflowConfig.getRecord());
 }
 return JSONRepresentation(workflowConfigNode);
}

代码示例来源:origin: apache/helix

@POST
@Path("{workflowId}/configs")
public Response updateWorkflowConfig(@PathParam("clusterId") String clusterId,
  @PathParam("workflowId") String workflowId, String content) {
 ZNRecord record;
 TaskDriver driver = getTaskDriver(clusterId);
 try {
  record = toZNRecord(content);
  WorkflowConfig workflowConfig = driver.getWorkflowConfig(workflowId);
  if (workflowConfig == null) {
   return badRequest(
     String.format("WorkflowConfig for workflow %s does not exists!", workflowId));
  }
  workflowConfig.getRecord().update(record);
  driver.updateWorkflow(workflowId, workflowConfig);
 } catch (HelixException e) {
  return badRequest(
    String.format("Failed to update WorkflowConfig for workflow %s", workflowId));
 } catch (Exception e) {
  return badRequest(String.format("Invalid WorkflowConfig for workflow %s", workflowId));
 }
 return OK();
}

代码示例来源:origin: apache/helix

newWorkflowConfig.getRecord()
  .setSimpleField(WorkflowConfig.WorkflowConfigProperty.WorkflowID.name(), workflow);

代码示例来源:origin: org.apache.helix/helix-core

newWorkflowConfig.getRecord()
  .setSimpleField(WorkflowConfig.WorkflowConfigProperty.WorkflowID.name(), workflow);

代码示例来源:origin: apache/helix

@Test
 public void testJobStateOnCreation() {
  Workflow.Builder builder = new Workflow.Builder(WORKFLOW_NAME);
  JobConfig.Builder jobConfigBuilder = new JobConfig.Builder().setCommand(MockTask.TASK_COMMAND)
    .setTargetResource(WORKFLOW_NAME).setTargetPartitionStates(Sets.newHashSet("SLAVE","MASTER"))
    .setJobCommandConfigMap(WorkflowGenerator.DEFAULT_COMMAND_CONFIG);
  String jobName = "job";
  builder = builder.addJob(jobName, jobConfigBuilder);
  Workflow workflow = builder.build();
  WorkflowConfig workflowConfig = workflow.getWorkflowConfig();
  JobConfig jobConfig = jobConfigBuilder.build();
  workflowConfig.getRecord().merge(jobConfig.getRecord());

  _cache.getJobConfigMap().put(WORKFLOW_NAME + "_" + jobName, jobConfig);
  _cache.getWorkflowConfigMap().put(WORKFLOW_NAME, workflowConfig);

  WorkflowRebalancer workflowRebalancer = new WorkflowRebalancer();
  workflowRebalancer.init(_manager);
  ResourceAssignment resourceAssignment = workflowRebalancer
    .computeBestPossiblePartitionState(_cache, _idealState, _resource, _currStateOutput);

  WorkflowContext workflowContext = _cache.getWorkflowContext(WORKFLOW_NAME);
  Map<String, TaskState> jobStates = workflowContext.getJobStates();
  for (String job : jobStates.keySet()) {
   Assert.assertEquals(jobStates.get(job), TaskState.NOT_STARTED);
  }
 }
}

代码示例来源:origin: apache/helix

@GET
@Path("{workflowId}")
public Response getWorkflow(@PathParam("clusterId") String clusterId,
  @PathParam("workflowId") String workflowId) {
 TaskDriver taskDriver = getTaskDriver(clusterId);
 WorkflowConfig workflowConfig = taskDriver.getWorkflowConfig(workflowId);
 WorkflowContext workflowContext = taskDriver.getWorkflowContext(workflowId);
 ObjectNode root = JsonNodeFactory.instance.objectNode();
 TextNode id = JsonNodeFactory.instance.textNode(workflowId);
 root.put(Properties.id.name(), id);
 ObjectNode workflowConfigNode = JsonNodeFactory.instance.objectNode();
 ObjectNode workflowContextNode = JsonNodeFactory.instance.objectNode();
 if (workflowConfig != null) {
  getWorkflowConfigNode(workflowConfigNode, workflowConfig.getRecord());
 }
 if (workflowContext != null) {
  getWorkflowContextNode(workflowContextNode, workflowContext.getRecord());
 }
 root.put(WorkflowProperties.WorkflowConfig.name(), workflowConfigNode);
 root.put(WorkflowProperties.WorkflowContext.name(), workflowContextNode);
 JobDag jobDag = workflowConfig.getJobDag();
 ArrayNode jobs = OBJECT_MAPPER.valueToTree(jobDag.getAllNodes());
 ObjectNode parentJobs = OBJECT_MAPPER.valueToTree(jobDag.getChildrenToParents());
 root.put(WorkflowProperties.Jobs.name(), jobs);
 root.put(WorkflowProperties.ParentJobs.name(), parentJobs);
 root.put(WorkflowProperties.LastScheduledTask.name(), OBJECT_MAPPER.valueToTree(taskDriver.getLastScheduledTaskExecutionInfo(workflowId)));
 return JSONRepresentation(root);
}

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