public static Stage getStage(Pipeline c, Object id, String stageName, String className, String ... afterStage) throws Exception { Stage s = new Stage(stageName, new DatabaseFile()); s.getDatabaseFile().setId(id); StageGroup g = new StageGroup(stageName); c.addGroup(g); g.addStage(s); Map<String, Object> props = new HashMap<String, Object>(); props.put("stageClass", "com.findwise.hydra."+className); if(afterStage!=null && afterStage.length>0) { props.put("queryOptions", new String[]{"touched("+afterStage[0]+",true)"}); } s.setProperties(props); return s; }
StageGroup g = new StageGroup(s.getName()); g.addStage(s); pipeline.addGroup(g);
@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; }
private Pipeline getPipeline(Stage.Mode mode) { Pipeline p = new Pipeline(); DBCursor cursor = stages.find(new BasicDBObject(ACTIVE_KEY, mode.toString())); 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)); } } return p; }
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); StageGroup g = new StageGroup(stage.getName()); g.addStage(stage); pipeline.addGroup(g);