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

feat: add design docs for dataflow affinity using any preceding data operations #68

Merged
merged 2 commits into from
Sep 25, 2024

Conversation

xliuqq
Copy link
Contributor

@xliuqq xliuqq commented Sep 6, 2024

add design docs for dataflow affinity using any preceding data operations

name: step1-download-model
namespace: default
...
---
Copy link
Contributor

Choose a reason for hiding this comment

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

可以提供一个affinity依赖上一个dataProcess的例子。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已提供

## 设计

> 字段改动,因此当前设计对 v1.0.1 和 v1.0.2 的 DataFlow Affinity 不兼容。
>
Copy link
Contributor

Choose a reason for hiding this comment

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

是否可以定义一个通用的结构体 ObjectRef 来包含引用操作的必要字段, 这样来保持向前兼容:

type ObjectRef struct {
	// API version of the referent operation
	// +optional
	APIVersion string `json:"apiVersion,omitempty"`

	// Kind specifies the type of the referent operation
	// +required
	// +kubebuilder:validation:Enum=DataLoad;DataBackup;DataMigrate;DataProcess
	Kind string `json:"kind"`

	// Name specifies the name of the referent operation
	// +required
	Name string `json:"name"`

	// Namespace specifies the namespace of the referent operation.
	// +optional
	Namespace string `json:"namespace,omitempty"`
}

在其他结构体中使用 ObjectRef
然后,在需要引用操作的地方使用这个通用结构体。例如,在 OperationRef 和 AffinityStrategy 中使用 ObjectRef:

type OperationRef struct {
	ObjectRef `json:",inline"`

	// AffinityStrategy specifies the pod affinity strategy with the referent operation.
	// +optional
	AffinityStrategy AffinityStrategy `json:"affinityStrategy,omitempty"`
}

type AffinityStrategy struct {
	// Specifies the dependent preceding operation in a workflow. If not set, use `RunAfter` field.
	// +optional
	DependOn *ObjectRef `json:"dependOn,omitempty"`
	// Policy one of: "", "Require", "Prefer"
	// +optional
	Policy AffinityPolicy `json:"policy,omitempty"`

	Prefers  []Prefer  `json:"prefers,omitempty"`
	Requires []Require `json:"requires,omitempty"`
}

Copy link
Contributor Author

@xliuqq xliuqq Sep 9, 2024

Choose a reason for hiding this comment

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

我的疑问是:
是否保留 AffinityStrategy 定义在 RunAfter: OperationRef 里面?如果是的话,就可以兼容,抽象出 ObjectRef。
@cheyang

Copy link
Contributor

Choose a reason for hiding this comment

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

我倾向于AffinityStrategy放在OperationRef中,因为不想提供单独AffinityStrategy,也有含义,也是有runAfter的语义。FYI @TrafalgarZZZ

Copy link
Contributor Author

Choose a reason for hiding this comment

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

已修改。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是否可以定义一个通用的结构体 ObjectRef 来包含引用操作的必要字段, 这样来保持向前兼容:

type ObjectRef struct {
	// API version of the referent operation
	// +optional
	APIVersion string `json:"apiVersion,omitempty"`

	// Kind specifies the type of the referent operation
	// +required
	// +kubebuilder:validation:Enum=DataLoad;DataBackup;DataMigrate;DataProcess
	Kind string `json:"kind"`

	// Name specifies the name of the referent operation
	// +required
	Name string `json:"name"`

	// Namespace specifies the namespace of the referent operation.
	// +optional
	Namespace string `json:"namespace,omitempty"`
}

在其他结构体中使用 ObjectRef 然后,在需要引用操作的地方使用这个通用结构体。例如,在 OperationRef 和 AffinityStrategy 中使用 ObjectRef:

type OperationRef struct {
	ObjectRef `json:",inline"`

	// AffinityStrategy specifies the pod affinity strategy with the referent operation.
	// +optional
	AffinityStrategy AffinityStrategy `json:"affinityStrategy,omitempty"`
}

type AffinityStrategy struct {
	// Specifies the dependent preceding operation in a workflow. If not set, use `RunAfter` field.
	// +optional
	DependOn *ObjectRef `json:"dependOn,omitempty"`
	// Policy one of: "", "Require", "Prefer"
	// +optional
	Policy AffinityPolicy `json:"policy,omitempty"`

	Prefers  []Prefer  `json:"prefers,omitempty"`
	Requires []Require `json:"requires,omitempty"`
}

这个对于inline字段对于 java/python SDK 是否需要修改?SDK 能兼容吗?

metadata:
name: step2-trtllm-convert
# exposed affinity which will be filled in OperationStatus.
fluid.io/affinity.labels: "node.kubernetes.io/instance-type"
Copy link
Contributor

@cheyang cheyang Sep 9, 2024

Choose a reason for hiding this comment

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

data-operation.fluid.io/affinity.labels如何?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

兼容原先的标签吗?

Copy link
Contributor

Choose a reason for hiding this comment

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

先不用兼容,因为这个功能还没有人真正使用。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

好的

@xliuqq
Copy link
Contributor Author

xliuqq commented Sep 14, 2024

@cheyang @TrafalgarZZZ 是否还有其它的问题?

@cheyang cheyang merged commit 6213f8f into fluid-cloudnative:master Sep 25, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants