CreateSemanticJob
Saves a reusable semantic task definition. If you use a single-file source, apply for and complete the attachment upload first. After the definition is created, call RunSemanticJob with the returned Name.
Operation description
Scenarios
Creates and saves a reusable semantic task definition. This API operation only saves the configurations of the data source, resource group, and reference files, and does not execute the task immediately.
Recommended procedure
If
Source.typeis set tosingleTableFile, callUploadSemanticFilefirst, use the returnedData.UploadUrlto complete the PUT upload, and then specifyData.FileIdinReferenceFileIds. Alternatively, you can provide a single accessible URI.Configure
Source,ProjectId, andResourceGroupId, and then call this operation to save the task.Call
RunSemanticJobby usingData.Namein the response. After the task is completed, callDownloadSemanticResultsto obtain the output.
Precautions
Name must be unique within the current tenant. The rules for the number of reference files differ between single-file sources and other sources. For details, refer to the descriptions of the ReferenceFileIds and ReferenceFileUris fields.
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
dataworks:CreateSemanticJob |
create |
*All Resource
|
None | None |
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| Name |
string |
Yes |
The name of the semantic task, which is also the task identifier for subsequent calls to RunSemanticJob, DeleteSemanticJob, ListSemanticJobRuns, and DownloadSemanticResults. The name must be unique within the current tenant. |
semantic-job-demo |
| ProjectId |
integer |
No |
The ID of the DataWorks workspace. This parameter is required unless |
100 |
| ResourceGroupId |
string |
Yes |
The identifier of the resource group used to run the semantic task. You do not need to pass this parameter when calling RunSemanticJob. The resource group saved during creation is used. |
rg-demo |
| Source |
object |
Yes |
The input data source configuration for the semantic task. The type field is required. The configuration specifies the data to analyze. This configuration is distinct from the semantic_model YAML generated by the task. The domain field is a string that identifies the business domain and focus area for the task, such as sales. Supported data sources include the following. 1) maxcompute: Specify the scope by using pinnedScopeInfo. Array elements include type and name. If type is project, name is the MaxCompute project name. If type is schema, project is the project name and name is the schema name. For a table-level scope, project is the project name, schema is optional, and name is the table name. 2) holo or starrocks: In addition to type, you must specify dataSourceName and dataSourceEnv, and include ProjectId at the top level of the request. You can use pinnedScopeInfo to restrict the scope to a schema or table. The name element represents the schema or table name. For a table-level scope, schema represents the database or schema to which the table belongs. 3) singleTableFile: ProjectId is not required. For file reference rules, refer to ReferenceFileIds and ReferenceFileUris. After the task runs successfully, call DownloadSemanticResults to retrieve result files such as the semantic_model YAML. The example demonstrates a MaxCompute project scope. |
{"type":"maxcompute","domain":"sales","pinnedScopeInfo":[{"type":"project","name":"mc_project"}]} |
| ReferenceFileIds |
array |
No |
The list of IDs of uploaded reference files. If |
|
|
string |
No |
The ID of an uploaded reference file. |
semantic-job-value |
|
| ReferenceFileUris |
array |
No |
The list of URIs of reference files accessible to the caller. If |
|
|
string |
No |
The URI of an accessible reference file. |
semantic-job-value |
Construct the call parameters based on the description of each request field.
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The standard response for creating a semantic task. |
||
| RequestId |
string |
The request ID. You can use this ID to locate logs and troubleshoot issues. |
676271D6-53B4-57BE-89FA-72F7AE1418DF |
| Success |
boolean |
Indicates whether the request is successful. |
|
| Data |
object |
The saved semantic task definition. Use |
|
| Id |
integer |
The internal unique ID of the task definition, which is used to identify the created task. |
1 |
| Name |
string |
The saved task name. This value is used for subsequent operations such as running, deleting, querying run records, and downloading results. |
semantic-job-demo |
| UserId |
string |
The identifier of the user who created the task. |
user-demo |
| Creator |
string |
The identifier of the task creator, which has the same value as |
user-demo |
| ProjectId |
integer |
The ID of the DataWorks workspace to which the task belongs. This ID is used as the |
100 |
| Type |
string |
The saved |
maxcompute |
| Source |
object |
The saved input data source configuration, which corresponds to |
{"type":"maxcompute","domain":"sales","pinnedScopeInfo":[{"type":"project","name":"mc_project"}]} |
| ReferenceFileIds |
array |
The list of IDs of associated uploaded files. If the source type is |
|
|
string |
The |
FID1 |
|
| ReferenceFileUris |
array |
The list of URIs of associated external reference files. If the source type is |
|
|
string |
The URI of an accessible reference file provided by the caller. |
https://example.com/reference.pdf |
|
| GmtCreate |
integer |
The time when the task definition was created. The value is a UNIX timestamp in milliseconds. |
1700000000000 |
| GmtModified |
integer |
The time when the task definition was last modified. The value is a UNIX timestamp in milliseconds. |
1700000000000 |
| ResourceGroupId |
string |
The identifier of the resource group to be used when running this task. |
rg-demo |
For the meanings of response fields and subsequent call relationships, refer to the description of each field.
Examples
Success response
JSON format
{
"RequestId": "676271D6-53B4-57BE-89FA-72F7AE1418DF",
"Success": false,
"Data": {
"Id": 1,
"Name": "semantic-job-demo",
"UserId": "user-demo",
"Creator": "user-demo",
"ProjectId": 100,
"Type": "maxcompute",
"Source": {
"type": "maxcompute",
"domain": "sales",
"pinnedScopeInfo": [
{
"type": "project",
"name": "mc_project"
}
]
},
"ReferenceFileIds": [
"FID1"
],
"ReferenceFileUris": [
"https://example.com/reference.pdf"
],
"GmtCreate": 1700000000000,
"GmtModified": 1700000000000,
"ResourceGroupId": "rg-demo"
}
}
Error codes
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.