Tabnine Logo
WorkSlot.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.apache.eagle.alert.coordination.model.WorkSlot
constructor

Best Java code snippets using org.apache.eagle.alert.coordination.model.WorkSlot.<init> (Showing top 11 results out of 315)

origin: apache/eagle

private boolean getQueueOnTopology(int size, List<WorkSlot> slots, Topology t) {
  TopologyUsage u = context.getTopologyUsages().get(t.getName());
  if (!isTopologyAvailable(u)) {
    return false;
  }
  List<String> bolts = new ArrayList<String>();
  for (AlertBoltUsage alertUsage : u.getAlertUsages().values()) {
    if (isBoltAvailable(alertUsage)) {
      bolts.add(alertUsage.getBoltId());
    }
    if (bolts.size() == size) {
      break;
    }
  }
  if (bolts.size() == size) {
    for (String boltId : bolts) {
      WorkSlot slot = new WorkSlot(t.getName(), boltId);
      slots.add(slot);
    }
    return true;
  }
  return false;
}
origin: apache/eagle

private static MonitoredStream createMonitoredStream() {
  MonitoredStream ms = new MonitoredStream(streamGroup);
  ms.setVersion(V1);
  List<WorkSlot> slots = new ArrayList<WorkSlot>();
  WorkSlot slot0 = new WorkSlot(TOPO1, TOPO1 + "-alert-" + 0);
  WorkSlot slot1 = new WorkSlot(TOPO1, TOPO1 + "-alert-" + 1);
  WorkSlot slot2 = new WorkSlot(TOPO1, TOPO1 + "-alert-" + 2);
  WorkSlot slot3 = new WorkSlot(TOPO1, TOPO1 + "-alert-" + 3);
  WorkSlot slot4 = new WorkSlot(TOPO1, TOPO1 + "-alert-" + 4);
  WorkSlot slot5 = new WorkSlot(TOPO1, TOPO1 + "-alert-" + 5);
  slots.add(slot0);
  slots.add(slot1);
  slots.add(slot2);
  slots.add(slot3);
  slots.add(slot4);
  //slots.add(slot5);
  StreamWorkSlotQueue q = new StreamWorkSlotQueue(streamGroup, false, new HashMap<>(), slots);
  ms.addQueues(q);
  queueId = q.getQueueId();
  return ms;
}
origin: apache/eagle

public static StreamRouterSpec createSampleStreamRouteSpec(String streamId, String groupByField, List<String> targetEvaluatorIds) {
  List<WorkSlot> slots = Arrays.asList(targetEvaluatorIds.stream().map((t) -> {
    return new WorkSlot("sampleTopology", t);
  }).toArray(WorkSlot[]::new));
  StreamRouterSpec streamRouteSpec = new StreamRouterSpec();
  streamRouteSpec.setStreamId(streamId);
  streamRouteSpec.setPartition(createSampleStreamGroupbyPartition(streamId, Arrays.asList(groupByField)));
  streamRouteSpec.setTargetQueue(Arrays.asList(new PolicyWorkerQueue(slots)));
  return streamRouteSpec;
}
origin: apache/eagle

streamPartition.setType(StreamPartition.Type.GROUPBY);
streamGroup.addStreamPartition(streamPartition);
WorkSlot workSlot = new WorkSlot("setTopologyName", "setBoltId");
List<WorkSlot> workSlots = new ArrayList<>();
workSlots.add(workSlot);
origin: apache/eagle

@Test
public void testRouterBoltSpec() {
  List<String> topics = Arrays.asList("testTopic3", "testTopic4", "testTopic5");
  RouterSpec boltSpec = new RouterSpec();
  for (String topic : topics) {
    String streamId = getStreamNameByTopic(topic);
    // StreamPartition, groupby col1 for stream cpuUsageStream
    StreamPartition sp = new StreamPartition();
    sp.setStreamId(streamId);
    sp.setColumns(Arrays.asList("value"));
    sp.setType(StreamPartition.Type.GROUPBY);
    StreamSortSpec sortSpec = new StreamSortSpec();
    sortSpec.setWindowMargin(1000);
    sortSpec.setWindowPeriod2(Period.seconds(10));
    sp.setSortSpec(sortSpec);
    // set StreamRouterSpec to have 2 WorkSlot
    StreamRouterSpec routerSpec = new StreamRouterSpec();
    routerSpec.setPartition(sp);
    routerSpec.setStreamId(streamId);
    PolicyWorkerQueue queue = new PolicyWorkerQueue();
    queue.setPartition(sp);
    queue.setWorkers(Arrays.asList(new WorkSlot("testTopology", "alertBolt0"), new WorkSlot("testTopology", "alertBolt1")));
    routerSpec.setTargetQueue(Arrays.asList(queue));
    boltSpec.addRouterSpec(routerSpec);
  }
  String json = MetadataSerDeser.serialize(boltSpec);
  System.out.println(json);
  RouterSpec deserializedSpec = MetadataSerDeser.deserialize(json, RouterSpec.class);
  Assert.assertEquals(3, deserializedSpec.getRouterSpecs().size());
}
origin: apache/eagle

WorkSlot workSlot1 = new WorkSlot("setTopologyName1", "setBoltId1");
WorkSlot workSlot2 = new WorkSlot("setTopologyName1", "setBoltId2");
workers.add(workSlot1);
workers.add(workSlot2);
origin: apache/eagle

WorkSlot workSlot1 = new WorkSlot("setTopologyName1", "setBoltId1");
WorkSlot workSlot2 = new WorkSlot("setTopologyName1", "setBoltId2");
workers.add(workSlot1);
workers.add(workSlot2);
origin: apache/eagle

streamPartition.setType(StreamPartition.Type.GROUPBY);
streamGroup.addStreamPartition(streamPartition);
WorkSlot workSlot = new WorkSlot("setTopologyName", "setBoltId");
List<WorkSlot> workSlots = new ArrayList<>();
workSlots.add(workSlot);
origin: apache/eagle

WorkSlot worker1 = new WorkSlot("ALERT_UNIT_TOPOLOGY_APP_SANDBOX", "alertBolt1");
WorkSlot worker2 = new WorkSlot("ALERT_UNIT_TOPOLOGY_APP_SANDBOX", "alertBolt2");
origin: apache/eagle

PolicyWorkerQueue queue = new PolicyWorkerQueue();
queue.setPartition(sp);
queue.setWorkers(Arrays.asList(new WorkSlot("testTopology", "alertBolt1"), new WorkSlot("testTopology", "alertBolt2")));
routerSpec.setTargetQueue(Collections.singletonList(queue));
boltSpec.addRouterSpec(routerSpec);
origin: apache/eagle

  @Test
  public void testWorkSlot() {
    WorkSlot workSlot = new WorkSlot();
    Assert.assertEquals("(null:null)", workSlot.toString());
    Assert.assertEquals(null, workSlot.getBoltId());
    Assert.assertEquals(null, workSlot.getTopologyName());
    workSlot.setBoltId("setBoltId");
    workSlot.setTopologyName("setTopologyName");
    Assert.assertEquals("(setTopologyName:setBoltId)", workSlot.toString());
    Assert.assertEquals("setBoltId", workSlot.getBoltId());
    Assert.assertEquals("setTopologyName", workSlot.getTopologyName());

    WorkSlot workSlot1 = new WorkSlot("setTopologyName", "setBoltId");
    Assert.assertEquals("(setTopologyName:setBoltId)", workSlot1.toString());
    Assert.assertEquals("setBoltId", workSlot1.getBoltId());
    Assert.assertEquals("setTopologyName", workSlot1.getTopologyName());
    Assert.assertTrue(workSlot1.equals(workSlot));
    Assert.assertTrue(workSlot1.hashCode() == workSlot.hashCode());
  }
}
org.apache.eagle.alert.coordination.modelWorkSlot<init>

Popular methods of WorkSlot

  • getBoltId
  • getTopologyName
  • equals
  • hashCode
  • setBoltId
  • setTopologyName
  • toString

Popular in Java

  • Parsing JSON documents to java classes using gson
  • onCreateOptionsMenu (Activity)
  • getResourceAsStream (ClassLoader)
  • notifyDataSetChanged (ArrayAdapter)
  • BufferedInputStream (java.io)
    A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the i
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Stream (java.util.stream)
    A sequence of elements supporting sequential and parallel aggregate operations. The following exampl
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now