Skip to content

Commit ab57c87

Browse files
committed
Reuse existing executionClusterLabel value during relaunch
Signed-off-by: va6996 <vinayakagarwal6996@gmail.com>
1 parent f80d817 commit ab57c87

File tree

11 files changed

+79
-12
lines changed

11 files changed

+79
-12
lines changed

packages/common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"tslib": "^2.4.1"
2525
},
2626
"dependencies": {
27-
"@flyteorg/flyteidl": "^1.10.7",
27+
"@flyteorg/flyteidl": "^1.11.1-b1",
2828
"@protobuf-ts/runtime": "^2.6.0",
2929
"@protobuf-ts/runtime-rpc": "^2.6.0"
3030
},

packages/oss-console/src/components/Executions/ExecutionDetails/RelaunchExecutionForm.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ function useRelaunchWorkflowFormState({ execution }: RelaunchExecutionFormProps)
3737
securityContext,
3838
interruptible,
3939
overwriteCache,
40+
executionClusterLabel,
4041
},
4142
} = execution;
4243

@@ -63,6 +64,7 @@ function useRelaunchWorkflowFormState({ execution }: RelaunchExecutionFormProps)
6364
securityContext,
6465
interruptible,
6566
overwriteCache,
67+
executionClusterLabel,
6668
};
6769
},
6870
},
@@ -78,7 +80,7 @@ function useRelaunchTaskFormState({ execution }: RelaunchExecutionFormProps) {
7880
defaultValue: {} as TaskInitialLaunchParameters,
7981
doFetch: async (execution) => {
8082
const {
81-
spec: { authRole, launchPlan: taskId, interruptible, overwriteCache },
83+
spec: { authRole, launchPlan: taskId, interruptible, overwriteCache, executionClusterLabel },
8284
} = execution;
8385
const task = await apiContext.getTask(taskId);
8486
const inputDefinitions = getTaskInputs(task);
@@ -89,7 +91,7 @@ function useRelaunchTaskFormState({ execution }: RelaunchExecutionFormProps) {
8991
},
9092
apiContext,
9193
);
92-
return { authRole, values, taskId, interruptible, overwriteCache };
94+
return { authRole, values, taskId, interruptible, overwriteCache, executionClusterLabel };
9395
},
9496
},
9597
execution,

packages/oss-console/src/components/Executions/ExecutionDetails/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export enum ExecutionMetadataLabels {
1212
securityContextDefault = 'default',
1313
interruptible = 'Interruptible override',
1414
overwriteCache = 'Overwrite cached outputs',
15+
executionClusterLabel = 'Execution Cluster Label',
1516
}
1617

1718
export const tabs = {

packages/oss-console/src/components/Executions/ExecutionDetails/test/RelaunchExecutionForm.test.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,29 @@ describe('RelaunchExecutionForm', () => {
231231
}),
232232
});
233233
});
234+
235+
it('should have correct execution cluster label', async () => {
236+
execution.spec.executionClusterLabel = {
237+
value: 'label'
238+
};
239+
const { getByText } = renderForm();
240+
await waitFor(() => expect(getByText(mockContentString)));
241+
checkLaunchFormProps({
242+
initialParameters: expect.objectContaining({
243+
executionClusterLabel: execution.spec.executionClusterLabel,
244+
}),
245+
});
246+
});
247+
248+
it('should have null execution cluster label', async () => {
249+
const { getByText } = renderForm();
250+
await waitFor(() => expect(getByText(mockContentString)));
251+
checkLaunchFormProps({
252+
initialParameters: expect.objectContaining({
253+
executionClusterLabel: undefined,
254+
}),
255+
});
256+
});
234257
});
235258

236259
describe('Launch form with full inputs', () => {

packages/oss-console/src/components/Launch/LaunchForm/launchMachine.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ export interface WorkflowLaunchContext extends BaseLaunchContext {
9696
securityContext?: Core.ISecurityContext | null;
9797
interruptible?: Protobuf.IBoolValue | null;
9898
overwriteCache?: boolean | null;
99+
executionClusterLabel?: Admin.IExecutionClusterLabel | null;
99100
}
100101

101102
export interface TaskLaunchContext extends BaseLaunchContext {
@@ -105,6 +106,7 @@ export interface TaskLaunchContext extends BaseLaunchContext {
105106
taskVersionOptions?: Task[];
106107
interruptible?: Protobuf.IBoolValue | null;
107108
overwriteCache?: boolean | null;
109+
executionClusterLabel?: Admin.IExecutionClusterLabel | null;
108110
}
109111

110112
export interface TaskResumeContext extends BaseLaunchContext {

packages/oss-console/src/components/Launch/LaunchForm/types.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export interface WorkflowInitialLaunchParameters extends BaseInitialLaunchParame
6868
annotations?: Admin.IAnnotations | null;
6969
interruptible?: Protobuf.IBoolValue | null;
7070
overwriteCache?: boolean | null;
71+
executionClusterLabel?: Admin.IExecutionClusterLabel | null;
7172
}
7273

7374
export interface LaunchWorkflowFormProps extends BaseLaunchFormProps {
@@ -82,6 +83,7 @@ export interface TaskInitialLaunchParameters extends BaseInitialLaunchParameters
8283
securityContext?: Core.ISecurityContext;
8384
interruptible?: Protobuf.IBoolValue | null;
8485
overwriteCache?: boolean | null;
86+
executionClusterLabel?: Admin.IExecutionClusterLabel | null;
8587
}
8688
export interface LaunchTaskFormProps extends BaseLaunchFormProps {
8789
taskId: NamedEntityIdentifier;
@@ -115,6 +117,11 @@ export interface LaunchInterruptibleInputRef {
115117
validate(): boolean;
116118
}
117119

120+
export interface LaunchExecutionClusterLabelInputRef {
121+
getValue(): Admin.IExecutionClusterLabel | null | undefined;
122+
validate(): boolean;
123+
}
124+
118125
export interface LaunchAdvancedOptionsRef {
119126
getValues(): Admin.IExecutionSpec;
120127
validate(): boolean;
@@ -143,6 +150,7 @@ export interface LaunchWorkflowFormState {
143150
roleInputRef: React.RefObject<LaunchRoleInputRef>;
144151
interruptibleInputRef: React.RefObject<LaunchInterruptibleInputRef>;
145152
overwriteCacheInputRef: React.RefObject<LaunchOverwriteCacheInputRef>;
153+
executionClusterLabelInputRef: React.RefObject<LaunchExecutionClusterLabelInputRef>;
146154
state: State<WorkflowLaunchContext, WorkflowLaunchEvent, any, WorkflowLaunchTypestate>;
147155
service: Interpreter<WorkflowLaunchContext, any, WorkflowLaunchEvent, WorkflowLaunchTypestate>;
148156
workflowSourceSelectorState: WorkflowSourceSelectorState;
@@ -153,6 +161,7 @@ export interface LaunchTaskFormState {
153161
roleInputRef: React.RefObject<LaunchRoleInputRef>;
154162
interruptibleInputRef: React.RefObject<LaunchInterruptibleInputRef>;
155163
overwriteCacheInputRef: React.RefObject<LaunchOverwriteCacheInputRef>;
164+
executionClusterLabelInputRef: React.RefObject<LaunchExecutionClusterLabelInputRef>;
156165
state: State<TaskLaunchContext, TaskLaunchEvent, any, TaskLaunchTypestate>;
157166
service: Interpreter<TaskLaunchContext, any, TaskLaunchEvent, TaskLaunchTypestate>;
158167
taskSourceSelectorState: TaskSourceSelectorState;

packages/oss-console/src/components/Launch/LaunchForm/useLaunchTaskFormState.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
} from './launchMachine';
2323
import { validate as baseValidate } from './services';
2424
import {
25-
LaunchFormInputsRef,
25+
LaunchExecutionClusterLabelInputRef, LaunchFormInputsRef,
2626
LaunchInterruptibleInputRef,
2727
LaunchOverwriteCacheInputRef,
2828
LaunchRoleInputRef,
@@ -116,6 +116,7 @@ async function submit(
116116
roleInputRef: RefObject<LaunchRoleInputRef>,
117117
interruptibleInputRef: RefObject<LaunchInterruptibleInputRef>,
118118
overwriteCacheInputRef: RefObject<LaunchOverwriteCacheInputRef>,
119+
executionClusterLabelInputRef: RefObject<LaunchExecutionClusterLabelInputRef>,
119120
{ referenceExecutionId, taskVersion }: TaskLaunchContext,
120121
) {
121122
if (!taskVersion) {
@@ -132,6 +133,7 @@ async function submit(
132133
const literals = formInputsRef.current.getValues();
133134
const interruptible = interruptibleInputRef.current?.getValue();
134135
const overwriteCache = overwriteCacheInputRef.current?.getValue();
136+
const executionClusterLabel = executionClusterLabelInputRef.current?.getValue();
135137
const launchPlanId = taskVersion;
136138
const { domain, project } = taskVersion;
137139

@@ -144,6 +146,7 @@ async function submit(
144146
inputs: { literals },
145147
interruptible,
146148
overwriteCache,
149+
executionClusterLabel,
147150
});
148151
const newExecutionId = response.id as WorkflowExecutionIdentifier;
149152
if (!newExecutionId) {
@@ -159,6 +162,7 @@ function getServices(
159162
roleInputRef: RefObject<LaunchRoleInputRef>,
160163
interruptibleInputRef: RefObject<LaunchInterruptibleInputRef>,
161164
overwriteCacheInputRef: RefObject<LaunchOverwriteCacheInputRef>,
165+
executionClusterLabelInputRef: RefObject<LaunchExecutionClusterLabelInputRef>,
162166
) {
163167
return {
164168
loadTaskVersions: partial(loadTaskVersions, apiContext),
@@ -170,6 +174,7 @@ function getServices(
170174
roleInputRef,
171175
interruptibleInputRef,
172176
overwriteCacheInputRef,
177+
executionClusterLabelInputRef,
173178
launchContext,
174179
),
175180
validate: partial(
@@ -198,13 +203,18 @@ export function useLaunchTaskFormState({
198203
values: defaultInputValues,
199204
interruptible,
200205
overwriteCache,
206+
executionClusterLabel,
201207
} = initialParameters;
202208

203209
const apiContext = useAPIContext();
204210
const formInputsRef = useRef<LaunchFormInputsRef>(null);
205211
const roleInputRef = useRef<LaunchRoleInputRef>(null);
206212
const interruptibleInputRef = useRef<LaunchInterruptibleInputRef>(null);
207213
const overwriteCacheInputRef = useRef<LaunchOverwriteCacheInputRef>(null);
214+
const executionClusterLabelInputRef = useRef<LaunchExecutionClusterLabelInputRef>({
215+
getValue: () => executionClusterLabel,
216+
validate: () => true,
217+
});
208218

209219
const services = useMemo(
210220
() =>
@@ -214,8 +224,9 @@ export function useLaunchTaskFormState({
214224
roleInputRef,
215225
interruptibleInputRef,
216226
overwriteCacheInputRef,
227+
executionClusterLabelInputRef,
217228
),
218-
[apiContext, formInputsRef, roleInputRef, interruptibleInputRef, overwriteCacheInputRef],
229+
[apiContext, formInputsRef, roleInputRef, interruptibleInputRef, overwriteCacheInputRef, executionClusterLabelInputRef],
219230
);
220231

221232
const [state, sendEvent, service] = useMachine<
@@ -233,6 +244,7 @@ export function useLaunchTaskFormState({
233244
sourceId,
234245
interruptible,
235246
overwriteCache,
247+
executionClusterLabel,
236248
},
237249
});
238250

@@ -286,6 +298,7 @@ export function useLaunchTaskFormState({
286298
roleInputRef,
287299
interruptibleInputRef,
288300
overwriteCacheInputRef,
301+
executionClusterLabelInputRef,
289302
state,
290303
service,
291304
taskSourceSelectorState,

packages/oss-console/src/components/Launch/LaunchForm/useLaunchWorkflowFormState.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import {
3131
LaunchRoles,
3232
LaunchInterruptibleInputRef,
3333
LaunchOverwriteCacheInputRef,
34-
LaunchRoleInputRef,
34+
LaunchRoleInputRef, LaunchExecutionClusterLabelInputRef,
3535
} from './types';
3636
import { useWorkflowSourceSelectorState } from './useWorkflowSourceSelectorState';
3737
import { getUnsupportedRequiredInputs } from './utils';
@@ -165,6 +165,7 @@ async function submit(
165165
advancedOptionsRef: RefObject<LaunchAdvancedOptionsRef>,
166166
interruptibleInputRef: RefObject<LaunchInterruptibleInputRef>,
167167
overwriteCacheInputRef: RefObject<LaunchOverwriteCacheInputRef>,
168+
executionClusterLabelInputRef: RefObject<LaunchExecutionClusterLabelInputRef>,
168169
{ launchPlan, referenceExecutionId, workflowVersion }: WorkflowLaunchContext,
169170
) {
170171
if (!launchPlan) {
@@ -183,6 +184,7 @@ async function submit(
183184
advancedOptionsRef.current?.getValues() || {};
184185
const interruptible = interruptibleInputRef.current?.getValue();
185186
const overwriteCache = overwriteCacheInputRef.current?.getValue();
187+
const executionClusterLabel = executionClusterLabelInputRef.current?.getValue();
186188
const launchPlanId = launchPlan.id;
187189
const { domain, project } = workflowVersion;
188190

@@ -200,6 +202,7 @@ async function submit(
200202
inputs: { literals },
201203
interruptible,
202204
overwriteCache,
205+
executionClusterLabel,
203206
});
204207
const newExecutionId = response.id as WorkflowExecutionIdentifier;
205208
if (!newExecutionId) {
@@ -229,6 +232,7 @@ function getServices(
229232
advancedOptionsRef: RefObject<LaunchAdvancedOptionsRef>,
230233
interruptibleInputRef: RefObject<LaunchInterruptibleInputRef>,
231234
overwriteCacheInputRef: RefObject<LaunchOverwriteCacheInputRef>,
235+
executionClusterLabelInputRef: RefObject<LaunchExecutionClusterLabelInputRef>,
232236
) {
233237
return {
234238
loadWorkflowVersions: partial(loadWorkflowVersions, apiContext),
@@ -245,6 +249,7 @@ function getServices(
245249
advancedOptionsRef,
246250
interruptibleInputRef,
247251
overwriteCacheInputRef,
252+
executionClusterLabelInputRef,
248253
launchContext,
249254
),
250255
validate: () =>
@@ -281,6 +286,7 @@ export function useLaunchWorkflowFormState({
281286
securityContext,
282287
interruptible,
283288
overwriteCache,
289+
executionClusterLabel,
284290
} = initialParameters;
285291

286292
const apiContext = useAPIContext();
@@ -289,6 +295,10 @@ export function useLaunchWorkflowFormState({
289295
const advancedOptionsRef = useRef<LaunchAdvancedOptionsRef>(null);
290296
const interruptibleInputRef = useRef<LaunchInterruptibleInputRef>(null);
291297
const overwriteCacheInputRef = useRef<LaunchOverwriteCacheInputRef>(null);
298+
const executionClusterLabelInputRef = useRef<LaunchExecutionClusterLabelInputRef>({
299+
getValue: () => executionClusterLabel,
300+
validate: () => true,
301+
});
292302

293303
const services = useMemo(
294304
() =>
@@ -299,6 +309,7 @@ export function useLaunchWorkflowFormState({
299309
advancedOptionsRef,
300310
interruptibleInputRef,
301311
overwriteCacheInputRef,
312+
executionClusterLabelInputRef,
302313
),
303314
[
304315
apiContext,
@@ -307,6 +318,7 @@ export function useLaunchWorkflowFormState({
307318
advancedOptionsRef,
308319
interruptibleInputRef,
309320
overwriteCacheInputRef,
321+
executionClusterLabelInputRef,
310322
],
311323
);
312324

@@ -332,6 +344,7 @@ export function useLaunchWorkflowFormState({
332344
annotations,
333345
interruptible,
334346
overwriteCache,
347+
executionClusterLabel,
335348
},
336349
});
337350

@@ -448,6 +461,7 @@ export function useLaunchWorkflowFormState({
448461
roleInputRef,
449462
interruptibleInputRef,
450463
overwriteCacheInputRef,
464+
executionClusterLabelInputRef,
451465
state,
452466
service,
453467
workflowSourceSelectorState,

packages/oss-console/src/models/Execution/api.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,7 @@ export interface CreateWorkflowExecutionArguments {
115115
referenceExecutionId?: WorkflowExecutionIdentifier;
116116
interruptible?: Protobuf.IBoolValue | null;
117117
overwriteCache?: boolean | null;
118+
executionClusterLabel?: Admin.IExecutionClusterLabel | null;
118119
}
119120

120121
/** Submits a request to create a new `WorkflowExecution` using the provided
@@ -135,6 +136,7 @@ export const createWorkflowExecution = (
135136
referenceExecutionId: referenceExecution,
136137
interruptible,
137138
overwriteCache,
139+
executionClusterLabel,
138140
}: CreateWorkflowExecutionArguments,
139141
config?: RequestConfig,
140142
) => {
@@ -147,6 +149,7 @@ export const createWorkflowExecution = (
147149
},
148150
labels,
149151
annotations,
152+
executionClusterLabel,
150153
};
151154

152155
if (securityContext?.runAs?.iamRole || securityContext?.runAs?.k8sServiceAccount) {

website/console/env/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ const ADMIN_API_URL = process.env.ADMIN_API_URL?.replace(/https?:\/\//, '') || '
3737
const ADMIN_API = ADMIN_API_URL ? `//${ADMIN_API_URL}` : '';
3838

3939
// Webpage for local development
40-
const LOCAL_DEV_HOST = process.env.LOCAL_DEV_HOST || `localhost.${ADMIN_API_URL}`;
40+
const LOCAL_DEV_HOST = process.env.LOCAL_DEV_HOST || 'localhost';
4141

4242
/**
4343
* @deprecated use BASE_HREF

0 commit comments

Comments
 (0)