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

(WIP)KEP-74: support argo workflow #2976

Open
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

KunWuLuan
Copy link
Member

@KunWuLuan KunWuLuan commented Sep 4, 2024

What type of PR is this?

/kind documentation
/kind feature

What this PR does / why we need it:

#74

Which issue(s) this PR fixes:

Special notes for your reviewer:

Does this PR introduce a user-facing change?

NONE

@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/documentation Categorizes issue or PR as related to documentation. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 4, 2024
@k8s-ci-robot k8s-ci-robot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 4, 2024
@k8s-ci-robot
Copy link
Contributor

Hi @KunWuLuan. Thanks for your PR.

I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Sep 4, 2024
Copy link

netlify bot commented Sep 4, 2024

Deploy Preview for kubernetes-sigs-kueue canceled.

Name Link
🔨 Latest commit ab81975
🔍 Latest deploy log https://app.netlify.com/sites/kubernetes-sigs-kueue/deploys/677b718c1f7d10000884d660

@kannon92
Copy link
Contributor

kannon92 commented Sep 5, 2024

/ok-to-test

@k8s-ci-robot k8s-ci-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Sep 5, 2024
@KunWuLuan KunWuLuan force-pushed the kep/kueue-workflow branch 2 times, most recently from ac94cf8 to baa5ecd Compare September 10, 2024 08:48
@KunWuLuan KunWuLuan changed the title WIP: kep-74: support argo workflow KEP-74: support argo workflow Sep 10, 2024
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Sep 10, 2024
@tenzen-y
Copy link
Member

It seems that some sections are still empty. So, when you fill all sections, we will review this KEP.

@KunWuLuan
Copy link
Member Author

@tenzen-y Hi, I filled in the empty sections. And some implement details will be added after we discuss and choose the road.

@tenzen-y
Copy link
Member

@tenzen-y Hi, I filled in the empty sections. And some implement details will be added after we discuss and choose the road.

Thanks for the updates.
@KunWuLuan Could you resolve CI errors with "make toc-update"?

@tenzen-y
Copy link
Member

/release-note-edit

NONE

@k8s-ci-robot k8s-ci-robot added release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels Sep 18, 2024
Comment on lines 262 to 712
3. (Recommended) Kueue Webhook Enhancement: A new webhook is added within Kueue to intercept pod creations in the cluster.
This webhook verifies if the incoming pods are governed by a workflow and if the workflow carries the label
`kueue.x-k8s.io/queue-name`. When these conditions are met, scheduling gates are appended to the pods. The
job-controller in Kueue subsequently organizes these pods into groups (identifiable within the workflow's
status) and creates corresponding workloads for each group. Following workload acceptance, the scheduling
gates are removed from the pods, enabling their scheduling and execution.
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't the scheduling gates only apply after a workload has been admitted? Wouldn't this require something like readiness gates as proposed by @alculquicondor ? Otherwise, the workflow will hog Kueue quota without actually running anything.

Copy link
Member

Choose a reason for hiding this comment

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

The Job ReadinessGates is only for batch/v1 Job, but here I guess that @KunWuLuan indicates the Pod and it's schedulingGates.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, I mean the schedulingGates of Pods. @KPostOffice
Thanks @tenzen-y.

Copy link
Member

@tenzen-y tenzen-y left a comment

Choose a reason for hiding this comment

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

It seems that this proposal lacks actual proposed user facing API and internal interface. So, could you add those?

keps/74-support-argo-workflow/README.md Outdated Show resolved Hide resolved
Comment on lines 244 to 245
It is hard for users to add suspend template manually in a workflow before each
leaf template. Some tools are needed to help them to do this.
Copy link
Member

Choose a reason for hiding this comment

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

AFAIK, when we use the Plain Pod integration, users do not need to add suspend to each leaf template, right?
Bacause Kueue mutates schedulingGates to all Pod without admission.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

We introduce three ways to manage the workflow. Responsebilities are different for the
workflow-controller and kueue-controller in two ways.

1. Give users a CLI to help users modifying workflows to add a specific suspend template for each step.
Copy link
Member

Choose a reason for hiding this comment

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

Does this CLI mean argo, kubectl, or kueuectl? which one?
And, the CLI is new one or existing one?

Copy link
Member Author

Choose a reason for hiding this comment

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

In my option, the CLI should be implemented by each workflow managers.

workflow-controller and kueue-controller in two ways.

1. Give users a CLI to help users modifying workflows to add a specific suspend template for each step.
When the workflows are suspended on this special suspend template, the job-controller in Kueue
Copy link
Member

Choose a reason for hiding this comment

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

What is the special suspend template? What is different from the Job suspend field?

Copy link
Member Author

Choose a reason for hiding this comment

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

This depends on the workflow managers. For Argo Workflow, I think it is ok to add a reserved template name like kueue-suspend. Other workflow mangers like tekton must implement its own suspend method for this way.

Copy link
Member

Choose a reason for hiding this comment

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

I was not sure what is the behavior of special suspend template.
Once the user submit Workflow to the cluster, the cli insert the suspend template to the input workflow, right?
The suspend template blocks the following step creation, and after the behind step is finalized, the Workflow automatically remove the suspend template, right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Special suspend template will suspend the workflow before specific steps and tasks. When the dependencies of these steps and tasks completed, Argo Workflow will create a suspend node in workflow's status, so the controller in Kueue can create the workflow for this step and after the workflow is admitted the controller can resume this suspend node in workflow's status. Finally Argo Workflow controller continue to execute the workflow.

acceptable for some users.

2. Integrated Suspend Capability: We propose introducing a new specification field within workflows, such
as suspendBySteps. If workflow.spec.suspendBySteps is set to true, the workflow-controller automatically
Copy link
Member

Choose a reason for hiding this comment

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

Could you provide actual YAML or Go API proposal for new field?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

Comment on lines 262 to 712
3. (Recommended) Kueue Webhook Enhancement: A new webhook is added within Kueue to intercept pod creations in the cluster.
This webhook verifies if the incoming pods are governed by a workflow and if the workflow carries the label
`kueue.x-k8s.io/queue-name`. When these conditions are met, scheduling gates are appended to the pods. The
job-controller in Kueue subsequently organizes these pods into groups (identifiable within the workflow's
status) and creates corresponding workloads for each group. Following workload acceptance, the scheduling
gates are removed from the pods, enabling their scheduling and execution.
Copy link
Member

Choose a reason for hiding this comment

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

The Job ReadinessGates is only for batch/v1 Job, but here I guess that @KunWuLuan indicates the Pod and it's schedulingGates.

job-controller in Kueue subsequently organizes these pods into groups (identifiable within the workflow's
status) and creates corresponding workloads for each group. Following workload acceptance, the scheduling
gates are removed from the pods, enabling their scheduling and execution.

Copy link
Member

Choose a reason for hiding this comment

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

How can we push all steps and leaves sequentially in this approach?
IIUC, when others push other Jobs into same queue during Workflow preprocessing executed, the following Workflow step needs to wait until the other irrelevant Job is terminated.

Let's imagine the situation where we push a ArgoWorkflow and a Job into the same queue:

  1. Push ArgoWorkflow into queue
  2. Creation of Workload for the first Argoworkflow step
  3. Admit the first Workflow step Pod
  4. Push an irrelevant Job into queue
  5. Finish the first Workflow step Pod
  6. Admit an irrelevant Job.
  7. The second Workflow step Pod waits until the irrelevant Job finish.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is what I call Admission Reuse. Maybe we should support relevant Job to reuse the resources to avoid waiting for irrelevant. Maybe this should be a standard API in Kueue, not just for workflow.

Copy link
Member Author

Choose a reason for hiding this comment

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

This KEP will not discuss the solution for this problem. And maybe the solution can be consider with this issue.
#1243

Copy link
Member

Choose a reason for hiding this comment

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

No, I did not mean the feature.
Couldn't we create all Workloads with active=false once the workflow is created?
So, the creation of all Workloads for all steps allows us to enqueue all steps sequentially, and we can avoid the reservation of the whole of WorkflowTemplate.

Copy link
Member Author

Choose a reason for hiding this comment

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

Conditional execution is supported in most workflow managers, so we can not determine whether the subsequent steps will run or how many replicas will be created until the step node is created.

@alculquicondor
Copy link
Contributor

cc @vsoch @andreyvelich

@KunWuLuan
Copy link
Member Author

@terrytangyuan Oh, yes. I am willing to do this.

@alculquicondor
Copy link
Contributor

Sorry folks. With the k/k enhancements freeze, I had little time to read this. I'll try to make some time soon.

cc @mimowo


In this section, we will discuss the advantages and disadvantages of queuing Workflows, Stages, and Tasks individually. Additionally, we will explore how each of these can be implemented within Kueue.

### What are the Stages for Argo Workflows?
Copy link

Choose a reason for hiding this comment

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

It's not clear to me what a stage is.
Is it an Argo concept that I'm missing? If so, can you add a link to its definition in the Argo documentation?
Otherwise, can you please elaborate a bit more?

Copy link
Member Author

Choose a reason for hiding this comment

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

Stage is not a concept in Argo. I try to use a new word to represent the process that will create a set of pods in workflow. In Argo this may be a TaskGroup, or a StepGroup.
You can see the section 'What are the Stages for Argo Workflows'. If there are still some question the concept of stage, I will try to explain more in the section.

@mimowo
Copy link
Contributor

mimowo commented Oct 14, 2024

@KunWuLuan thank you for driving the KEP. I will try to get to it this week. cc @mwielgus

@mimowo
Copy link
Contributor

mimowo commented Oct 17, 2024

Sorry folks, this is an important KEP, but I will not be able to review it before 0.9 release is concluded.

@KunWuLuan
Copy link
Member Author

Hello friends, anyone have any comment?

@tenzen-y
Copy link
Member

Hello friends, anyone have any comment?

We assume to aim for this feature after the next release (v0.11) since the v0.10 deadline will come soon, within 2 weeks.

BuildSegmentableJob(childRequest ctrl.Request) SegmentableJob
}

---
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you can drop this code block from the KEP.

Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

I have some questions regarding the user stories outlined in the proposal. Could you clarify what this integration provides that cannot be achieved through Argo Workflows directly?


This KEP outlines the proposal to integrate Generic Workflows within Kueue, discussing the advantages
and disadvantages of queuing workflows at varying granularity levels, alongside detailing
the integration methodologies. Workflow managers like Argo Workflow and Tekton can follow the convention
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
the integration methodologies. Workflow managers like Argo Workflow and Tekton can follow the convention
the integration methodologies. Workflow managers like Argo Workflows and Tekton can follow the convention

Copy link
Member

Choose a reason for hiding this comment

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

Can you fix this in other places too?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks, I will explain the use cases. WIP.

@@ -0,0 +1,807 @@
# KEP-74: Support Generic Workflows
Copy link
Member

Choose a reason for hiding this comment

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

This title is inconsistent with the folder name

### Non-Goals

- KEP should not only work for Argo Workflow.
- Support resource reuse across multiple stages (potentially discussed in another KEP).
Copy link
Member

Choose a reason for hiding this comment

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

Where was this discussed?

Comment on lines 63 to 68
#### Story 1

As a machine learning engineer, I need to preprocess data before executing a training job. My
workflow includes two steps: data preprocessing (which doesn't require a GPU) followed by a
PyTorchJob. I desire that the data preprocessing stage proceeds independently of GPU quota
availability.
Copy link
Member

Choose a reason for hiding this comment

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

This use case can be solved directly with the DAG/conditional capability of the workflow steps, e.g. PyTorchJob can start upon the completion of data processing step.

Comment on lines 72 to 74
As an ML engineer, my workflow consists of several GPU-dependent stages with uniform resource
requirements. I aim to recycle resources allocated to earlier workflow stages to boost efficiency
and resource utilization.
Copy link
Member

Choose a reason for hiding this comment

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

In Argo Workflows, you can release the resources from completed steps as soon as they complete. Are there any other requirements that Kueue can help?

requirements. I aim to recycle resources allocated to earlier workflow stages to boost efficiency
and resource utilization.

#### Story 3
Copy link
Member

Choose a reason for hiding this comment

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

This is not a story? This seems like a quick intro to the syntax of Argo Workflows?

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: KunWuLuan
Once this PR has been reviewed and has the lgtm label, please assign mimowo for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@KunWuLuan KunWuLuan changed the title KEP-74: support argo workflow (WIP)KEP-74: support argo workflow Jan 6, 2025
@k8s-ci-robot k8s-ci-robot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 6, 2025
@k8s-ci-robot
Copy link
Contributor

@KunWuLuan: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-kueue-verify-main ab81975 link true /test pull-kueue-verify-main

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. kind/documentation Categorizes issue or PR as related to documentation. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.