зеркало из https://github.com/microsoft/pai.git
Support null in framework completion policy (#3699)
* Support null in framework completion policy Support null in framework completion policy, make protocol compatible with yarn backend. * Update UI for completion policy Update UI for completion policy accordingly.
This commit is contained in:
Родитель
74b92690e2
Коммит
7953d59a4a
|
@ -433,19 +433,15 @@ const generateTaskRole = (taskRole, labels, config) => {
|
|||
},
|
||||
};
|
||||
// fill in completion policy
|
||||
if ('completion' in config.taskRoles[taskRole]) {
|
||||
frameworkTaskRole.frameworkAttemptCompletionPolicy = {
|
||||
minFailedTaskCount: ('minFailedInstances' in config.taskRoles[taskRole].completion) ?
|
||||
config.taskRoles[taskRole].completion.minFailedInstances : 1,
|
||||
minSucceededTaskCount: ('minSucceededInstances' in config.taskRoles[taskRole].completion) ?
|
||||
config.taskRoles[taskRole].completion.minSucceededInstances : -1,
|
||||
};
|
||||
} else {
|
||||
frameworkTaskRole.frameworkAttemptCompletionPolicy = {
|
||||
minFailedTaskCount: 1,
|
||||
minSucceededTaskCount: -1,
|
||||
};
|
||||
}
|
||||
const completion = config.taskRoles[taskRole].completion;
|
||||
frameworkTaskRole.frameworkAttemptCompletionPolicy = {
|
||||
minFailedTaskCount:
|
||||
(completion && 'minFailedInstances' in completion && completion.minFailedInstances) ?
|
||||
completion.minFailedInstances : 1,
|
||||
minSucceededTaskCount:
|
||||
(completion && 'minSucceededInstances' in completion && completion.minSucceededInstances) ?
|
||||
completion.minSucceededInstances : -1,
|
||||
};
|
||||
// hived spec
|
||||
if (launcherConfig.enabledHived) {
|
||||
frameworkTaskRole.task.pod.spec.schedulerName = launcherConfig.scheduler;
|
||||
|
|
|
@ -38,9 +38,11 @@ const generateFrameworkEnv = (frameworkName, config) => {
|
|||
(tasks.extraContainerOptions && 'shmMB' in tasks.extraContainerOptions) ? tasks.extraContainerOptions.shmMB : 0,
|
||||
].join(',');
|
||||
env[`PAI_MIN_FAILED_TASK_COUNT_${taskRole}`] =
|
||||
(tasks.completion && 'minFailedInstances' in tasks.completion) ? tasks.completion.minFailedInstances : 1;
|
||||
(tasks.completion && 'minFailedInstances' in tasks.completion && tasks.completion.minFailedInstances) ?
|
||||
tasks.completion.minFailedInstances : 1;
|
||||
env[`PAI_MIN_SUCCEEDED_TASK_COUNT_${taskRole}`] =
|
||||
(tasks.completion && 'minSucceededInstances' in tasks.completion) ? tasks.completion.minSucceededInstances : -1;
|
||||
(tasks.completion && 'minSucceededInstances' in tasks.completion && tasks.completion.minSucceededInstances) ?
|
||||
tasks.completion.minSucceededInstances : -1;
|
||||
}
|
||||
return {
|
||||
...env,
|
||||
|
|
|
@ -49,7 +49,7 @@ export const CompletionPolicy = React.memo(({ onChange, value }) => {
|
|||
<CSpinButton
|
||||
label={'Min Failed Instances'}
|
||||
value={minFailedInstances}
|
||||
min={1}
|
||||
min={-1}
|
||||
onChange={v => _onChange('minFailedInstances', v)}
|
||||
/>
|
||||
</Stack>
|
||||
|
@ -57,7 +57,7 @@ export const CompletionPolicy = React.memo(({ onChange, value }) => {
|
|||
<CSpinButton
|
||||
label={'Min Succeed Instances'}
|
||||
value={minSucceededInstances}
|
||||
min={1}
|
||||
min={-1}
|
||||
onChange={v => _onChange('minSucceededInstances', v)}
|
||||
/>
|
||||
</Stack>
|
||||
|
|
|
@ -4,7 +4,7 @@ export class Completion {
|
|||
constructor(props) {
|
||||
const { minFailedInstances, minSucceededInstances } = props;
|
||||
this.minFailedInstances = minFailedInstances || 1;
|
||||
this.minSucceededInstances = minSucceededInstances || 1;
|
||||
this.minSucceededInstances = minSucceededInstances || -1;
|
||||
}
|
||||
|
||||
static fromProtocol(completionProtocol) {
|
||||
|
|
|
@ -31,13 +31,13 @@ export const taskRoleSchema = Joi.object().keys({
|
|||
.min(1),
|
||||
completion: Joi.object().keys({
|
||||
minFailedInstances: Joi.number()
|
||||
.min(1)
|
||||
.min(-1)
|
||||
.allow(null)
|
||||
.default(1),
|
||||
minSucceededInstances: Joi.number()
|
||||
.min(1)
|
||||
.min(-1)
|
||||
.allow(null)
|
||||
.default(null),
|
||||
.default(-1),
|
||||
}),
|
||||
taskRetryCount: Joi.number().default(0),
|
||||
// Following dockerImage, data, output and script should ref to prerequisites content
|
||||
|
|
Загрузка…
Ссылка в новой задаче