When the algorithm involves writing disk operation (i.e. write()
parameter is used in algo()
command), it would be run as background task. To facilitate the observation and management of the algorithm's running state and view the results, UQL supports various operations on algorithm background tasks in different status, as listed below:
Status | Description | clear() |
stop() |
---|---|---|---|
pending | Queuing, not executed yet | √ | |
computing | Computing | √ | |
writing | Writing | ||
stopped | Stopped | √ | |
failed | Failed | √ | |
done | Done | √ |
Please refer to the algorithm handbook Ultipa Graph Analytics & Algorithms for the usage of write()
.
Show Background Task
Returned table name: _task
Returned table header: id
| name
| params
| start
| egnineTime
| totalTime
| result
| status
(the id, name, parameters, start time, engine duration (second), total duration (second), result and current status of the algorithm background task)
Syntax:
// To show all algorithm background tasks in the current graphset
show().task()
// To show a certain algorithm background task in the current graphset
show().task(<id>)
// To show all tasks of a certain algorithm in the current graphset
show().task("<taskName>", "*")
// To show all algorithm background tasks of a certain status in the current graphset
show().task("*", "<status>")
// To show all tasks of a certain algorithm and status in the current graphset
show().task("<taskName>", "<status>")
Example: Show all algorithm background tasks of "khop_all"
show().task("khop_all", "*")
Exmaple: Show all algorithm background tasks that are computing
show().task("*", "computing")
Clear Background Task
Syntax:
// To clear all algorithm background tasks in the current graphset (excluding those status are computing and writing)
clear().task("*")
// To clear a certain algorithm background task in the current graphset (excluding those status are computing and writing)
clear().task(<id>)
// To clear all tasks of a certain algorithm in the current graphset (excluding those status are computing and writing)
clear().task("<taskName>", "*")
// To clear all algorithm background tasks of a certain status in the current graphset (excluding those status are computing and writing)
clear().task("*", "<status>")
// To clear all tasks of a certain algorithm and status in the current graphset (excluding those status are computing and writing)
clear().task("<taskName>", "<status>")
Example: Clear all algorithm background tasks
clear().task("*")
Example: Clear algorithm background task with id = 12
clearTask().id(12)
Example: Clear all "khop_all" background tasks that are pending
clear().task("khop_all", "pending")
Stop Background Task
Syntax:
// To stop all algorithm background tasks that are computing in the current graphset
stop().task("*")
// To stop a certain algorithm background task that is computing in the current graphset
stop().task(<id>)