@@ -38,24 +38,32 @@ public class MLDeployModelRequest extends MLTaskRequest {
38
38
private String modelId ;
39
39
private String [] modelNodeIds ;
40
40
boolean async ;
41
+ // This is to identify if the deploy request is initiated by user or not. During auto redeploy also, we perform deploy operation.
42
+ // This field is mainly to distinguish between these two situations.
43
+ private final boolean isUserInitiatedDeployRequest ;
41
44
42
45
@ Builder
43
- public MLDeployModelRequest (String modelId , String [] modelNodeIds , boolean async , boolean dispatchTask ) {
46
+ public MLDeployModelRequest (String modelId , String [] modelNodeIds , boolean async , boolean dispatchTask , boolean isUserInitiatedDeployRequest ) {
44
47
super (dispatchTask );
45
48
this .modelId = modelId ;
46
49
this .modelNodeIds = modelNodeIds ;
47
50
this .async = async ;
51
+ this .isUserInitiatedDeployRequest = isUserInitiatedDeployRequest ;
48
52
}
49
53
54
+ // In this constructor, isUserInitiatedDeployRequest to always set to true. So, it can be used only when
55
+ // deploy request is coming directly from the user. DO NOT use this when the
56
+ // deploy call is from the code or system initiated.
50
57
public MLDeployModelRequest (String modelId , boolean async ) {
51
- this (modelId , null , async , true );
58
+ this (modelId , null , async , true , true );
52
59
}
53
60
54
61
public MLDeployModelRequest (StreamInput in ) throws IOException {
55
62
super (in );
56
63
this .modelId = in .readString ();
57
64
this .modelNodeIds = in .readOptionalStringArray ();
58
65
this .async = in .readBoolean ();
66
+ this .isUserInitiatedDeployRequest = in .readBoolean ();
59
67
}
60
68
61
69
@ Override
@@ -74,6 +82,7 @@ public void writeTo(StreamOutput out) throws IOException {
74
82
out .writeString (modelId );
75
83
out .writeOptionalStringArray (modelNodeIds );
76
84
out .writeBoolean (async );
85
+ out .writeBoolean (isUserInitiatedDeployRequest );
77
86
}
78
87
79
88
public static MLDeployModelRequest parse (XContentParser parser , String modelId ) throws IOException {
@@ -96,7 +105,7 @@ public static MLDeployModelRequest parse(XContentParser parser, String modelId)
96
105
}
97
106
}
98
107
String [] nodeIds = nodeIdList == null ? null : nodeIdList .toArray (new String [0 ]);
99
- return new MLDeployModelRequest (modelId , nodeIds , false , true );
108
+ return new MLDeployModelRequest (modelId , nodeIds , false , true , true );
100
109
}
101
110
102
111
public static MLDeployModelRequest fromActionRequest (ActionRequest actionRequest ) {
0 commit comments