Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add schedulerName #1184

Merged
merged 6 commits into from
Feb 12, 2019
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/openapi-spec/swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,10 @@
"description": "RetryStrategy describes how to retry a template when it fails",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.RetryStrategy"
},
"schedulerName": {
"description": "If specified, the pod will be dispatched by specified scheduler. If not specified, the pod will be dispatched by default scheduler.",
"type": "string"
},
"script": {
"description": "Script runs a portion of code against an interpreter",
"$ref": "#/definitions/io.argoproj.workflow.v1alpha1.ScriptTemplate"
Expand Down
14 changes: 14 additions & 0 deletions pkg/apis/workflow/v1alpha1/openapi_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions pkg/apis/workflow/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,12 @@ type WorkflowSpec struct {
ActiveDeadlineSeconds *int64 `json:"activeDeadlineSeconds,omitempty"`
// Priority is used if controller is configured to process limited number of workflows in parallel. Workflows with higher priority are processed first.
Priority *int32 `json:"priority,omitempty"`

// Set scheduler name for all pods.
// Will be overridden if container/script template's scheduler name is set.
// Default scheduler will be used if both unspecified.
// +optional
SchedulerName string `json:"schedulerName,omitempty"`
}

// Template is a reusable and composable unit of execution in a workflow
Expand Down Expand Up @@ -217,6 +223,12 @@ type Template struct {

// Tolerations to apply to workflow pods.
Tolerations []apiv1.Toleration `json:"tolerations,omitempty"`

// If specified, the pod will be dispatched by specified scheduler.
// Or it will be dispatched by workflow scope scheduler if specified.
// If both not specified, the pod will be dispatched by default scheduler.
// +optional
SchedulerName string `json:"schedulerName,omitempty"`
}

// Inputs are the mechanism for passing parameters, artifacts, volumes from one template to another
Expand Down
8 changes: 8 additions & 0 deletions workflow/controller/workflowpod.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@ func (woc *wfOperationCtx) createWorkflowPod(nodeName string, mainCtr apiv1.Cont
pod.Spec.Containers = append(pod.Spec.Containers, *waitCtr)
}

if tmpl.GetType() == wfv1.TemplateTypeContainer || tmpl.GetType() == wfv1.TemplateTypeScript {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about putting this logic in addSchedulingConstraints as other scheduling constraints are generated there?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do, thanks

if tmpl.SchedulerName != "" {
pod.Spec.SchedulerName = tmpl.SchedulerName
} else if woc.wf.Spec.SchedulerName != "" {
pod.Spec.SchedulerName = woc.wf.Spc.SchedulerName
}
}

// Add init container only if it needs input artifacts. This is also true for
// script templates (which needs to populate the script)
if len(tmpl.Inputs.Artifacts) > 0 || tmpl.GetType() == wfv1.TemplateTypeScript {
Expand Down