Search in sources :

Example 1 with ReadOnlyTransactionException

use of org.janusgraph.core.ReadOnlyTransactionException in project janusgraph by JanusGraph.

the class VertexProgramScanJob method process.

@Override
public void process(JanusGraphVertex vertex, ScanMetrics metrics) {
    PreloadedVertex v = (PreloadedVertex) vertex;
    long vertexId = v.longId();
    VertexMemoryHandler<M> vh = new VertexMemoryHandler(vertexMemory, v);
    vh.setInExecute(true);
    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> messageIterator = vh.receiveMessages(scope).iterator(); messageIterator.hasNext(); ) {
                    M msg = messageIterator.next();
                    if (combinedMsg == null)
                        combinedMsg = msg;
                    else
                        combinedMsg = combiner.combine(combinedMsg, msg);
                }
                if (combinedMsg != null)
                    vertexMemory.aggregateMessage(vertexId, combinedMsg, scope);
            }
        }
    } else {
        v.setPropertyMixing(vh);
        try {
            vertexProgram.execute(v, vh, memory);
        } catch (ReadOnlyTransactionException e) {
        // Ignore read-only transaction errors in FulgoraGraphComputer. In testing these errors are associated
        // with cleanup of TraversalVertexProgram.HALTED_TRAVERSALS properties which can safely remain in graph.
        }
    }
    vh.setInExecute(false);
}
Also used : PreloadedVertex(org.janusgraph.graphdb.vertices.PreloadedVertex) ReadOnlyTransactionException(org.janusgraph.core.ReadOnlyTransactionException) EntryList(org.janusgraph.diskstorage.EntryList) MessageScope(org.apache.tinkerpop.gremlin.process.computer.MessageScope)

Aggregations

MessageScope (org.apache.tinkerpop.gremlin.process.computer.MessageScope)1 ReadOnlyTransactionException (org.janusgraph.core.ReadOnlyTransactionException)1 EntryList (org.janusgraph.diskstorage.EntryList)1 PreloadedVertex (org.janusgraph.graphdb.vertices.PreloadedVertex)1