Command Line Usage
With the Command Line Interface (CLI) it is possible to manage and execute AutomationInterface scripts directly from your terminal. This chapter summarizes the most important CLI commands.
List Script Task
To list all script tasks, use the following CLI command:
Usage: dvcfg-b automation list [-h] -b=<folder> [-p=<file>] [-l=<location>[,<location>...]]... [--no-save]
Description:
List automation tasks from a specific project, bsw-package, location, or from all sources.
Options:
* -b, --bsw-package=<folder> Directory of the BSW package.
-p, --project=<file> The .dvjson file of the project.
-l, --location=<location>[,<location>...] List of folders containing script files.
E.g.: -l .\\locationA,.\\locationB
--no-save Prevent saving the project to disk.
-h, --help Display the help.
Run Script Task
To execute a script task, use the following CLI command:
NOTE: In case that the script task modifications shall not be saved to the project, you can use the --no-save option.
Usage: dvcfg-b automation run [-h] -b=<folder> [-p=<file>] -t=<task>[,<task>...] [-t=<task>[,<task>...]]... [-a=<arg>]...
[-l=<location>[,<location>...]]... [--debugger[=<port>]] [--no-save]
Description:
Run automation tasks with arguments.
Options:
* -b, --bsw-package=<folder> Directory of the BSW package.
-p, --project=<file> The .dvjson file of the project.
* -t, --task=<task>[,<task>...] List of script tasks to execute.
E.g.: -t task1,task2
-a, --arg=<arg> Define a set of arguments specific to a single task.
E.g.: -a 'task1' -a '--name=str1 --value=1' -a 'task2' -a '-i 1,2,3'
-l, --location=<location>[,<location>...] List of folders containing script files.
E.g.: -l .\\locationA,.\\locationB
--debugger[=<port>] Enable debugging for the ConfigCore instance.
If no port is specified, uses default port 5005.
E.g.: --debugger or --debugger=5006
--no-save Prevent saving the project to disk.
-h, --help Display the help.
For the AutomationInterface API Reference see API Reference Overview.
Cancelling Script Tasks
You can request cancellation at any time by pressing
Ctrl + C in the terminal. What happens next depends on what the ConfigCore is currently doing and whether the running script cooperates with cancellation.
-
During project loading: If you cancel while a project is still loading, the CLI typically returns to the prompt immediately. The ConfigCore process may still continue the loading operation in the background until it completes, because project loading is not always interruptible at every point.
-
When running multiple script tasks in one CLI call: If multiple script tasks were started in a single CLI invocation and you press`Ctrl + C`, the task that is currently running will usually continue until it finishes (unless it explicitly reacts to cancellation as described below). Any script tasks that have not started yet will be skipped.
-
Cancellation handling inside a running script task: A running script task can react to cancellation in two main ways:
-
Cooperative cancellation via thread interruption: The CLI sends a cancellation request by interrupting the executing thread. If the script task checks the thread’s interrupt status it can stop early, perform cleanup, and exit in a controlled way.
-
Cancellation when transactions are active: If a transaction is opened and a cancellation request occurs, the runtime may abort execution by throwing`com.vector.davinci.util.exceptions.InterruptedRuntimeException`. In that case, the script ends due to that exception and any remaining work in the current run is cancelled according to the CLI behavior described above.
-
The following example shows cooperative cancellation via thread interruption:
scriptTask("MyTask", DV_APPLICATION){
code{
if (Thread.currentThread().isInterrupted()) {
//clean up resources if needed and throw exception to stop script execution
throw new InterruptedRuntimeException("Script was interrupted")
}
}
}
Add Script Location To Project
To add a script location to a DaVinci Configurator 6 project, use the following CLI command:
Usage: dvcfg-b automation add [-h] -p=<file> -b=<folder> -l=<location>[,<location>...] [-l=<location>[,<location>...]]...
[--no-save]
Description:
Add locations containing automation tasks.
Options:
* -p, --project=<file> The .dvjson file of the project.
* -b, --bsw-package=<folder> Directory of the BSW package.
* -l, --location=<location>[,<location>...] List of folders containing script files.
E.g.: -l .\\locationA,.\\locationB
--no-save Prevent saving the project to disk.
-h, --help Display the help.
Remove Script Location From Project
To remove a script location from a DaVinci Configurator 6 project, use the following CLI command:
Usage: dvcfg-b automation remove [-h] -p=<file> -b=<folder> -l=<location>[,<location>...] [-l=<location>[,
<location>...]]... [--no-save]
Description:
Remove locations containing automation tasks.
Options:
* -p, --project=<file> The .dvjson file of the project.
* -b, --bsw-package=<folder> Directory of the BSW package.
* -l, --location=<location>[,<location>...] List of folders containing script files.
E.g.: -l .\\locationA,.\\locationB
--no-save Prevent saving the project to disk.
-h, --help Display the help.