Skip to content

Commit 7cfe289

Browse files
authored
Merge pull request #554 from fractal-analytics-platform/removed-legacy-tasks-support-2
Deprecated support for legacy tasks in V2 workflows
2 parents 77a53fe + b9485aa commit 7cfe289

File tree

23 files changed

+75
-542
lines changed

23 files changed

+75
-542
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
*Note: Numbers like (\#123) point to closed Pull Requests on the fractal-web repository.*
22

3+
# Unreleased
4+
5+
* Deprecated support for legacy tasks in V2 workflows (\#554);
6+
37
# 1.5.0
48

59
* Implemented functionality for creating and displaying user groups (\#551);

__tests__/v2/workflow_page.test.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@ describe('Workflow page', () => {
4848
switch (url) {
4949
case '/api/v2/task':
5050
return [{ id: 1, workflow_id: 1, task_id: 1, task: { id: 1, name: 'test' } }];
51-
case '/api/v2/task-legacy':
52-
return { data: [] };
5351
case '/api/v2/project/1/dataset/1':
5452
return { id: 1, name: 'test' };
5553
case '/api/v2/project/1/status?dataset_id=1&workflow_id=1':

playwright.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ export default defineConfig({
107107

108108
webServer: [
109109
{
110-
command: './tests/start-test-server.sh 2.4.0',
110+
command: './tests/start-test-server.sh 2.5.0a0',
111111
port: 8000,
112112
waitForPort: true,
113113
stdout: 'pipe',

sandbox/src/lib/components/VersionUpdateSandbox.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,7 @@
154154
dummyWorkflowTask = {
155155
id: 1,
156156
args_parallel: deepCopy(oldSchemaData),
157-
task_type: 'parallel',
158-
is_legacy_task: false
157+
task_type: 'parallel'
159158
};
160159
161160
dummyUpdateCandidate = {

src/lib/components/v1/workflow/version-checker.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,19 @@ import { AlertError } from '$lib/common/errors';
33

44
/**
55
* @param {import('$lib/types').Task} task
6-
* @param {boolean|false=} v2
76
* @returns {Promise<import('$lib/types').Task[]>} the list of update candidates for the given task
87
*/
9-
export async function getNewVersions(task, v2) {
10-
const updateCandidates = await getAllNewVersions([task], v2);
8+
export async function getNewVersions(task) {
9+
const updateCandidates = await getAllNewVersions([task]);
1110
return updateCandidates[task.id];
1211
}
1312

1413
/**
1514
* @param {import('$lib/types').Task[]} tasks
16-
* @param {boolean|false=} v2
1715
* @returns {Promise<{ [id: string]: import('$lib/types').Task[] }>} the list of update candidates, for each task received as input
1816
*/
19-
export async function getAllNewVersions(tasks, v2 = false) {
20-
const response = await fetch(v2 ? `/api/v2/task-legacy` : `/api/v1/task`);
17+
export async function getAllNewVersions(tasks) {
18+
const response = await fetch(`/api/v1/task`);
2119

2220
if (!response.ok) {
2321
throw new AlertError(await response.json());

src/lib/components/v2/projects/CreateWorkflowModal.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -98,9 +98,7 @@
9898
9999
let customTaskWarning = '';
100100
await tick();
101-
const customTasks = workflow.task_list
102-
.map((w) => (w.is_legacy_task ? w.task_legacy : w.task))
103-
.filter((t) => t.owner);
101+
const customTasks = workflow.task_list.map((w) => w.task).filter((t) => t.owner);
104102
105103
if (customTasks.length > 0) {
106104
customTaskWarning = `Custom tasks (e.g. "${customTasks[0].name}") are not meant to be portable; workflow "${workflow.name}" was imported, but it may not work as expected.`;

src/lib/components/v2/projects/datasets/DatasetHistoryModal.svelte

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,17 @@
1616
...historyItem,
1717
workflowtask: {
1818
...historyItem.workflowtask,
19-
task: historyItem.workflowtask.is_legacy_task
20-
? null
21-
: {
22-
...historyItem.workflowtask.task,
23-
args_schema_non_parallel: historyItem.workflowtask.task.args_schema_non_parallel
24-
? '[HIDDEN]'
25-
: undefined,
26-
args_schema_parallel: historyItem.workflowtask.task.args_schema_parallel
27-
? '[HIDDEN]'
28-
: undefined,
29-
docs_info: historyItem.workflowtask.task.docs_info ? '[HIDDEN]' : undefined,
30-
docs_link: historyItem.workflowtask.task.docs_link ? '[HIDDEN]' : undefined
31-
},
32-
task_legacy: historyItem.workflowtask.is_legacy_task
33-
? {
34-
...historyItem.workflowtask.task_legacy,
35-
args_schema: historyItem.workflowtask.task_legacy.args_schema
36-
? '[HIDDEN]'
37-
: undefined,
38-
docs_info: historyItem.workflowtask.task_legacy.docs_info ? '[HIDDEN]' : undefined,
39-
docs_link: historyItem.workflowtask.task_legacy.docs_link ? '[HIDDEN]' : undefined
40-
}
41-
: null
19+
task: {
20+
...historyItem.workflowtask.task,
21+
args_schema_non_parallel: historyItem.workflowtask.task.args_schema_non_parallel
22+
? '[HIDDEN]'
23+
: undefined,
24+
args_schema_parallel: historyItem.workflowtask.task.args_schema_parallel
25+
? '[HIDDEN]'
26+
: undefined,
27+
docs_info: historyItem.workflowtask.task.docs_info ? '[HIDDEN]' : undefined,
28+
docs_link: historyItem.workflowtask.task.docs_link ? '[HIDDEN]' : undefined
29+
}
4230
}
4331
},
4432
null,
@@ -65,9 +53,7 @@
6553
aria-expanded="false"
6654
aria-controls="collapse-dataset-history-{index}"
6755
>
68-
Task "{value.workflowtask.is_legacy_task
69-
? value.workflowtask.task_legacy.name
70-
: value.workflowtask.task.name}", status "{value.status}"
56+
Task "{value.workflowtask.task.name}", status "{value.status}"
7157
</button>
7258
</h2>
7359
<div

src/lib/components/v2/workflow/ArgumentsSchema.svelte

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -45,27 +45,17 @@
4545
unsavedChangesFormBuilderParallel ||
4646
unsavedChangesFormBuilderNonParallel;
4747
48-
$: isSchemaValid = argsSchemaVersionValid(
49-
workflowTask.is_legacy_task
50-
? workflowTask.task_legacy.args_schema_version
51-
: workflowTask.task.args_schema_version
52-
);
48+
$: isSchemaValid = argsSchemaVersionValid(workflowTask.task.args_schema_version);
5349
5450
$: hasNonParallel =
5551
workflowTask.task_type === 'non_parallel' || workflowTask.task_type === 'compound';
5652
$: hasParallel = workflowTask.task_type === 'parallel' || workflowTask.task_type === 'compound';
5753
58-
$: argsSchemaNonParallel = workflowTask.is_legacy_task
59-
? null
60-
: workflowTask.task.args_schema_non_parallel;
54+
$: argsSchemaNonParallel = workflowTask.task.args_schema_non_parallel;
6155
62-
$: argsSchemaParallel = workflowTask.is_legacy_task
63-
? workflowTask.task_legacy.args_schema
64-
: workflowTask.task.args_schema_parallel;
56+
$: argsSchemaParallel = workflowTask.task.args_schema_parallel;
6557
66-
$: schemaVersion = workflowTask.is_legacy_task
67-
? workflowTask.task_legacy.args_schema_version
68-
: workflowTask.task.args_schema_version;
58+
$: schemaVersion = workflowTask.task.args_schema_version;
6959
7060
function handleNonParallelChanged() {
7161
unsavedChangesNonParallel = true;
@@ -201,32 +191,29 @@
201191
}
202192
203193
$: hasNonParallelArgs =
204-
!workflowTask.is_legacy_task &&
205194
workflowTask.task.args_schema_non_parallel &&
206195
Object.keys(
207196
stripIgnoredProperties(
208197
workflowTask.task.args_schema_non_parallel,
209-
getPropertiesToIgnore(workflowTask.is_legacy_task)
198+
getPropertiesToIgnore(false)
210199
).properties
211200
).length;
212201
213202
$: hasParallelArgs =
214203
argsSchemaParallel &&
215-
Object.keys(
216-
stripIgnoredProperties(argsSchemaParallel, getPropertiesToIgnore(workflowTask.is_legacy_task))
217-
.properties
218-
).length;
204+
Object.keys(stripIgnoredProperties(argsSchemaParallel, getPropertiesToIgnore(false)).properties)
205+
.length;
219206
220-
$: propertiesToIgnore = getPropertiesToIgnore(workflowTask.is_legacy_task);
207+
$: propertiesToIgnore = getPropertiesToIgnore(false);
221208
</script>
222209
223210
<div id="workflow-arguments-schema-panel">
224211
<div id="task-args-validation-errors" />
225212
{#if workflowTask.task_type === 'non_parallel' || workflowTask.task_type === 'compound'}
226-
{#if (hasNonParallelArgs && hasParallelArgs) || (workflowTask.task_type === 'compound' && !workflowTask.is_legacy_task && !workflowTask.task.args_schema_non_parallel)}
213+
{#if (hasNonParallelArgs && hasParallelArgs) || (workflowTask.task_type === 'compound' && !workflowTask.task.args_schema_non_parallel)}
227214
<h5 class="ps-2 mt-3">Initialisation Arguments</h5>
228215
{/if}
229-
{#if !workflowTask.is_legacy_task && workflowTask.task.args_schema_non_parallel && isSchemaValid}
216+
{#if workflowTask.task.args_schema_non_parallel && isSchemaValid}
230217
<div class="args-list">
231218
<JSchema
232219
componentId="jschema-non-parallel"
@@ -248,7 +235,7 @@
248235
</div>
249236
{/if}
250237
{/if}
251-
{#if (hasNonParallelArgs && hasParallelArgs) || (workflowTask.task_type === 'compound' && !argsSchemaParallel && !workflowTask.is_legacy_task && !workflowTask.task.args_schema_non_parallel)}
238+
{#if (hasNonParallelArgs && hasParallelArgs) || (workflowTask.task_type === 'compound' && !argsSchemaParallel && !workflowTask.task.args_schema_non_parallel)}
252239
<hr />
253240
{/if}
254241
{#if workflowTask.task_type === 'parallel' || workflowTask.task_type === 'compound'}

src/lib/components/v2/workflow/ImportExportArgs.svelte

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@
5353
const serializedArgs = JSON.stringify(args, null, 2);
5454
downloadBlob(
5555
serializedArgs,
56-
`args-${createSlug(
57-
workflowTask.is_legacy_task ? workflowTask.task_legacy.name : workflowTask.task.name
58-
)}.json`,
56+
`args-${createSlug(workflowTask.task.name)}.json`,
5957
'text/json;charset=utf-8;'
6058
);
6159
}

src/lib/components/v2/workflow/RunWorkflowModal.svelte

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -311,11 +311,7 @@
311311
>
312312
<option value={undefined}>Select first task</option>
313313
{#each workflow.task_list as wft}
314-
{#if wft.is_legacy_task}
315-
<option value={wft.order}>{wft.task_legacy.name}</option>
316-
{:else}
317-
<option value={wft.order}>{wft.task.name}</option>
318-
{/if}
314+
<option value={wft.order}>{wft.task.name}</option>
319315
{/each}
320316
</select>
321317
<span class="invalid-feedback"> The first task is required </span>
@@ -332,11 +328,7 @@
332328
<option value={undefined}>Select last task</option>
333329
{#each workflow.task_list as wft}
334330
{#if firstTaskIndex === undefined || wft.order >= firstTaskIndex}
335-
{#if wft.is_legacy_task}
336-
<option value={wft.order}>{wft.task_legacy.name}</option>
337-
{:else}
338-
<option value={wft.order}>{wft.task.name}</option>
339-
{/if}
331+
<option value={wft.order}>{wft.task.name}</option>
340332
{/if}
341333
{/each}
342334
</select>

0 commit comments

Comments
 (0)