Skip to content

Commit d968837

Browse files
fix: Fix deepcopy
Signed-off-by: JiangJiaWei1103 <waynechuang97@gmail.com>
1 parent f255d16 commit d968837

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

historyserver/pkg/eventserver/types/task.go

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ type PythonFunctionDescriptor struct {
5252
}
5353

5454
// FunctionDescriptor is a union wrapper for various function descriptor types.
55-
//
56-
// TODO(jwj): Add validation for the "oneof" logic in eventserver.go if necessary.
55+
// Ray's proto guarantees that the following three function descriptors hold an "oneof" relationship.
56+
// Ref: https://github.com/ray-project/ray/blob/36be009ae360788550e541d81806493f52963730/src/ray/protobuf/common.proto#L157-L164.
5757
type FunctionDescriptor struct {
5858
JavaFunctionDescriptor *JavaFunctionDescriptor `json:"javaFunctionDescriptor,omitempty"`
5959
PythonFunctionDescriptor *PythonFunctionDescriptor `json:"pythonFunctionDescriptor,omitempty"`
@@ -117,7 +117,6 @@ type Task struct {
117117
Language Language `json:"language,omitempty"`
118118
// For TASK_DEFINITION_EVENT, only TaskFunc and TaskName are populated.
119119
// For ACTOR_TASK_DEFINITION_EVENT, only ActorFunc and ActorTaskName are populated.
120-
// TODO(jwj): Need a validation function to make the "oneof" relationship more explicit.
121120
// It might be better to define separate structs or TaskDefinition interface with custom JSON marshal/unmarshal logic.
122121
TaskFunc *FunctionDescriptor `json:"taskFunc,omitempty"`
123122
ActorFunc *FunctionDescriptor `json:"actorFunc,omitempty"`
@@ -334,6 +333,11 @@ func (t Task) DeepCopy() Task {
334333
}
335334
}
336335

336+
if t.CallSite != nil {
337+
callSite := *t.CallSite
338+
cp.CallSite = &callSite
339+
}
340+
337341
if len(t.LabelSelector) > 0 {
338342
cp.LabelSelector = make(map[string]string, len(t.LabelSelector))
339343
for k, v := range t.LabelSelector {
@@ -352,8 +356,8 @@ func (t Task) DeepCopy() Task {
352356
}
353357

354358
if t.IsDebuggerPaused != nil {
355-
cp.IsDebuggerPaused = new(bool)
356-
*cp.IsDebuggerPaused = *t.IsDebuggerPaused
359+
isDebuggerPaused := *t.IsDebuggerPaused
360+
cp.IsDebuggerPaused = &isDebuggerPaused
357361
}
358362

359363
if t.ActorReprName != nil {

historyserver/pkg/utils/filter.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ func getFiltersFromReq(req *restful.Request) ([]Filter, error) {
120120

121121
filters := make([]Filter, len(filterKeys))
122122
for i := range filterKeys {
123-
// TODO(jwj): Add error handling for invalid filter keys.
123+
// TODO(jwj): Add error handling for invalid filter keys based on filterable fields.
124124
predicate, err := parsePredicate(string(filterPredicates[i]))
125125
if err != nil {
126126
return nil, fmt.Errorf("invalid predicate: %w", err)

0 commit comments

Comments
 (0)