tencent cloud

Feedback

CreateSparkApp

Last updated: 2023-03-17 16:38:31

1. API Description

Domain name for API request: dlc.tencentcloudapi.com.

This API is used to create a Spark application.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: CreateSparkApp.
Version Yes String Common Params. The value used for this API: 2021-01-25.
Region Yes String Common Params. For more information, please see the list of regions supported by the product.
AppName Yes String Spark application name
AppType Yes Integer 1: Spark JAR application; 2: Spark streaming application
DataEngine Yes String The data engine executing the Spark job
AppFile Yes String Execution entry of the Spark application
RoleArn Yes Integer Execution role ID of the Spark job
AppDriverSize Yes String Driver resource specification of the Spark job. Valid values: small, medium, large, xlarge.
AppExecutorSize Yes String Executor resource specification of the Spark job. Valid values: small, medium, large, xlarge.
AppExecutorNums Yes Integer Number of Spark job executors
Eni No String This field has been disused. Use the Datasource field instead.
IsLocal No String Whether it is upload locally. Valid values: cos, lakefs.
MainClass No String Main class of the Spark JAR job during execution
AppConf No String Spark configurations separated by line break
IsLocalJars No String Whether it is upload locally. Valid values: cos, lakefs.
AppJars No String Dependency JAR packages of the Spark JAR job separated by comma
IsLocalFiles No String Whether it is upload locally. Valid values: cos, lakefs.
AppFiles No String Dependency resources of the Spark job separated by comma
CmdArgs No String Command line parameters of the Spark job
MaxRetries No Integer This parameter takes effect only for Spark flow tasks.
DataSource No String Data source name
IsLocalPythonFiles No String PySpark: Dependency upload method. 1: cos; 2: lakefs (this method needs to be used in the console but cannot be called through APIs).
AppPythonFiles No String PySpark: Python dependency, which can be in .py, .zip, or .egg format. Multiple files should be separated by comma.
IsLocalArchives No String Archives: Dependency upload method. 1: cos; 2: lakefs (this method needs to be used in the console but cannot be called through APIs).
AppArchives No String Archives: Dependency resources
SparkImage No String The Spark image version.
SparkImageVersion No String The Spark image version name.
AppExecutorMaxNumbers No Integer The specified executor count (max), which defaults to 1. This parameter applies if the "Dynamic" mode is selected. If the "Dynamic" mode is not selected, the executor count is equal to AppExecutorNums.

3. Output Parameters

Parameter Name Type Description
SparkAppId String The unique ID of the application.
Note: This field may return null, indicating that no valid values can be obtained.
RequestId String The unique request ID, which is returned for each request. RequestId is required for locating a problem.

4. Example

Example1 Creating a Spark application

This example shows you how to create a Spark application.

Input Example

POST / HTTP/1.1
Host: dlc.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: CreateSparkApp
<Common request parameters>

{
    "AppName": "spark-test",
    "AppType": 1,
    "DataEngine": "spark-engine",
    "Eni": "kafka-eni",
    "IsLocal": "cos",
    "AppFile": "test.jar",
    "RoleArn": 12,
    "MainClass": "com.test.WordCount",
    "AppConf": "spark-default.properties",
    "IsLocalJars": "cos",
    "AppJars": "com.test2.jar",
    "IsLocalFiles": "cos",
    "AppFiles": "spark-default.properties",
    "AppDriverSize": "small",
    "AppExecutorSize": "small",
    "AppExecutorNums": 1,
    "AppExecutorMaxNumbers": 1
}

Output Example

{
    "Response": {
        "SparkAppId": "2aedsa7a-9f72-44aa-9fd4-65cb739d6301",
        "RequestId": "2ae4707a-9f72-44aa-9fd4-65cb739d6301"
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation The operation failed.
InvalidParameter.InvalidRoleArn The CAM role arn is invalid.
Contact Us

Contact our sales team or business advisors to help your business.

Technical Support

Open a ticket if you're looking for further assistance. Our Ticket is 7x24 avaliable.

7x24 Phone Support