use of com.thinkaurelius.titan.graphdb.vertices.PreloadedVertex in project titan by thinkaurelius.
the class VertexMapJob method process.
@Override
public void process(TitanVertex vertex, ScanMetrics metrics) {
PreloadedVertex v = (PreloadedVertex) vertex;
if (vertexMemory != null) {
VertexMemoryHandler vh = new VertexMemoryHandler(vertexMemory, v);
v.setPropertyMixing(vh);
}
v.setAccessCheck(MAPREDUCE_CHECK);
if (idManager.isPartitionedVertex(v.longId()) && !idManager.isCanonicalVertexId(v.longId())) {
//Only consider the canonical partition vertex representative
return;
} else {
for (Map.Entry<MapReduce, FulgoraMapEmitter> mapJob : mapJobs.entrySet()) {
MapReduce job = mapJob.getKey();
try {
job.map(v, mapJob.getValue());
metrics.incrementCustom(MAP_JOB_SUCCESS);
} catch (Throwable ex) {
log.error("Encountered exception executing map job [" + job + "] on vertex [" + vertex + "]:", ex);
metrics.incrementCustom(MAP_JOB_FAILURE);
}
}
}
}
use of com.thinkaurelius.titan.graphdb.vertices.PreloadedVertex in project titan by thinkaurelius.
the class VertexJobConverter method process.
@Override
public void process(StaticBuffer key, Map<SliceQuery, EntryList> entries, ScanMetrics metrics) {
long vertexId = getVertexId(key);
assert entries.get(VERTEX_EXISTS_QUERY) != null;
if (isGhostVertex(vertexId, entries.get(VERTEX_EXISTS_QUERY))) {
metrics.incrementCustom(GHOST_VERTEX_COUNT);
return;
}
TitanVertex vertex = tx.getInternalVertex(vertexId);
Preconditions.checkArgument(vertex instanceof PreloadedVertex, "The bounding transaction is not configured correctly");
PreloadedVertex v = (PreloadedVertex) vertex;
v.setAccessCheck(PreloadedVertex.OPENSTAR_CHECK);
for (Map.Entry<SliceQuery, EntryList> entry : entries.entrySet()) {
SliceQuery sq = entry.getKey();
if (sq.equals(VERTEX_EXISTS_QUERY))
continue;
EntryList entryList = entry.getValue();
if (entryList.size() >= sq.getLimit())
metrics.incrementCustom(TRUNCATED_ENTRY_LISTS);
v.addToQueryCache(sq.updateLimit(Query.NO_LIMIT), entryList);
}
job.process(v, metrics);
}
use of com.thinkaurelius.titan.graphdb.vertices.PreloadedVertex in project titan by thinkaurelius.
the class VertexProgramScanJob method process.
@Override
public void process(TitanVertex vertex, ScanMetrics metrics) {
PreloadedVertex v = (PreloadedVertex) vertex;
long vertexId = v.longId();
VertexMemoryHandler<M> vh = new VertexMemoryHandler(vertexMemory, v);
v.setAccessCheck(PreloadedVertex.OPENSTAR_CHECK);
if (idManager.isPartitionedVertex(vertexId)) {
if (idManager.isCanonicalVertexId(vertexId)) {
EntryList results = v.getFromCache(SYSTEM_PROPS_QUERY);
if (results == null)
results = EntryList.EMPTY_LIST;
vertexMemory.setLoadedProperties(vertexId, results);
}
for (MessageScope scope : vertexMemory.getPreviousScopes()) {
if (scope instanceof MessageScope.Local) {
M combinedMsg = null;
for (Iterator<M> msgIter = vh.receiveMessages(scope).iterator(); msgIter.hasNext(); ) {
M msg = msgIter.next();
if (combinedMsg == null)
combinedMsg = msg;
else
combinedMsg = combiner.combine(combinedMsg, msg);
}
if (combinedMsg != null)
vertexMemory.aggregateMessage(vertexId, combinedMsg, scope);
}
}
} else {
v.setPropertyMixing(vh);
vertexProgram.execute(v, vh, memory);
}
}
Aggregations