Search in sources :

Example 1 with Context

use of com.datatorrent.api.Context in project apex-core by apache.

the class StreamingContainer method deployNodes.

private void deployNodes(List<OperatorDeployInfo> nodeList) throws IOException {
    for (OperatorDeployInfo ndi : nodeList) {
        StorageAgent backupAgent = getValue(OperatorContext.STORAGE_AGENT, ndi);
        assert (backupAgent != null);
        Context parentContext;
        if (ndi instanceof UnifierDeployInfo) {
            OperatorContext unifiedOperatorContext = new OperatorContext(0, ndi.name, ((UnifierDeployInfo) ndi).operatorAttributes, containerContext);
            parentContext = new PortContext(ndi.inputs.get(0).contextAttributes, unifiedOperatorContext);
            massageUnifierDeployInfo(ndi);
        } else {
            parentContext = containerContext;
        }
        OperatorContext ctx = new OperatorContext(ndi.id, ndi.name, ndi.contextAttributes, parentContext);
        ctx.attributes.put(OperatorContext.ACTIVATION_WINDOW_ID, ndi.checkpoint.windowId);
        logger.debug("Restoring operator {} to checkpoint {} stateless={}.", ndi.id, Codec.getStringWindowId(ndi.checkpoint.windowId), ctx.stateless);
        Node<?> node = Node.retrieveNode(backupAgent.load(ndi.id, ctx.stateless ? Stateless.WINDOW_ID : ndi.checkpoint.windowId), ctx, ndi.type);
        node.currentWindowId = ndi.checkpoint.windowId;
        node.applicationWindowCount = ndi.checkpoint.applicationWindowCount;
        node.firstWindowMillis = firstWindowMillis;
        node.windowWidthMillis = windowWidthMillis;
        node.setId(ndi.id);
        nodes.put(ndi.id, node);
        logger.debug("Marking operator {} as deployed.", node);
    }
}
Also used : Context(com.datatorrent.api.Context) ContainerContext(com.datatorrent.stram.api.ContainerContext) StreamingContainerContext(com.datatorrent.stram.api.StreamingContainerUmbilicalProtocol.StreamingContainerContext) OperatorDeployInfo(com.datatorrent.stram.api.OperatorDeployInfo) StorageAgent(com.datatorrent.api.StorageAgent) UnifierDeployInfo(com.datatorrent.stram.api.OperatorDeployInfo.UnifierDeployInfo)

Aggregations

Context (com.datatorrent.api.Context)1 StorageAgent (com.datatorrent.api.StorageAgent)1 ContainerContext (com.datatorrent.stram.api.ContainerContext)1 OperatorDeployInfo (com.datatorrent.stram.api.OperatorDeployInfo)1 UnifierDeployInfo (com.datatorrent.stram.api.OperatorDeployInfo.UnifierDeployInfo)1 StreamingContainerContext (com.datatorrent.stram.api.StreamingContainerUmbilicalProtocol.StreamingContainerContext)1