[Feature][Datax Task]Datax task plugin support custom parameters (#10950)
* datax task plugin support custom parameters
This commit is contained in:
parent
a38fa34d43
commit
7196b125d9
|
|
@ -82,6 +82,8 @@ public class DataxTask extends AbstractTaskExecutor {
|
|||
* jvm parameters
|
||||
*/
|
||||
public static final String JVM_PARAM = " --jvm=\"-Xms%sG -Xmx%sG\" ";
|
||||
|
||||
public static final String CUSTOM_PARAM = " -D%s=%s";
|
||||
/**
|
||||
* python process(datax only supports version 2.7 by default)
|
||||
*/
|
||||
|
|
@ -392,6 +394,8 @@ public class DataxTask extends AbstractTaskExecutor {
|
|||
sbr.append(DATAX_PATH);
|
||||
sbr.append(" ");
|
||||
sbr.append(loadJvmEnv(dataXParameters));
|
||||
sbr.append(addCustomParameters(paramsMap));
|
||||
sbr.append(" ");
|
||||
sbr.append(jobConfigFilePath);
|
||||
|
||||
// replace placeholder
|
||||
|
|
@ -414,6 +418,15 @@ public class DataxTask extends AbstractTaskExecutor {
|
|||
return fileName;
|
||||
}
|
||||
|
||||
private StringBuilder addCustomParameters(Map<String, Property> paramsMap) {
|
||||
StringBuilder customParameters = new StringBuilder("-p\"");
|
||||
for (Map.Entry<String, Property> entry : paramsMap.entrySet()) {
|
||||
customParameters.append(String.format(CUSTOM_PARAM, entry.getKey(), entry.getValue().getValue()));
|
||||
}
|
||||
customParameters.append("\"");
|
||||
return customParameters;
|
||||
}
|
||||
|
||||
public String getPythonCommand() {
|
||||
String pythonHome = System.getenv("PYTHON_HOME");
|
||||
return getPythonCommand(pythonHome);
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ import type { IJsonItem } from '../types'
|
|||
import { find } from 'lodash'
|
||||
import { TypeReq } from '@/service/modules/data-source/types'
|
||||
import { queryDataSourceList } from '@/service/modules/data-source'
|
||||
import {useCustomParams} from "."
|
||||
|
||||
export function useDataX(model: { [field: string]: any }): IJsonItem[] {
|
||||
const { t } = useI18n()
|
||||
|
|
@ -443,6 +444,7 @@ export function useDataX(model: { [field: string]: any }): IJsonItem[] {
|
|||
span: 12,
|
||||
options: memoryLimitOptions,
|
||||
value: 1
|
||||
}
|
||||
},
|
||||
...useCustomParams({ model, field: 'localParams', isSimple: true })
|
||||
]
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue