Manage Tasks¶
Data Type¶
A task is for example a print job to PLOSSYS netdome. You can manage tasks by specifying task as <dataType> in the SEAL OP-CLI call:
opcli task <command> <option>
Display the Options and Parameters¶
By specifying the --help option, you get the available options and parameters for the task data type:
opcli task --help
Create a Task¶
With the create command, you create a task:
opcli task create --listfile <file>|--task-name <name> [--format <format>] [--metadata <metadata>] [--owner <owner>] [task-items <taskId>] [--type <type>]
-
--format <format>: Format of the task file; available values:rli,csv,json; default:json -
--listfile <file>: Path and name of the file to be imported as task; either--task-nameor--listfileis mandatory -
--metadata <metadata>: Metadata in JSON syntax, for example,'{"status":"new", "origin":"system"}'; only evaluated with--task-name -
--owner <owner>: Account name of the user who is to be the owner of the task -
--service-id <serviceId>: Name of the connector to which the task is to be assigned; available values:operator-p4and other connectors possibly configured in SEAL Operator; mandatory -
--task-items <taskItems>: Task items in JSON syntax; only evaluated with--task-name -
--task-name <name>: Name of the task; only evaluated with--task-name -
--type <type>: Task type; mandatory if the connector supports multiple types, for example, theoperator-dpfconnector
Example - create a task named print for the operator-p4 connector with the status and origin metadata
opcli task create print --metadata '{"status":"new", "origin":"system"}' --service-id operator-p4
Example - create a task named convert for convert type of the operator-dpf connector
opcli task create convert --service-id operator-dpf --type convert
Get the Metadata and Items of a Task¶
With the get command, you get the metadata and the items of a task. The metadata are output as JSON object on STDOUT.
opcli task get <taskId> --service-id <serviceId> [--embed input|output]
-
<taskId>: ID of the task; mandatoryHint - tid
The task ID is the value of the
tidsetting and output when the task is created, for example,"tid":"412a4a42-c48b-4d66-a3b6-8fecb13f38dc". -
--embed <listType>: Additionally, output the items of the input or output list as well; available values:input,output; default: none -
--service-id <serviceId>: Name of the connector to which the task has been assigned; available values:operator-p4and other connectors possibly configured in SEAL Operator; mandatory
Example - get the metadata of the task with the ID 412a4a42-c48b-4d66-a3b6-8fecb13f38dc and the operator-p4 connector
opcli task get 412a4a42-c48b-4d66-a3b6-8fecb13f38dc --service-id operator-p4
Example - get the metadata and the items of the task with the ID 412a4a42-c48b-4d66-a3b6-8fecb13f38dc and the operator-p4 connector
opcli task get 412a4a42-c48b-4d66-a3b6-8fecb13f38dc --service-id operator-p4 --embed input
Replace or Delete the Metadata of a Task¶
With the replace-meta command, you replace the metadata of a task. The existent metadata are deleted and the specified metadata are set. For deleting the existent metadata, specify an empty JSON object as metadata.
opcli task replace-meta <taskId> --file <file>|--metadata <metadata> --service-id <serviceId>
-
<taskId>: ID of the task; mandatory -
--file <file>: Path and name of a file containing the new metadata as JSON object -
--metadata <metadata>: New metadata in JSON syntax, for example,'{"status":"obsolete"}' -
--service-id <serviceId>: Name of the connector to which the task has been assigned; available values:operator-p4and other connectors possibly configured in SEAL Operator; mandatory
Example - replace the metadata of the task by the metadata specified as option
opcli task replace-meta 412a4a42-c48b-4d66-a3b6-8fecb13f38dc --metadata '{"status":"obsolete"}' --service-id operator-p4
Example - replace the metadata of the task by the metadata specified in the metadata.json file
opcli task replace-meta 412a4a42-c48b-4d66-a3b6-8fecb13f38dc --file metadata.json --service-id operator-p4
Example - delete the metadata of the task
opcli task replace-meta 412a4a42-c48b-4d66-a3b6-8fecb13f38dc --metadata '{}' --service-id operator-p4
Execute an Action with a Task¶
With the command command, you execute an action with a task:
Hint - availability
The available actions depend on the connector. The --start action is supposed to exist in every connector. For the operator-p4 connector, --abort, --pause and --resume are available additionally.
opcli task command <taskId> --<action> --service-id <serviceId>
-
<taskId>: ID of the task; mandatory -
--service-id <serviceId>: Name of the connector to which the task has been assigned; available values:operator-p4and other connectors possibly configured in SEAL Operator; mandatory -
--start: The task will be started; -
--<action>: Another action which can be executed with the task; depends on the connector.
Example - start the task for the operator-p4 connector
opcli task command 412a4a42-c48b-4d66-a3b6-8fecb13f38dc --start --service-id operator-p4
Example - abort the task for the operator-p4 connector
opcli task command 412a4a42-c48b-4d66-a3b6-8fecb13f38dc --abort --service-id operator-p4
Example - pause the task for the operator-p4 connector
opcli task command 412a4a42-c48b-4d66-a3b6-8fecb13f38dc --pause --service-id operator-p4
Example - resume the paused task for the operator-p4 connector
opcli task command 412a4a42-c48b-4d66-a3b6-8fecb13f38dc --resume --service-id operator-p4