Use apps

Updated at:

An app is a new feature in Alibaba Cloud BatchCompute. It lets you encapsulate third-party software into an app for other users. An app is a template for resource configurations in BatchCompute that includes descriptive information, such as the image, instance type, and number of virtual machines (VMs).

View apps

Retrieve the list of apps.

bcs a

Retrieve the parameters of an app.

bcs a :cromwell  # View details
bcs a 1          # Or, use the ordinal number.

View the details of an app.

Note: You can view the details of only the private apps that you created. These details include information such as the image that the software uses and the command line for running the app.

bcs a my-app 0  # View the details of revision 0.

Create a private app

You can use the create_app|ca command to create a private app.

Command:

bcs create_app|ca <app_name> <cmd> [option]

To view the help information, add the -h option: bcs ca -h.

The easiest method for creating an app

bcs ca my_app "echo 123" -i img-ubuntu

Alternatively, you can submit an app description file directly.

First, prepare an app description file named ./myapp.json.

{
    "Name": "myapp",
    "EnvVars": {},
    "Description": "", 
    "CommandLine": "echo 123",
    "OutputParameters": {}, 
    "VM": {
        "ECSImageId": "img-ubuntu"
    },
    "Daemonize": false, 
    "InputParameters": {}, 
    "Config": {
        "InstanceCount": {
            "Default": 1, 
            "Description": "", 
            "Overwritable": true
        }, 
        "ResourceType": {
            "Default": "OnDemand", 
            "Description": "", 
            "Overwritable": true
        }, 
        "DiskType": {
            "Default": "cloud_efficiency ", 
            "Description": "", 
            "Overwritable": true
        }, 
        "MaxRetryCount": {
            "Default": 0, 
            "Description": "", 
            "Overwritable": true
        }, 
        "Timeout": {
            "Default": 86400, 
            "Description": "", 
            "Overwritable": true
        }, 
        "MinDiskSize": {
            "Default": 40, 
            "Description": "", 
            "Overwritable": true
        }, 
        "MinDataDiskSize": {
            "Default": 100, 
            "Description": "", 
            "Overwritable": true
        }, 
        "DataDiskType": {
            "Default": "cloud_efficiency ", 
            "Description": "", 
            "Overwritable": true
        }, 
        "DataDiskMountPoint": {
            "Default": "/home/mount/", 
            "Description": "", 
            "Overwritable": true
        }, 
        "InstanceType": {
            "Default": "", 
            "Description": "", 
            "Overwritable": true
        }
    }
}

Then, run the following command to submit the file:

bcs ca --file myapp.json

You can also specify an option to overwrite the configuration in app.json.

bcs ca --file myapp.json -t ecs.s3.large

Modify and delete an app

bcs ua -h         # Modify a custom app.
bcs da -h         # Delete a custom app.

To view the help information, use the -h option.

Submit an app job

  • Currently, only AutoCluster jobs are supported. Support for Cluster jobs will be added in a future release.

You can use the asub command to quickly submit a job for an app.

bcs asub <app_name> -h  # View the parameters for submitting a job with the specified app. The submission parameters vary for each app.

For example: bcs asub cromwell -h

  • Use options that start with --input_ to specify the input parameters for the app. You can also use options that start with --input-from-file_. For the latter, if the parameter value is a valid local file path, the file is automatically uploaded to the default OSS path.

  • Use options that start with --output_ to specify the output parameters.

You can also specify parameters in the application configuration using --config. For example:

bcs asub <app_name> --config MinDataDiskSize=800,DataDiskType='cloud_efficiency',DataDiskMountPoint='/home/mount/' --input_input1 oss://your-buckit/input1/ --output_output1 oss://your-bucket/output1/

For details about the application configuration parameters, see the API reference.

Support for the Cromwell workflow engine and WDL

The BatchCompute service provides a public app, cromwell, to support workflows written in WDL.

You can use the gen command to quickly create template code. Currently, this command supports WDL and GATK templates.

For example:

bcs gen ./demo -t wdl

This command creates a demo folder in the current directory and generates a simple WDL flow.

demo
  |-- src
    |-- hello.wdl
    |-- inputs.json
    |-- options.json
  |-- main.sh     # Command to submit the app job
  |-- Readme.md   # A must-read for new users

Modify the OSS paths in hello.wdl and main.sh, and then run main.sh to submit the job.

GATK is also supported. Run the following command to create a sample GATK project:

bcs gen ./demo -t gatk