Tabnine Logo
VertexProgram.loadState
Code IndexAdd Tabnine to your IDE (free)

How to use
loadState
method
in
org.apache.tinkerpop.gremlin.process.computer.VertexProgram

Best Java code snippets using org.apache.tinkerpop.gremlin.process.computer.VertexProgram.loadState (Showing top 4 results out of 315)

origin: apache/tinkerpop

/**
 * A helper method to construct a {@link VertexProgram} given the content of the supplied configuration.
 * The class of the VertexProgram is read from the {@link VertexProgram#VERTEX_PROGRAM} static configuration key.
 * Once the VertexProgram is constructed, {@link VertexProgram#loadState} method is called with the provided graph and configuration.
 *
 * @param graph         The graph that the vertex program will execute against
 * @param configuration A configuration with requisite information to build a vertex program
 * @param <V>           The vertex program type
 * @return the newly constructed vertex program
 */
public static <V extends VertexProgram> V createVertexProgram(final Graph graph, final Configuration configuration) {
  try {
    final Class<V> vertexProgramClass = (Class) Class.forName(configuration.getString(VERTEX_PROGRAM));
    final Constructor<V> constructor = vertexProgramClass.getDeclaredConstructor();
    constructor.setAccessible(true);
    final V vertexProgram = constructor.newInstance();
    vertexProgram.loadState(graph, configuration);
    return vertexProgram;
  } catch (final Exception e) {
    throw new IllegalStateException(e.getMessage(), e);
  }
}
origin: apache/tinkerpop

@Override
public void loadState(final Graph graph, final Configuration configuration) {
  VertexProgram.super.loadState(graph, configuration);
  this.traversal = PureTraversal.loadState(configuration, VertexProgramStep.ROOT_TRAVERSAL, graph);
  this.haltedTraversers = TraversalVertexProgram.loadHaltedTraversers(configuration);
  this.programStep = new TraversalMatrix<>(this.traversal.get()).getStepById(configuration.getString(ProgramVertexProgramStep.STEP_ID));
  this.memoryComputeKeys.addAll(MemoryTraversalSideEffects.getMemoryComputeKeys(this.traversal.get()));
  this.memoryComputeKeys.add(MemoryComputeKey.of(TraversalVertexProgram.HALTED_TRAVERSERS, Operator.addAll, false, false));
  this.memoryComputeKeys.add(MemoryComputeKey.of(TraversalVertexProgram.ACTIVE_TRAVERSERS, Operator.addAll, true, true));
}
origin: org.apache.tinkerpop/gremlin-core

/**
 * A helper method to construct a {@link VertexProgram} given the content of the supplied configuration.
 * The class of the VertexProgram is read from the {@link VertexProgram#VERTEX_PROGRAM} static configuration key.
 * Once the VertexProgram is constructed, {@link VertexProgram#loadState} method is called with the provided graph and configuration.
 *
 * @param graph         The graph that the vertex program will execute against
 * @param configuration A configuration with requisite information to build a vertex program
 * @param <V>           The vertex program type
 * @return the newly constructed vertex program
 */
public static <V extends VertexProgram> V createVertexProgram(final Graph graph, final Configuration configuration) {
  try {
    final Class<V> vertexProgramClass = (Class) Class.forName(configuration.getString(VERTEX_PROGRAM));
    final Constructor<V> constructor = vertexProgramClass.getDeclaredConstructor();
    constructor.setAccessible(true);
    final V vertexProgram = constructor.newInstance();
    vertexProgram.loadState(graph, configuration);
    return vertexProgram;
  } catch (final Exception e) {
    throw new IllegalStateException(e.getMessage(), e);
  }
}
origin: org.apache.tinkerpop/gremlin-test

@Override
public void loadState(final Graph graph, final Configuration configuration) {
  VertexProgram.super.loadState(graph, configuration);
  this.traversal = PureTraversal.loadState(configuration, VertexProgramStep.ROOT_TRAVERSAL, graph);
  this.haltedTraversers = TraversalVertexProgram.loadHaltedTraversers(configuration);
  this.programStep = new TraversalMatrix<>(this.traversal.get()).getStepById(configuration.getString(ProgramVertexProgramStep.STEP_ID));
  this.memoryComputeKeys.addAll(MemoryTraversalSideEffects.getMemoryComputeKeys(this.traversal.get()));
  this.memoryComputeKeys.add(MemoryComputeKey.of(TraversalVertexProgram.HALTED_TRAVERSERS, Operator.addAll, false, false));
  this.memoryComputeKeys.add(MemoryComputeKey.of(TraversalVertexProgram.ACTIVE_TRAVERSERS, Operator.addAll, true, true));
}
org.apache.tinkerpop.gremlin.process.computerVertexProgramloadState

Javadoc

When it is necessary to load the state of the VertexProgram, this method is called. This is typically required when the VertexProgram needs to be serialized to another machine. Note that what is loaded is simply the instance state, not any processed data.

Popular methods of VertexProgram

  • getMemoryComputeKeys
    The Memory keys that will be used during the computation. These are the only keys that can be read o
  • workerIterationEnd
    This method is called at the end of each iteration of each "computational chunk." The set of vertice
  • workerIterationStart
    This method is called at the start of each iteration of each "computational chunk." The set of verti
  • createVertexProgram
    A helper method to construct a VertexProgram given the content of the supplied configuration. The cl
  • execute
    This method denotes the main body of the computation and is executed on each vertex in the graph. Th
  • getMessageCombiner
    Combine the messages in route to a particular vertex. Useful to reduce the amount of data transmitte
  • getVertexComputeKeys
    The org.apache.tinkerpop.gremlin.structure.Element properties that will be mutated during the comput
  • setup
    The method is called at the beginning of the computation. The method is global to the GraphComputer
  • terminate
    The method is called at the end of each iteration to determine if the computation is complete. The m
  • getMapReducers
    The set of MapReduce jobs that are associated with the VertexProgram. This is not necessarily the ex
  • storeState
    When it is necessary to store the state of the VertexProgram, this method is called. This is typical
  • clone
    When multiple workers on a single machine need VertexProgram instances, it is possible to use clone.
  • storeState,
  • clone,
  • getElementComputeKeys,
  • getMessageScopes,
  • getFeatures,
  • getPreferredPersist,
  • getPreferredResultGraph,
  • getTraverserRequirements

Popular in Java

  • Making http requests using okhttp
  • setRequestProperty (URLConnection)
  • startActivity (Activity)
  • getSharedPreferences (Context)
  • URI (java.net)
    A Uniform Resource Identifier that identifies an abstract or physical resource, as specified by RFC
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Reference (javax.naming)
  • IsNull (org.hamcrest.core)
    Is the value null?
  • Option (scala)
  • Top 15 Vim Plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

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