/** */ void onResult() { if (msgLog.isDebugEnabled()) { msgLog.debug("DHT lock fut, mini future node left [txId=" + nearLockVer + ", dhtTxId=" + lockVer + ", inTx=" + inTx() + ", node=" + node.id() + ']'); } if (tx != null) tx.removeMapping(node.id()); onDone(true); }
/** * @param job Job. * @param node Node. * @throws IgniteCheckedException In case of error. */ public void map(@NotNull ComputeJob job, @NotNull ClusterNode node) throws IgniteCheckedException { if (ctx.localNodeId().equals(node.id())) { if (hadLocNode) { Marshaller marsh = ctx.config().getMarshaller(); job = U.unmarshal(marsh, U.marshal(marsh, job), U.resolveClassLoader(ctx.config())); } else hadLocNode = true; } map.put(job, node); }
/** * @return Cluster nodes MAC addresses. */ private Map<UUID, String> getClusterMacs() { Map<UUID, String> macs = new HashMap<>(); for (Ignite ignite : G.allGrids()) { ClusterNode node = ignite.cluster().localNode(); String mac = node.attribute(ATTR_MACS); assert mac != null; macs.put(node.id(), mac); } return macs; } }
@Override public void onEvent(Event evt) { assert evt.type() == EVT_NODE_FAILED || evt.type() == EVT_NODE_LEFT : "Unexpected event: " + evt; UUID id = ((DiscoveryEvent)evt).eventNode().id(); if (log.isDebugEnabled()) log.debug("Processing node departure: " + id); for (Map.Entry<IgniteUuid, CachedDeploymentInfo<K, V>> entry : deps.entrySet()) { CachedDeploymentInfo<K, V> d = entry.getValue(); if (log.isDebugEnabled()) log.debug("Examining cached info: " + d); if (d.senderId().equals(id) || d.removeParticipant(id)) { deps.remove(entry.getKey(), d); if (log.isDebugEnabled()) log.debug("Removed cached info [d=" + d + ", deps=" + deps + ']'); } } allParticipants.remove(id); } };
/** * Resolves TensorFlow cluster chief job and acquires ports. * * @param spec TensorFlow cluster specification. */ private void resolveAndAcquirePortsForChief(TensorFlowClusterSpec spec) { ClusterNode chiefNode = ignite.cluster().localNode(); UUID chiefNodeId = chiefNode.id(); int chiefPort = portMgr.acquirePort(chiefNodeId); spec.addTask(CHIEF_JOB_NAME, chiefNodeId, chiefPort); } }
/** {@inheritDoc} */ @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Serializable arg) { Map<ComputeJob, ClusterNode> map = new HashMap<>(subgrid.size()); for (ClusterNode node : subgrid) { if (!node.id().equals(ignite.configuration().getNodeId())) map.put(new GridP2PRemoteTestJob(null) , node); } return map; }
/** * @param instances Started Ignite instances. * @param macs Mapping MAC addresses to UUID. */ private void replaceMacAddresses(List<Ignite> instances, Map<UUID, String> macs) { for (Ignite ignite : instances) { for (ClusterNode node : ignite.cluster().nodes()) { String mac = macs.get(node.id()); assertNotNull(mac); Map<String, Object> attrs = new HashMap<>(node.attributes()); attrs.put(ATTR_MACS, mac); ((TcpDiscoveryNode)node).setAttributes(attrs); } } }
/** {@inheritDoc} */ @Override public Object call() throws IgniteCheckedException { assert ignite.cluster().localNode().id().equals(ignite.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(affKey).id()); assert ignite.cluster().localNode().id().equals(ignite.affinity(DEFAULT_CACHE_NAME).mapKeyToNode(key).id()); return null; } }
/** * @param nodeId Left node ID * @return {@code True} if node was in the list. */ @Override public synchronized boolean onNodeLeft(UUID nodeId) { for (IgniteInternalFuture<?> fut : futures()) { MiniFuture f = (MiniFuture)fut; if (f.node.id().equals(nodeId)) { if (log.isDebugEnabled()) log.debug("Found mini-future for left node [nodeId=" + nodeId + ", mini=" + f + ", fut=" + this + ']'); return f.onResult(null, newTopologyException(nodeId)); } } if (log.isDebugEnabled()) log.debug("Future does not have mapping for left node (ignoring) [nodeId=" + nodeId + ", fut=" + this + ']'); return false; }
/** * @param node Node. * @param msg Message. */ protected final void processForceKeyResponse(ClusterNode node, GridDhtForceKeysResponse msg) { GridDhtForceKeysFuture<?, ?> f = forceKeyFuts.get(msg.futureId()); if (f != null) f.onResult(msg); else if (log.isDebugEnabled()) log.debug("Receive force key response for unknown future (is it duplicate?) [nodeId=" + node.id() + ", res=" + msg + ']'); } /**
/** * @param entry Entry. * @param n Node. * @param globalMap Map. */ private void addMapping( IgniteTxEntry entry, ClusterNode n, Map<UUID, GridDistributedTxMapping> globalMap ) { GridDistributedTxMapping global = globalMap.get(n.id()); if (global == null) globalMap.put(n.id(), global = new GridDistributedTxMapping(n)); global.add(entry); }
/** {@inheritDoc} */ @Override public Map<? extends ComputeJob, ClusterNode> map(List<ClusterNode> subgrid, Object arg) { assert subgrid != null; assert !subgrid.isEmpty(); Integer arg1 = null; if (arg instanceof GridifyArgument) arg1 = (Integer)((GridifyArgument)arg).getMethodParameters()[0]; else if (arg instanceof Integer) arg1 = (Integer)arg; else assert false : "Failed to map task (unknown argument type) [type=" + arg.getClass() + ", val=" + arg + ']'; Map<ComputeJob, ClusterNode> map = new HashMap<>(subgrid.size()); UUID nodeId = ignite != null ? ignite.configuration().getNodeId() : null; for (ClusterNode node : subgrid) if (!node.id().equals(nodeId)) map.put(new GridP2PTestJob(arg1), node); return map; }
/** {@inheritDoc} */ @Override public Object execute() { Map<Object, TestValue> map = new TreeMap<>(); for (int i = startElementIdx; i < startElementIdx + maxElements; i++) { if (i >= GridCacheMultiNodeLoadTest.ELEMENTS_COUNT) break; Object key = UUID.randomUUID(); map.put(key, new TestValue(key, i)); } g.log().info("Putting values to partitioned cache [nodeId=" + g.cluster().localNode().id() + ", mapSize=" + map.size() + ']'); g.cache(GridCacheMultiNodeLoadTest.CACHE_NAME).putAll(map); return null; }