Skip to content

Commit c37e034

Browse files
committed
Add allow_lazy_open to machine learning jobs. (#4277)
Add allow_lazy_open to machine learning jobs. (cherry picked from commit fb1592b)
1 parent 04fa7ce commit c37e034

File tree

4 files changed

+76
-1
lines changed

4 files changed

+76
-1
lines changed

src/Nest/XPack/MachineLearning/Job/Config/Job.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,5 +112,16 @@ public class Job
112112
/// </summary>
113113
[DataMember(Name = "results_retention_days")]
114114
public long? ResultsRetentionDays { get; set; }
115+
116+
/// <summary>
117+
/// Advanced configuration option. Whether this job should be allowed to open when there is insufficient machine learning
118+
/// node capacity for it to be immediately assigned to a node. The default is false, which means that the
119+
/// machine learning open job will return an error if a machine learning node with capacity to run the job cannot immediately be found.
120+
/// (However, this is also subject to the cluster-wide xpack.ml.max_lazy_ml_nodes setting.)
121+
/// If this option is set to true then the machine learning open job will not return an error, and the job will wait in the opening
122+
/// state until sufficient machine learning node capacity is available.
123+
/// </summary>
124+
[DataMember(Name ="allow_lazy_open")]
125+
public bool? AllowLazyOpen { get; set; }
115126
}
116127
}

src/Nest/XPack/MachineLearning/PutJob/PutJobRequest.cs

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ public partial interface IPutJobRequest
5555
/// </summary>
5656
[DataMember(Name ="results_index_name")]
5757
IndexName ResultsIndexName { get; set; }
58+
59+
/// <summary>
60+
/// Advanced configuration option. Whether this job should be allowed to open when there is insufficient machine learning
61+
/// node capacity for it to be immediately assigned to a node. The default is false, which means that the
62+
/// machine learning open job will return an error if a machine learning node with capacity to run the job cannot immediately be found.
63+
/// (However, this is also subject to the cluster-wide xpack.ml.max_lazy_ml_nodes setting.)
64+
/// If this option is set to true then the machine learning open job will not return an error, and the job will wait in the opening
65+
/// state until sufficient machine learning node capacity is available.
66+
/// </summary>
67+
[DataMember(Name ="allow_lazy_open")]
68+
bool? AllowLazyOpen { get; set; }
5869
}
5970

6071
/// <inheritdoc />
@@ -80,6 +91,9 @@ public partial class PutJobRequest
8091

8192
/// <inheritdoc />
8293
public IndexName ResultsIndexName { get; set; }
94+
95+
/// <inheritdoc />
96+
public bool? AllowLazyOpen { get; set; }
8397
}
8498

8599
/// <inheritdoc />
@@ -92,6 +106,7 @@ public partial class PutJobDescriptor<TDocument> where TDocument : class
92106
IModelPlotConfig IPutJobRequest.ModelPlotConfig { get; set; }
93107
long? IPutJobRequest.ModelSnapshotRetentionDays { get; set; }
94108
IndexName IPutJobRequest.ResultsIndexName { get; set; }
109+
bool? IPutJobRequest.AllowLazyOpen { get; set; }
95110

96111
/// <inheritdoc />
97112
public PutJobDescriptor<TDocument> AnalysisConfig(Func<AnalysisConfigDescriptor<TDocument>, IAnalysisConfig> selector) =>
@@ -123,6 +138,10 @@ public PutJobDescriptor<TDocument> ResultsIndexName(IndexName indexName) =>
123138
/// <inheritdoc />
124139
public PutJobDescriptor<TDocument> ResultsIndexName<TIndex>() =>
125140
Assign(typeof(TIndex), (a, v) => a.ResultsIndexName = v);
141+
142+
/// <inheritdoc />
143+
public PutJobDescriptor<TDocument> AllowLazyOpen(bool? allowLazyOpen = true) =>
144+
Assign(allowLazyOpen, (a, v) => a.AllowLazyOpen = v);
126145
}
127146

128147
[StringEnum]

src/Nest/XPack/MachineLearning/PutJob/PutJobResponse.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,16 @@ public class PutJobResponse : ResponseBase
105105
/// </summary>
106106
[DataMember(Name ="results_retention_days")]
107107
public long? ResultsRetentionDays { get; internal set; }
108-
}
109108

109+
/// <summary>
110+
/// Advanced configuration option. Whether this job should be allowed to open when there is insufficient machine learning
111+
/// node capacity for it to be immediately assigned to a node. The default is false, which means that the
112+
/// machine learning open job will return an error if a machine learning node with capacity to run the job cannot immediately be found.
113+
/// (However, this is also subject to the cluster-wide xpack.ml.max_lazy_ml_nodes setting.)
114+
/// If this option is set to true then the machine learning open job will not return an error, and the job will wait in the opening
115+
/// state until sufficient machine learning node capacity is available.
116+
/// </summary>
117+
[DataMember(Name ="allow_lazy_open")]
118+
public bool? AllowLazyOpen { get; set; }
119+
}
110120
}

src/Nest/XPack/MachineLearning/UpdateJob/UpdateJobRequest.cs

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,19 +66,48 @@ public partial interface IUpdateJobRequest
6666
/// </summary>
6767
[DataMember(Name ="results_retention_days")]
6868
long? ResultsRetentionDays { get; set; }
69+
70+
/// <summary>
71+
/// Advanced configuration option. Whether this job should be allowed to open when there is insufficient machine learning
72+
/// node capacity for it to be immediately assigned to a node. The default is false, which means that the
73+
/// machine learning open job will return an error if a machine learning node with capacity to run the job cannot immediately be found.
74+
/// (However, this is also subject to the cluster-wide xpack.ml.max_lazy_ml_nodes setting.)
75+
/// If this option is set to true then the machine learning open job will not return an error, and the job will wait in the opening
76+
/// state until sufficient machine learning node capacity is available.
77+
/// </summary>
78+
[DataMember(Name ="allow_lazy_open")]
79+
bool? AllowLazyOpen { get; set; }
6980
}
7081

7182
/// <inheritdoc />
7283
public partial class UpdateJobRequest
7384
{
85+
/// <inheritdoc />
7486
public IAnalysisMemoryLimit AnalysisLimits { get; set; }
87+
88+
/// <inheritdoc />
7589
public Time BackgroundPersistInterval { get; set; }
90+
91+
/// <inheritdoc />
7692
public Dictionary<string, object> CustomSettings { get; set; }
93+
94+
/// <inheritdoc />
7795
public string Description { get; set; }
96+
97+
/// <inheritdoc />
7898
public IModelPlotConfigEnabled ModelPlotConfig { get; set; }
99+
100+
/// <inheritdoc />
79101
public long? ModelSnapshotRetentionDays { get; set; }
102+
103+
/// <inheritdoc />
80104
public long? RenormalizationWindowDays { get; set; }
105+
106+
/// <inheritdoc />
81107
public long? ResultsRetentionDays { get; set; }
108+
109+
/// <inheritdoc />
110+
public bool? AllowLazyOpen { get; set; }
82111
}
83112

84113
/// <inheritdoc />
@@ -93,6 +122,8 @@ public partial class UpdateJobDescriptor<TDocument> where TDocument : class
93122
long? IUpdateJobRequest.RenormalizationWindowDays { get; set; }
94123
long? IUpdateJobRequest.ResultsRetentionDays { get; set; }
95124

125+
bool? IUpdateJobRequest.AllowLazyOpen { get; set; }
126+
96127
/// <inheritdoc />
97128
public UpdateJobDescriptor<TDocument> AnalysisLimits(Func<AnalysisMemoryLimitDescriptor, IAnalysisMemoryLimit> selector) =>
98129
Assign(selector, (a, v) => a.AnalysisLimits = v?.Invoke(new AnalysisMemoryLimitDescriptor()));
@@ -123,5 +154,9 @@ public UpdateJobDescriptor<TDocument> RenormalizationWindowDays(long? renormaliz
123154

124155
/// <inheritdoc />
125156
public UpdateJobDescriptor<TDocument> ResultsRetentionDays(long? resultsRetentionDays) => Assign(resultsRetentionDays, (a, v) => a.ResultsRetentionDays = v);
157+
158+
/// <inheritdoc />
159+
public UpdateJobDescriptor<TDocument> AllowLazyOpen(bool? allowLazyOpen = true) =>
160+
Assign(allowLazyOpen, (a, v) => a.AllowLazyOpen = v);
126161
}
127162
}

0 commit comments

Comments
 (0)