Package com.findwise.hydra

Examples of com.findwise.hydra.StageGroup


            Pipeline pipeline = mdc.getPipelineReader().getPipeline();
            for (Stage stage : stages) {
                if (cmd.getStageNames() != null) {
                    if (cmd.getStageNames().contains(stage.getName())) {
                        log.info("Preparing to upload stage, " + stage.getName());
                        StageGroup g = new StageGroup(stage.getName());
                        g.addStage(stage);
                        pipeline.addGroup(g);
                    }
                } else {
                    log.info("Preparing to upload stage, " + stage.getName());
                    StageGroup g = new StageGroup(stage.getName());
                    g.addStage(stage);
                    pipeline.addGroup(g);
                }
            }
            log.info("Uploading stages");
            log.info(pipeline.toString());
View Full Code Here


    while(cursor.hasNext()) {
      DBObject obj = cursor.next();
      if(!obj.containsField(TYPE_KEY) || STAGE_TYPE.equals(obj.get(TYPE_KEY))) {
        Stage s = getStage(obj);
        if(!p.hasGroup(getGroupName(obj))) {
          p.addGroup(new StageGroup(getGroupName(obj)));
        }
        p.getGroup(getGroupName(obj)).addStage(s);
      } else {
        addGroup(p, getGroup(obj));
      }
View Full Code Here

  }
 
  @SuppressWarnings("unchecked")
  private StageGroup getGroup(DBObject dbo) {
    ((DBObject)dbo.get(PROPERTIES_KEY)).get(PROPERTIES_MAP_SUBKEY);
    StageGroup sg = new StageGroup((String)dbo.get(NAME_KEY), ((DBObject)((DBObject)dbo.get(PROPERTIES_KEY)).get(PROPERTIES_MAP_SUBKEY)).toMap());
    sg.setPropertiesModifiedDate(sg.getPropertiesModifiedDate());
    return sg;
  }
View Full Code Here

  }
 
  @ResponseBody
  @RequestMapping(method = RequestMethod.GET, value = "/stagegroups/{stageGroup}")
  public StageGroup getStageGroup(@PathVariable(value = "stageGroup") String stageGroup) {
    StageGroup stageGroupInfo = stagesService.getStageGroup(stageGroup);
    if (null != stageGroupInfo) {
      return stageGroupInfo;
    } else {
      throw new HttpResourceNotFoundException();
    }
View Full Code Here

  public void addStage(Stage stage, String groupName) throws IOException {

    Pipeline pipeline = connector.getPipelineReader().getPipeline();
    if(!pipeline.hasGroup(groupName)) {
      pipeline.addGroup(new StageGroup(groupName));
    }
    pipeline.getGroup(groupName).addStage(stage);
    connector.getPipelineWriter().write(pipeline);
  }
View Full Code Here

      Pipeline pipeline = connector.getPipelineReader().getPipeline();
      if(groupName == null) {
        groupName = getStageGroupForStage(stageToDelete);
      }
      if(!pipeline.hasGroup(groupName)) {
        pipeline.addGroup(new StageGroup(groupName));
      }
      pipeline.getGroup(groupName).removeStage(stageName);
      connector.getPipelineWriter().write(pipeline);
   
      ret.put("stageStatus", "Deleted stage " + stageName);
View Full Code Here

    }
    return ret;
  }

  private String getStageGroupForStage(Stage stageToDelete) {
    StageGroup groupForStage = connector.getPipelineReader().getPipeline().getGroupForStage(stageToDelete.getName());
    if (groupForStage != null) {
      return groupForStage.getName();
    } else {
      return stageToDelete.getName();
    }
  }
View Full Code Here

 
  @Test
  public void testGetStageGroups() throws Exception {
    MongoConnector mdc = mongoConnectorResource.getConnector();
    Pipeline p = new Pipeline();
    StageGroup singleGroup = new StageGroup("singleStage");
    StageGroup multiGroup = new StageGroup("multi");
    Stage single = new Stage("singleStage", new DatabaseFile());
    Stage multi1 = new Stage("multi1", new DatabaseFile());
    Stage multi2 = new Stage("multi2", new DatabaseFile());
    multiGroup.addStage(multi1);
    multiGroup.addStage(multi2);
    singleGroup.addStage(single);
   
    p.addGroup(multiGroup);
    p.addGroup(singleGroup);
   
View Full Code Here

 
  @Test
  public void testStageGroupProperties() throws Exception {
    MongoConnector mdc = mongoConnectorResource.getConnector();
    Pipeline p = new Pipeline();
    StageGroup singleGroup = new StageGroup("singleStage");
    StageGroup multiGroup = new StageGroup("multi");
    Stage single = new Stage("singleStage", new DatabaseFile());
    Stage multi1 = new Stage("multi1", new DatabaseFile());
    Stage multi2 = new Stage("multi2", new DatabaseFile());
    multiGroup.addStage(multi1);
    multiGroup.addStage(multi2);
    singleGroup.addStage(single);
   
    p.addGroup(multiGroup);
    p.addGroup(singleGroup);
   
    multiGroup.setJvmParameters("jvm");
    multiGroup.setRetries(3);
    multiGroup.setLogging(false);
    multiGroup.setCmdlineArgs("cmd");
   
    mongoConnectorResource.reset();
    mdc = mongoConnectorResource.getConnector();
    MongoPipelineReader reader = new MongoPipelineReader(mdc.getDB());
    MongoPipelineWriter writer = new MongoPipelineWriter(reader, WriteConcern.SAFE);
   
    writer.write(p);
   
    StageGroup g2 = reader.getPipeline().getGroup("multi");
    assertEquals(multiGroup.getJvmParameters(), g2.getJvmParameters());
    assertEquals(multiGroup.getRetries(), g2.getRetries());
    assertEquals(multiGroup.isLogging(), g2.isLogging());
    assertEquals(multiGroup.getCmdlineArgs(), g2.getCmdlineArgs());
  }
View Full Code Here

  }
 
  @Test
  public void testGetStages() throws Exception {
    Pipeline p = new Pipeline();
    StageGroup g = new StageGroup("1");
    g.addStage(new Stage("stage", Mockito.mock(DatabaseFile.class)));
    g.addStage(new Stage("stage2", Mockito.mock(DatabaseFile.class)));
    p.addGroup(g);
   
    Mockito.when(reader.getPipeline()).thenReturn(p);
   
    List<String> stages = GroupStarter.getStages("localhost", server.getPort(), "1");

    assertTrue(stages.contains("stage"));
    assertTrue(stages.contains("stage2"));
    assertFalse(stages.contains("notingroup"));

    StageGroup g2 = new StageGroup("2");
    g2.addStage(new Stage("debug", Mockito.mock(DatabaseFile.class)));
    Pipeline p2 = new Pipeline();
    p2.addGroup(g2);
   
    Mockito.when(reader.getDebugPipeline()).thenReturn(p2);
    stages = GroupStarter.getStages("localhost", server.getPort(), "2");
View Full Code Here

TOP

Related Classes of com.findwise.hydra.StageGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.