Skip to content

Commit

Permalink
perf: 提供根据特征数据查询任务信息的APIGW工具接口 #3398
Browse files Browse the repository at this point in the history
  • Loading branch information
wuyzh39 committed Feb 14, 2025
1 parent 79b4410 commit 0f2df64
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,29 +25,13 @@
package com.tencent.bk.job.execute.model.esb.v3;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.tencent.bk.job.common.esb.model.EsbAppScopeDTO;
import lombok.Data;

import java.util.List;

@Data
public class EsbTaskLinkV3DTO {
/**
* 资源范围类型
*/
@JsonProperty("bk_scope_type")
private String scopeType;

/**
* 资源范围ID
*/
@JsonProperty("bk_scope_id")
private String scopeId;

/**
* 业务ID
*/
@JsonProperty("bk_app_id")
private Long appId;
public class EsbTaskLinkV3DTO extends EsbAppScopeDTO {

/**
* 任务ID
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import com.tencent.bk.job.common.constant.ErrorCode;
import com.tencent.bk.job.common.esb.model.EsbResp;
import com.tencent.bk.job.common.esb.util.EsbDTOAppScopeMappingHelper;
import com.tencent.bk.job.common.iam.constant.ActionId;
import com.tencent.bk.job.common.iam.exception.PermissionDeniedException;
import com.tencent.bk.job.common.iam.model.AuthResult;
Expand Down Expand Up @@ -126,7 +127,7 @@ public EsbResp<List<EsbTaskLinkV3DTO>> queryGSETaskByStep(String username, Strin
List<EsbTaskLinkV3DTO> taskLinks = new ArrayList<>();
for (GseTaskSimpleDTO gseTaskSimpleDTO : gseTaskResult) {
taskLinks.add(buildEsbTaskLinkV3DTO(
resourceScope,
appId,
stepInstance,
gseTaskSimpleDTO.getExecuteCount(),
gseTaskSimpleDTO.getBatch(),
Expand Down Expand Up @@ -158,7 +159,7 @@ public EsbResp<EsbTaskLinkV3DTO> queryJobInstanceByGseTask(String username, Stri
auth(username, appResourceScope);

return EsbResp.buildSuccessResp(buildEsbTaskLinkV3DTO(
resourceScope,
appId,
stepInstanceBaseDTO,
gseTask.getExecuteCount(),
gseTask.getBatch(),
Expand Down Expand Up @@ -187,7 +188,7 @@ private void auth(String username, AppResourceScope appResourceScope) {
}

private EsbTaskLinkV3DTO buildEsbTaskLinkV3DTO(
ResourceScope resourceScope,
Long appId,
StepInstanceBaseDTO stepInstanceBase,
int retryCount,
int batch,
Expand All @@ -197,9 +198,7 @@ private EsbTaskLinkV3DTO buildEsbTaskLinkV3DTO(
EsbTaskLinkV3DTO esbTaskLinkV3DTO = new EsbTaskLinkV3DTO();
esbTaskLinkV3DTO.setJobInstanceId(stepInstanceBase.getTaskInstanceId());
esbTaskLinkV3DTO.setStepInstanceId(stepInstanceBase.getId());
esbTaskLinkV3DTO.setAppId(stepInstanceBase.getAppId());
esbTaskLinkV3DTO.setScopeType(resourceScope.getType().getValue());
esbTaskLinkV3DTO.setScopeId(resourceScope.getId());
EsbDTOAppScopeMappingHelper.fillEsbAppScopeDTOByAppId(appId, esbTaskLinkV3DTO);
esbTaskLinkV3DTO.setRetryCount(retryCount);
esbTaskLinkV3DTO.setBatch(batch);
esbTaskLinkV3DTO.setGseTaskId(gseTaskId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ query gse task id by step instance id
|------------------|----------|---------------------------------------------------------------------------------------------|
| bk_scope_type | string | Resource scope type. Optional values: biz - Business,biz_set - Business Set |
| bk_scope_id | string | Resource scope ID. Corresponds to bk_scope_type, which means business ID or business set ID |
| bk_app_id | long | Business ID |
| bk_biz_id | long | Business ID |
| job_instance_id | long | Job instance ID |
| step_instance_id | long | Step instance ID |
| retry_count | int | Step retry count |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ query job link by gse task id
|------------------|----------|---------------------------------------------------------------------------------------------|
| bk_scope_type | string | Resource scope type. Optional values: biz - Business,biz_set - Business Set |
| bk_scope_id | string | Resource scope ID. Corresponds to bk_scope_type, which means business ID or business set ID |
| bk_app_id | long | Business ID |
| bk_biz_id | long | Business ID |
| job_instance_id | long | Job instance ID |
| step_instance_id | long | Step instance ID |
| retry_count | int | Step retry count |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
|------------------|----------|-----------------------------------------|
| bk_scope_type | string | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| bk_app_id | long | 业务ID |
| bk_biz_id | long | 业务ID |
| job_instance_id | long | 作业实例ID |
| step_instance_id | long | 脚本实例ID |
| retry_count | int | 重试次数 |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
|------------------|----------|-----------------------------------------|
| bk_scope_type | string | 资源范围类型。可选值: biz - 业务,biz_set - 业务集 |
| bk_scope_id | string | 资源范围ID, 与bk_scope_type对应, 表示业务ID或者业务集ID |
| bk_app_id | long | 业务ID |
| bk_biz_id | long | 业务ID |
| job_instance_id | long | 作业实例ID |
| step_instance_id | long | 脚本实例ID |
| retry_count | int | 重试次数 |
Expand Down
100 changes: 50 additions & 50 deletions support-files/bk-api-gateway/v3/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3313,53 +3313,53 @@ paths:
descriptionEn: Callback protocol
/api/v3/system/query_gse_task:
get:
operationId : system_query_gse_task
description : 根据step_id查询gse task id
tags : [ 'system' ]
responses :
default :
description : ''
x-bk-apigateway-resource :
isPublic : false
allowApplyPermission : false
matchSubpath : false
backend :
# name: default 支持设置 backend, 默认不配置为 default,和 stage 的 backends 配置的后端服务 name 一致
type : HTTP
method : get
path : /api/job/v3/job-execute/query_gse_task
matchSubpath : false
timeout : 0
upstreams : { }
transformHeaders : { }
authConfig :
appVerifiedRequired : true
userVerifiedRequired : false
resourcePermissionRequired : true
descriptionEn : Query GSE task id by step id
/api/v3/system/query_job_instance :
get :
operationId : system_query_job_instance
description : 根据gse_task_id查询job任务
tags : [ 'system' ]
responses :
default :
description : ''
x-bk-apigateway-resource :
isPublic : false
allowApplyPermission : false
matchSubpath : false
backend :
# name: default 支持设置 backend, 默认不配置为 default,和 stage 的 backends 配置的后端服务 name 一致
type : HTTP
method : get
path : /api/job/v3/job-execute/query_job_instance
matchSubpath : false
timeout : 0
upstreams : { }
transformHeaders : { }
authConfig :
appVerifiedRequired : true
userVerifiedRequired : false
resourcePermissionRequired : true
descriptionEn : Query job instance by GSE task id
operationId: system_query_gse_task
description: 根据step_id查询gse task id
tags: ['system']
responses:
default:
description: ''
x-bk-apigateway-resource:
isPublic: false
allowApplyPermission: false
matchSubpath: false
backend:
# name: default 支持设置 backend, 默认不配置为 default,和 stage 的 backends 配置的后端服务 name 一致
type: HTTP
method: get
path: /api/job/v3/job-execute/query_gse_task
matchSubpath: false
timeout: 0
upstreams: {}
transformHeaders: {}
authConfig:
appVerifiedRequired: true
userVerifiedRequired: false
resourcePermissionRequired: true
descriptionEn: Query GSE task id by step id
/api/v3/system/query_job_instance:
get:
operationId: system_query_job_instance
description: 根据gse_task_id查询job任务
tags: ['system']
responses:
default:
description: ''
x-bk-apigateway-resource:
isPublic: false
allowApplyPermission: false
matchSubpath: false
backend:
# name: default 支持设置 backend, 默认不配置为 default,和 stage 的 backends 配置的后端服务 name 一致
type: HTTP
method: get
path: /api/job/v3/job-execute/query_job_instance
matchSubpath: false
timeout: 0
upstreams: {}
transformHeaders: {}
authConfig:
appVerifiedRequired: true
userVerifiedRequired: false
resourcePermissionRequired: true
descriptionEn: Query job instance by GSE task id

0 comments on commit 0f2df64

Please sign in to comment.