types.ts 11.7 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import { VNode } from 'vue'
import type { SelectOption } from 'naive-ui'
L
labbomb 已提交
20
import type { TaskExecuteType, TaskType } from '@/store/project/types'
21
import type { IDataBase } from '@/service/modules/data-source/types'
22 23 24 25 26 27
import type {
  IFormItem,
  IJsonItem,
  FormRules,
  IJsonItemParams
} from '@/components/form/types'
28 29 30 31 32
export type { EditWorkflowDefinition } from '@/views/projects/workflow/components/dag/types'
export type {
  IWorkflowTaskInstance,
  WorkflowInstance
} from '@/views/projects/workflow/components/dag/types'
33
export type { IResource, ProgramType, IMainJar } from '@/store/project/types'
34
export type { ITaskState } from '@/common/types'
35 36 37

type SourceType = 'MYSQL' | 'HDFS' | 'HIVE'
type ModelType = 'import' | 'export'
38 39
type RelationType = 'AND' | 'OR'
type ITaskType = TaskType
40
type IDateType = 'hour' | 'day' | 'week' | 'month'
41 42 43 44 45

interface IOption {
  label: string
  value: string | number
}
46 47 48 49 50 51 52 53 54 55

interface ITaskPriorityOption extends SelectOption {
  icon: VNode
  color: string
}
interface IEnvironmentNameOption {
  label: string
  value: string
  workerGroups?: string[]
}
56

57 58
interface ILocalParam {
  prop: string
59 60
  direct?: string
  type?: string
61 62
  value?: string
}
63

64 65 66 67 68
interface IResponseJsonItem extends Omit<IJsonItemParams, 'type'> {
  type: 'input' | 'select' | 'radio' | 'group'
  emit: 'change'[]
}

69 70 71 72 73 74 75 76 77 78 79 80
interface IDependpendItem {
  depTaskCode?: number
  status?: 'SUCCESS' | 'FAILURE'
  definitionCodeOptions?: IOption[]
  depTaskCodeOptions?: IOption[]
  dateOptions?: IOption[]
  projectCode?: number
  definitionCode?: number
  cycle?: 'month' | 'week' | 'day' | 'hour'
  dateValue?: string
}

81
interface IDependTask {
82 83 84
  condition?: string
  nextNode?: number
  relation?: RelationType
85
  dependItemList?: IDependpendItem[]
86 87 88 89 90 91 92
}

interface ISwitchResult {
  dependTaskList?: IDependTask[]
  nextNode?: number
}

93 94 95 96
/*
 * resourceName: resource full name
 * res: resource file name
 */
97
interface ISourceItem {
98 99 100
  id?: number,
  resourceName: string,
  res?: string
101 102
}

103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186
interface ISqoopTargetData {
  targetHiveDatabase?: string
  targetHiveTable?: string
  targetHiveCreateTable?: boolean
  targetHiveDropDelimiter?: boolean
  targetHiveOverWrite?: boolean
  targetHiveTargetDir?: string
  targetHiveReplaceDelimiter?: string
  targetHivePartitionKey?: string
  targetHivePartitionValue?: string
  targetHdfsTargetPath?: string
  targetHdfsDeleteTargetDir?: boolean
  targetHdfsCompressionCodec?: string
  targetHdfsFileType?: string
  targetHdfsFieldsTerminated?: string
  targetHdfsLinesTerminated?: string
  targetMysqlType?: string
  targetMysqlDatasource?: string
  targetMysqlTable?: string
  targetMysqlColumns?: string
  targetMysqlFieldsTerminated?: string
  targetMysqlLinesTerminated?: string
  targetMysqlIsUpdate?: string
  targetMysqlTargetUpdateKey?: string
  targetMysqlUpdateMode?: string
}

interface ISqoopSourceData {
  srcQueryType?: '1' | '0'
  srcTable?: string
  srcColumnType?: '1' | '0'
  srcColumns?: string
  sourceMysqlSrcQuerySql?: string
  sourceMysqlType?: string
  sourceMysqlDatasource?: string
  mapColumnHive?: ILocalParam[]
  mapColumnJava?: ILocalParam[]
  sourceHdfsExportDir?: string
  sourceHiveDatabase?: string
  sourceHiveTable?: string
  sourceHivePartitionKey?: string
  sourceHivePartitionValue?: string
}

interface ISqoopTargetParams {
  hiveDatabase?: string
  hiveTable?: string
  createHiveTable?: boolean
  dropDelimiter?: boolean
  hiveOverWrite?: boolean
  hiveTargetDir?: string
  replaceDelimiter?: string
  hivePartitionKey?: string
  hivePartitionValue?: string
  targetPath?: string
  deleteTargetDir?: boolean
  compressionCodec?: string
  fileType?: string
  fieldsTerminated?: string
  linesTerminated?: string
  targetType?: string
  targetDatasource?: string
  targetTable?: string
  targetColumns?: string
  isUpdate?: string
  targetUpdateKey?: string
  targetUpdateMode?: string
}
interface ISqoopSourceParams {
  srcTable?: string
  srcColumnType?: '1' | '0'
  srcColumns?: string
  srcQuerySql?: string
  srcQueryType?: '1' | '0'
  srcType?: string
  srcDatasource?: string
  mapColumnHive?: ILocalParam[]
  mapColumnJava?: ILocalParam[]
  exportDir?: string
  hiveDatabase?: string
  hiveTable?: string
  hivePartitionKey?: string
  hivePartitionValue?: string
}
187 188 189 190 191 192 193 194 195 196 197 198 199 200
interface ISparkParameters {
  deployMode?: string
  driverCores?: number
  driverMemory?: string
  executorCores?: number
  executorMemory?: string
  numExecutors?: number
  others?: string
}

interface IRuleParameters {
  check_type?: string
  comparison_execute_sql?: string
  comparison_name?: string
201
  comparison_type?: number
202 203 204 205 206
  failure_strategy?: string
  operator?: string
  src_connector_type?: number
  src_datasource_id?: number
  src_table?: string
207 208 209 210 211 212 213
  field_length?: number
  begin_time?: string
  deadline?: string
  datetime_format?: string
  target_filter?: string
  regexp_pattern?: string
  enum_list?: string
214 215
  src_filter?: string
  src_field?: string
216 217 218 219 220 221
  statistics_execute_sql?: string
  statistics_name?: string
  target_connector_type?: number
  target_datasource_id?: number
  target_table?: string
  threshold?: string
222
  mapping_columns?: string
223 224
}

225 226
interface ITaskParams {
  resourceList?: ISourceItem[]
227
  mainJar?: ISourceItem
228
  localParams?: ILocalParam[]
L
labbomb 已提交
229 230 231
  runType?: string
  jvmArgs?: string
  isModulePath?: boolean
232
  rawScript?: string
233
  initScript?: string
234
  programType?: string
235 236 237 238 239 240
  flinkVersion?: string
  jobManagerMemory?: string
  taskManagerMemory?: string
  slot?: number
  taskManager?: number
  parallelism?: number
241 242 243 244 245 246 247 248 249 250
  mainClass?: string
  deployMode?: string
  appName?: string
  driverCores?: number
  driverMemory?: string
  numExecutors?: number
  executorMemory?: string
  executorCores?: number
  mainArgs?: string
  others?: string
251 252 253 254 255 256 257
  httpMethod?: string
  httpCheckCondition?: string
  httpParams?: []
  url?: string
  condition?: string
  connectTimeout?: number
  socketTimeout?: number
258 259 260 261
  type?: string
  datasource?: string
  sql?: string
  sqlType?: string
262 263 264 265
  sendEmail?: boolean
  displayRows?: number
  title?: string
  groupId?: string
266 267
  preStatements?: string[]
  postStatements?: string[]
268
  method?: string
269 270 271 272 273 274
  jobType?: 'CUSTOM' | 'TEMPLATE'
  customShell?: string
  jobName?: string
  hadoopCustomParams?: ILocalParam[]
  sqoopAdvancedParams?: ILocalParam[]
  concurrency?: number
275
  splitBy?: string
276 277 278 279 280
  modelType?: ModelType
  sourceType?: SourceType
  targetType?: SourceType
  targetParams?: string
  sourceParams?: string
281 282
  queue?: string
  master?: string
283
  masterUrl?: string
284 285 286
  switchResult?: ISwitchResult
  dependTaskList?: IDependTask[]
  nextNode?: number
287 288 289 290
  dependence?: {
    relation?: RelationType
    dependTaskList?: IDependTask[]
  }
291 292 293 294 295 296 297 298 299 300 301
  customConfig?: number
  json?: string
  dsType?: string
  dataSource?: number
  dtType?: string
  dataTarget?: number
  targetTable?: string
  jobSpeedByte?: number
  jobSpeedRecord?: number
  xms?: number
  xmx?: number
302 303 304
  sparkParameters?: ISparkParameters
  ruleId?: number
  ruleInputParameter?: IRuleParameters
305
  jobFlowDefineJson?: string
306
  stepsDefineJson?: string
307 308
  zeppelinNoteId?: string
  zeppelinParagraphId?: string
309 310
  zeppelinRestEndpoint?: string
  restEndpoint?: string
311 312
  zeppelinProductionNoteDirectory?: string
  productionNoteDirectory?: string
313 314 315
  hiveCliOptions?: string
  hiveSqlScript?: string
  hiveCliTaskExecutionType?: string
316 317
  noteId?: string
  paragraphId?: string
318 319 320 321 322 323 324 325
  condaEnvName?: string
  inputNotePath?: string
  outputNotePath?: string
  parameters?: string
  kernel?: string
  engine?: string
  executionTimeout?: string
  startTimeout?: string
326
  processDefinitionCode?: number
327 328 329 330
  conditionResult?: {
    successNode?: number[]
    failedNode?: number[]
  }
331 332
  udfs?: string
  connParams?: string
333
  targetJobName?: string
334 335 336 337 338 339
  cluster?: string
  namespace?: string
  clusterNamespace?: string
  minCpuCores?: string
  minMemorySpace?: string
  image?: string
340
  command?: string
341 342 343 344 345 346 347 348 349 350
  algorithm?: string
  params?: string
  searchParams?: string
  dataPath?: string
  experimentName?: string
  modelName?: string
  mlflowTrackingUri?: string
  mlflowJobType?: string
  automlTool?: string
  registerModel?: boolean
351
  mlflowTaskType?: string
352 353
  mlflowProjectRepository?: string
  mlflowProjectVersion?: string
354 355 356
  deployType?: string
  deployPort?: string
  deployModelKey?: string
357 358
  cpuLimit?: string
  memoryLimit?: string
359 360 361
  zk?: string
  zkPath?: string
  executeMode?: string
362 363
  useCustom?: boolean
  runMode?: string
364 365 366 367 368 369 370
  dvcTaskType?: string
  dvcRepository?: string
  dvcVersion?: string
  dvcDataLocation?: string
  dvcMessage?: string
  dvcLoadSaveDataPath?: string
  dvcStoreUrl?: string
371 372 373
  address?: string
  taskId?: string
  online?: boolean
374
  sagemakerRequestJson?: string
375 376 377 378 379 380 381 382
  script?: string
  scriptParams?: string
  pythonPath?: string
  isCreateEnvironment?: string
  pythonCommand?: string
  pythonEnvTool?: string
  requirements?: string
  condaPythonVersion?: string
383 384 385 386 387 388 389 390 391 392
  isRestartTask?: boolean
  isJsonFormat?: boolean
  jsonData?: string
  migrationType?: string
  replicationTaskIdentifier?: string
  sourceEndpointArn?: string
  targetEndpointArn?: string
  replicationInstanceArn?: string
  tableMappings?: string
  replicationTaskArn?: string
393 394 395 396 397
  jsonFormat?: boolean
  destinationLocationArn?: string
  sourceLocationArn?: string
  name?: string
  cloudWatchLogGroupArn?: string
398
  yamlContent?: string
399
  paramScript?: ILocalParam[]
400 401
}

402 403 404
interface INodeData
  extends Omit<
      ITaskParams,
405 406 407 408 409
      | 'resourceList'
      | 'mainJar'
      | 'targetParams'
      | 'sourceParams'
      | 'dependence'
410
      | 'sparkParameters'
411
      | 'conditionResult'
412
      | 'udfs'
413
      | 'customConfig'
414 415
    >,
    ISqoopTargetData,
416
    ISqoopSourceData,
417
    Omit<IRuleParameters, 'mapping_columns'> {
418 419
  id?: string
  taskType?: ITaskType
420
  processName?: number
421
  delayTime?: number
422 423
  description?: string
  environmentCode?: number | null
424
  failRetryInterval?: number
425
  failRetryTimes?: number
426 427
  cpuQuota?: number
  memoryMax?: number
428 429
  flag?: 'YES' | 'NO'
  taskGroupId?: number
430
  taskGroupPriority?: number
431 432 433 434 435 436 437
  taskPriority?: string
  timeout?: number
  timeoutFlag?: boolean
  timeoutNotifyStrategy?: string[]
  workerGroup?: string
  code?: number
  name?: string
438
  preTasks?: number[]
439 440
  preTaskOptions?: []
  postTaskOptions?: []
441 442
  resourceList?: string[]
  mainJar?: string
443
  timeoutSetting?: boolean
444
  isCustomTask?: boolean
445 446
  method?: string
  resourceFiles?: { id: number; fullName: string }[] | null
447
  relation?: RelationType
448
  definition?: object
449 450
  successBranch?: number
  failedBranch?: number
451
  udfs?: string[]
452
  customConfig?: boolean
453
  mapping_columns?: object[]
454
  taskExecuteType?: TaskExecuteType
455 456
}

457 458 459 460 461 462
interface ITaskData
  extends Omit<
    INodeData,
    'timeoutFlag' | 'taskPriority' | 'timeoutNotifyStrategy'
  > {
  name?: string
463
  taskPriority?: string
464
  timeoutFlag?: 'OPEN' | 'CLOSE'
465
  timeoutNotifyStrategy?: string | []
466
  taskParams?: ITaskParams
467 468 469 470 471 472 473
}

export {
  ITaskPriorityOption,
  IEnvironmentNameOption,
  ILocalParam,
  ITaskType,
474 475
  ITaskData,
  INodeData,
476 477 478 479 480 481
  ITaskParams,
  IOption,
  IDataBase,
  ModelType,
  SourceType,
  ISqoopSourceParams,
482 483
  ISqoopTargetParams,
  IDependTask,
484 485 486 487 488
  IDependpendItem,
  IFormItem,
  IJsonItem,
  FormRules,
  IJsonItemParams,
489 490
  IResponseJsonItem,
  IDateType
491
}