Running and Managing Tasks via the Command Line

You can use the datasphere command line interface to run and manage certain tasks.

Prerequisites

To work with tasks and task chains on the command line, you must have a scoped role that grants you access to a space with the following privileges:
  • Data Warehouse General (-R------) - To access SAP Datasphere.

  • Space Files (-R------) - To read objects in your spaces.

  • Data Warehouse Data Integration (-RU-----) - To run tasks and task chains.

The DW Integrator scoped role template, for example, grants these privileges.For more information, see Privileges and Permissions and Standard Roles Delivered with SAP Datasphere.
You must, in addition:
To browse the available commands, enter the following and press Return:
datasphere tasks
For general information about working with tasks in SAP Datasphere, see Managing and Monitoring Data Integration.

Run Task Chains

You can run, retry, and cancel a task chain, including providing values for input parameters and return the task ID.

To run a task chain, enter the following command and press Return:
datasphere tasks chains run 
     --space <id> 
     --object <technical_name> 
     [--input-parameters '<stringified-json>']
To retry a task chain, enter the following command and press Return:
datasphere tasks chains retry
  --space <id>  
  --object <id>
To cancel a task chain, enter the following command and press Return:
datasphere tasks chains cancel
  --space <id>  
  --log <id>
Complete the parameters as follows:

Parameter

Description

--space <id>

Enter the Space ID of the space.

--object <technical_name>

Specify the technical name of the task chain to run.

--object <id>

Enter the ID of the object.

--log<id>

Enter the ID of the log for the run.

--input-parameters '<stringified-json>'

[optional] Enter the names and values of input parameters in stringified json format. For example:

'{"CATEGORY":"A","FISCAL_YEAR":"2025"}'
For example to run the task chain LoadChain in space MySpace, while setting the parameters YEARand DEPT to 2026 and Salesrespectively, enter:
datasphere tasks chains run --space MySpace --object LoadChain --input-parameters '{"YEAR":"2026","DEPT":"Sales"}'

For more information about running and monitoring task chains, see Monitoring Task Chains.

Run Replication Flows

You can operate replication flows and individual replication objects.

To operate a replication flow or replication object, enter the following command and press Return:
datasphere tasks replication-flows <action> 
  --space <id> 
  —-technical-name <technical_name>
Complete the parameters as follows:

Parameter

Description

<action>

Enter the desired action:

  • status [--object <id>] - Obtain the current status of the replication flow.

  • run - Start a replication flow run.

  • pause - Pause a running replication flow.

  • resume - Resume a paused replication flow.

  • stop - Stop the replication flow.

  • stop --no-cleanup - [scheduled flows with delta loads] Stop the replication flow but do not delete any already replicated data.

  • pause-object --object <id> - Pause the specified running replication object.

  • resume-object --object <id> - Resume the specified paused replication object.

  • restart-object --object <id> - Restart the specified replication object.

--space <id>

Enter the Space ID of the space.

--technical-name <technical_name>

Specify the technical name of the replication flow to run.

For example to run the replication flow RepSales in space MySpace, enter:
datasphere tasks replication-flows run --space MySpace --technical-name RepSales
To obtain the status of object SalesHeader in replication flow RepSales, enter:
datasphere tasks replication-flows status --space MySpace --technical-name RepSales --object SalesHeader

For more information about running and monitoring replication flows, see Monitoring Flows.

Obtain Task Logs

You can obtain log information for a run at various levels of detail.

To get a list of logs for all the runs of an object, enter the following command and press Return:
datasphere tasks logs list 
  --space <id>
  --object <technical_name>
To get the status or details of a particular run, enter the following command and press Return:
datasphere tasks logs get 
  --space <id> 
  --log-id <id> 
  [--info-level status | details]
To get the extended details of a particular run, enter the following command and press Return:
datasphere tasks logs get-extended 
  --space <id> 
  --log-id <id>
  [--accept <format>]
Complete the parameters as follows:

Parameter

Description

--space <id>

Enter the Space ID of the space.

--object <technical_name>

Enter the technical name of the object.

--log-id <id>

Enter the ID of the log for the run.

--info-level status | details

[optional] Select whether to return:

  • status - [default] Returns RUNNING, COMPLETED, or FAILED.

  • details - Returns full status information including, for task chains, detailed logs for subtasks.

--accept <format>

[optional] Select whether to return:

  • application/vnd.sap.datasphere.task.log.status+json - [default] Return the status as a string.

  • application/vnd.sap.datasphere.task.log.status.object+json - Return the status object if no accept header is specified.

  • application/vnd.sap.datasphere.task.log.details+json - Returns detailed logs of including messages and, for task chains, detailed logs for subtasks.

  • application/vnd.sap.datasphere.task.log.details.extended+json - Return extended logs including all detailed log info and message details.

For more information about reviewing task logs, see Managing and Monitoring Data Integration.