ArangoDB v3.10 reached End of Life (EOL) and is no longer supported.
This documentation is outdated. Please see the most recent stable version.
Pregel HTTP API
The HTTP API for Pregel lets you execute, cancel, and list Pregel jobs
See Distributed Iterative Graph Processing (Pregel) for details.
Start a Pregel job execution
algorithm* string
Name of the algorithm. One of:
"pagerank"
- Page Rank"sssp"
- Single-Source Shortest Path"connectedcomponents"
- Connected Components"wcc"
- Weakly Connected Components"scc"
- Strongly Connected Components"hits"
- Hyperlink-Induced Topic Search"effectivecloseness"
- Effective Closeness"linerank"
- LineRank"labelpropagation"
- Label Propagation"slpa"
- Speaker-Listener Label Propagation
params object
General as well as algorithm-specific options.
The most important general option is “store”, which controls whether the results computed by the Pregel job are written back into the source collections or not.
Another important general option is “parallelism”, which controls the number of parallel threads that work on the Pregel job at most. If “parallelism” is not specified, a default value may be used. In addition, the value of “parallelism” may be effectively capped at some server-specific value.
The option “useMemoryMaps” controls whether to use disk based files to store temporary results. This might make the computation disk-bound, but allows you to run computations which would not fit into main memory. It is recommended to set this flag for larger datasets.
The attribute “shardKeyAttribute” specifies the shard key that edge collections are sharded after (default:
"vertex"
).
Examples
Run the Weakly Connected Components (WCC) algorithm against a graph and store
the results in the vertices as attribute component
:
curl -X POST --header 'accept: application/json' --data-binary @- --dump - http://localhost:8529/_api/control_pregel
{
"algorithm": "wcc",
"graphName": "connectedComponentsGraph",
"params": {
"maxGSS": 36,
"resultField": "component"
}
}
Get a Pregel job execution status
200 OK
HTTP 200 is returned in case the job execution ID was valid and the state is returned along with the response.
state* string
The state of the execution. The following values can be returned:
"none"
: The Pregel run did not yet start."loading"
: The graph is loaded from the database into memory before the execution of the algorithm."running"
: The algorithm is executing normally."storing"
: The algorithm finished, but the results are still being written back into the collections. Occurs only if the store parameter is set to true."done"
: The execution is done. In version 3.7.1 and later, this means that storing is also done. In earlier versions, the results may not be written back into the collections yet. This event is announced in the server log (requires at least info log level for thepregel
log topic)."canceled"
: The execution was permanently canceled, either by the user or by an error."fatal error"
: The execution has failed and cannot recover."in error"
: The execution is in an error state. This can be caused by DB-Servers being not reachable or being non responsive. The execution might recover later, or switch to"canceled"
if it was not able to recover successfully."recovering"
(currently unused): The execution is actively recovering and switches back torunning
if the recovery is successful.
Response Body application/json objectThe information about the Pregel job.
Examples
Get the execution status of a Pregel job:
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/control_pregel/68762
List the running Pregel jobs
200 OK
Is returned when the list of jobs can be retrieved successfully.
array of objects
A list of objects describing the Pregel jobs.
state* string
The state of the execution. The following values can be returned:
"none"
: The Pregel run did not yet start."loading"
: The graph is loaded from the database into memory before the execution of the algorithm."running"
: The algorithm is executing normally."storing"
: The algorithm finished, but the results are still being written back into the collections. Occurs only if the store parameter is set to true."done"
: The execution is done. In version 3.7.1 and later, this means that storing is also done. In earlier versions, the results may not be written back into the collections yet. This event is announced in the server log (requires at least info log level for thepregel
log topic)."canceled"
: The execution was permanently canceled, either by the user or by an error."fatal error"
: The execution has failed and cannot recover."in error"
: The execution is in an error state. This can be caused by DB-Servers being not reachable or being non responsive. The execution might recover later, or switch to"canceled"
if it was not able to recover successfully."recovering"
(currently unused): The execution is actively recovering and switches back torunning
if the recovery is successful.
Response Body application/json
Examples
Get the status of all active Pregel jobs:
curl --header 'accept: application/json' --dump - http://localhost:8529/_api/control_pregel/
Cancel a Pregel job execution
Cancel an execution which is still running, and discard any intermediate results. This immediately frees all memory taken up by the execution, and makes you lose all intermediary data.
You might get inconsistent results if you requested to store the results and
then cancel an execution when it is already in its "storing"
state (or
"done"
state in versions prior to 3.7.1). The data is written multi-threaded
into all collection shards at once. This means there are multiple transactions
simultaneously. A transaction might already be committed when you cancel the
execution job. Therefore, you might see some updated documents, while other
documents have no or stale results from a previous execution.
Examples
Cancel a Pregel job to stop the execution or to free up the results if it was
started with "store": false
and is in the done state:
curl -X DELETE --header 'accept: application/json' --dump - http://localhost:8529/_api/control_pregel/69055