_ewtask

  • -

_ewtask

Category : latest version

Each filesystem command like new file or folder creation is executed as a task. Tasks can define also complex operations like batch upload, thumbnails regeneration etc. Each task is defined by action attribute and stored in separate index for historical purposes.

To manage and monitor tasks you can use one of:

Parameter From version Requirement Type Description
status all mandatory string Task id whose status is being requested
cancel all mandatory string Task id whose cancellation is being requested
list all mandatory enum: null, active Leave empty to browse all currently running and historical tasks in descending chronological order. Use “active” to list currently running tasks only.
from all optional int works with “list” only
size all optional int An attribute to define number of returned tasks in single response. It works with “list” only.
allhosts >=1.2.1 optional boolean works with “list” only. When set to true, tasks from all nodes will be returned

Examples:

curl -XGET "http://localhost:10200/_ewtask?status=mBWNjwK-QLex0wurnH2JWA"
curl -XGET "http://localhost:10200/_ewtask?cancel=mBWNjwK-QLex0wurnH2JWA"
curl -XGET "http://localhost:10200/_ewtask?list"
curl -XGET "http://localhost:10200/_ewtask?list=active"
curl -XGET "http://localhost:10200/_ewtask?list=active&size=10&from=10"

Sample response with last tasks executed on the cluster:

To execute new tasks

Parameter From version Requirement Type Description
action all mandatory enum: mkdir, rmdir, scan, move, delete, rethumb, rename A definition of task type. Rename action is available from version >=1.2.1
folder all mandatory string Use with “mkdir” and “rmdir” actions. An attribute to define name of the folder to be created or removed. Removing folder removed also all its subfolders and files.
path all optional string Use with “scan” action. An attribute to define local folder to read files from and upload to the cluster. There is intentional distinguish between “path” and “folder”
keepalive >=1.2.4 optional string Use with “scan” action. An attribute to keep scanning task up-and-running and check provided folder for file modifications
newerthan >=1.2.4 optional string Use with “scan” action. An attribute to parse files with modification date>=newerthan
targetfolder all optional string An attribute to define folder to upload files for “scan” action. As default targetfolder has the same value as path. In case of recurrence scan targetfolder includes also subfolders.
recurrence all optional boolean Set to “true” to scan subfolders

Examples:

curl -XGET "http://localhost:10200/_ewtask?action=mkdir&folder=/myfiles"
curl -XGET "http://localhost:10200/_ewtask?action=rmdir&folder=/myfiles"
curl -XGET "http://localhost:10200/_ewtask?action=move&id=aYLro1V_TzO0tfLNmbp4gA&folder=/home"
curl -XGET "http://localhost:10200/_ewtask?action=delete&id=aYLro1V_TzO0tfLNmbp4gA"
curl -XGET "http://localhost:10200/_ewtask?action=rethumb

Sample response for mkdir action:

to import mass of files use scan task as following:

curl -XGET "http://localhost:10200/_ewtask?action=scan&path=/myfiles"
curl -XGET "http://localhost:10200/_ewtask?action=scan&path=/myfiles&targetfolder=/myfiles"
curl -XGET "http://localhost:10200/_ewtask?action=scan&path=/myfiles&targetfolder=/myfiles&recurrence=true"

To check task status, execute following:

curl -XGET "http://localhost:10200/_ewtask?status=mx2NX3FCRP28PSPSrov5nw"

Error codes

Failed task execution returns error message and error code

Constant Error code
ERROR_TASK_WRONG_PARAMETERS 10
ERROR_TASK_SCAN_OTHER_EXCEPTION 20
ERROR_TASK_RETHUMB_OTHER_EXCEPTION 30
ERROR_TASK_RENAME_OTHER_EXCEPTION 40
ERROR_TASK_RENAME_ROOT_CANNOT_BE_RENAMED 41
ERROR_TASK_MOVE_OTHER_EXCEPTION 50
ERROR_TASK_MOVE_FOLDERS_CANNOT_BE_MOVED 51
ERROR_TASK_MOVE_CANNOT_PROCESS 52
ERROR_TASK_DELETE_OTHER_EXCEPTION 60
ERROR_TASK_RMDIR_OTHER_EXCEPTION 70
ERROR_TASK_RMDIR_FOLDER_DOESNT_EXIST 71
ERROR_TASK_CREATE_OTHER_EXCEPTION 80
ERROR_TASK_CREATE_FOLDER_ALREADY_EXIST 81
_ewbrowse
_searchall