arangosh> var theQuery = 'FOR sleepLoooong IN 1..5 LET sleepLoooonger = SLEEP(1000) RETURN sleepLoooong';
arangosh> var tasks = require("@arangodb/tasks");
arangosh> tasks.register({
........> id: "mytask-1",
........> name: "this is a sample task to spawn a slow aql query",
........> command: "require('@arangodb').db._query('" + theQuery + "');"
........> });
{
"id" : "mytask-1",
"name" : "this is a sample task to spawn a slow aql query",
"created" : 1550658775.0549188,
"type" : "timed",
"offset" : 0,
"command" : "(function (params) { require('@arangodb').db._query('FOR sleepLoooong IN 1..5 LET sleepLoooonger = SLEEP(1000) RETURN sleepLoooong'); } )(params);",
"database" : "_system"
}
arangosh> queries.current();
[
{
"id" : "346",
"query" : "FOR sleepLoooong IN 1..5 LET sleepLoooonger = SLEEP(1000) RETURN sleepLoooong",
"bindVars" : {
},
"started" : "2019-02-20T10:32:55Z",
"runTime" : 2.0032975673675537,
"state" : "executing",
"stream" : false
}
]