Skip to content

Commit ac66398

Browse files
committed
Drop the older # Requirements: parser
Superseded by the `required` flag on DIVE_PARAM (see PR #1639). VIAME \`.pipe\` files using the old `# Requirements:` header should be migrated to the new spec — until they are, those parameters won't be prompted for. - Drop \`PipelineRequirement\` from apispec.ts and dive_utils/types.py. - Drop \`description\` and \`requirements\` fields from \`Pipe\` / \`PipelineDescription\`; description is already exposed via \`metadata.description\`. - Drop \`extract_pipe_description\`, \`extract_pipe_requirements\`, \`extractPipeDescription\`, \`extractPipeRequirements\`. Training config descriptions now read from \`extractPipeMetadata().description\`. - Drop the Requirements dialog from RunPipelineMenu.
1 parent 5ed2087 commit ac66398

5 files changed

Lines changed: 3 additions & 365 deletions

File tree

client/dive-common/apispec.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@ interface AnnotationSchemaList {
3636
sets: string[];
3737
}
3838

39-
interface PipelineRequirement {
40-
/** Display name shown in the GUI */
41-
title: string;
42-
/** KWIVER -s override key (e.g. "track_refiner:refiner:sam3:text_query") */
43-
kwiver_override: string;
44-
/** Parameter type: string, int, float, bool */
45-
param_type: string;
46-
}
47-
4839
interface DiveParam {
4940
label: string;
5041
type: PipelineParamType;
@@ -64,8 +55,6 @@ interface Pipe {
6455
name: string;
6556
pipe: string;
6657
type: string;
67-
description?: string;
68-
requirements?: PipelineRequirement[];
6958
metadata?: PipeMetadata;
7059
folderId?: string;
7160
ownerId?: string;
@@ -393,7 +382,6 @@ export {
393382
MultiTrackRecord,
394383
MultiGroupRecord,
395384
Pipe,
396-
PipelineRequirement,
397385
PipeMetadata,
398386
Pipelines,
399387
SaveDetectionsArgs,

client/dive-common/components/RunPipelineMenu.vue

Lines changed: 1 addition & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
import {
1111
Pipelines,
1212
Pipe,
13-
PipelineRequirement,
1413
useApi,
1514
SubType,
1615
DatasetType,
@@ -102,48 +101,6 @@ export default defineComponent({
102101
menuState.value = 'idle';
103102
}
104103
105-
// Requirements dialog state (VIAME-specific)
106-
const requirementsDialogOpen = ref(false);
107-
const requirementsPipeline: Ref<Pipe | null> = ref(null);
108-
const requirementValues: Ref<Record<string, string>> = ref({});
109-
110-
function openRequirementsDialog(pipeline: Pipe) {
111-
requirementsPipeline.value = pipeline;
112-
const values: Record<string, string> = {};
113-
(pipeline.requirements || []).forEach((req: PipelineRequirement) => {
114-
if (req.param_type === 'bool') {
115-
values[req.kwiver_override] = 'false';
116-
} else if (req.param_type === 'int' || req.param_type === 'float') {
117-
values[req.kwiver_override] = '0';
118-
} else {
119-
values[req.kwiver_override] = '';
120-
}
121-
});
122-
requirementValues.value = values;
123-
requirementsDialogOpen.value = true;
124-
}
125-
126-
function cancelRequirements() {
127-
requirementsDialogOpen.value = false;
128-
requirementsPipeline.value = null;
129-
requirementValues.value = {};
130-
}
131-
132-
async function submitRequirements() {
133-
if (!requirementsPipeline.value) return;
134-
requirementsDialogOpen.value = false;
135-
const pipeline = requirementsPipeline.value;
136-
const additionalConfig: Record<string, string> = { ...requirementValues.value };
137-
requirementsPipeline.value = null;
138-
requirementValues.value = {};
139-
const configById: Record<string, Record<string, string>> = {};
140-
props.selectedDatasetIds.forEach((id) => {
141-
configById[id] = additionalConfig;
142-
});
143-
_runPipelineOnSelectedItemInner(pipeline, configById);
144-
}
145-
146-
// DiveParams dialog state (origin/main)
147104
const showParamsDialog = ref(false);
148105
const pipelineParams = ref<Record<string, string>>({});
149106
@@ -259,10 +216,6 @@ export default defineComponent({
259216
}
260217
261218
async function runPipelineOnSelectedItem(pipeline: Pipe) {
262-
if (pipeline.requirements && pipeline.requirements.length > 0) {
263-
openRequirementsDialog(pipeline);
264-
return;
265-
}
266219
if (pipeline.metadata?.diveParams && pipeline.metadata?.diveParams?.length > 0) {
267220
openDiveParamsDialog(pipeline);
268221
return;
@@ -330,11 +283,6 @@ export default defineComponent({
330283
cancelConfig,
331284
menuState,
332285
exitPipelineConfig,
333-
requirementsDialogOpen,
334-
requirementsPipeline,
335-
requirementValues,
336-
cancelRequirements,
337-
submitRequirements,
338286
pipelineParams,
339287
showParamsDialog,
340288
confirmPipelineExecution,
@@ -490,7 +438,7 @@ export default defineComponent({
490438
<v-list-item-title class="font-weight-regular" style="display: flex; justify-content: space-between; align-items: center;">
491439
{{ pipeline.name }}
492440
<v-icon style="margin-left: 20px">
493-
{{ (pipeline.metadata?.diveParams?.length ?? 0) > 0 || (pipeline.requirements?.length ?? 0) > 0 ? 'mdi-application-cog-outline' : 'mdi-play-outline' }}
441+
{{ (pipeline.metadata?.diveParams?.length ?? 0) > 0 ? 'mdi-application-cog-outline' : 'mdi-play-outline' }}
494442
</v-icon>
495443
</v-list-item-title>
496444
</v-list-item>
@@ -519,84 +467,6 @@ export default defineComponent({
519467
@cancel="cancelConfig"
520468
@submit="exitPipelineConfig"
521469
/>
522-
<!-- Requirements Dialog -->
523-
<v-dialog
524-
:value="requirementsDialogOpen"
525-
max-width="500"
526-
persistent
527-
>
528-
<v-card v-if="requirementsPipeline">
529-
<v-card-title class="text-h6">
530-
<v-icon left>
531-
mdi-cog
532-
</v-icon>
533-
{{ requirementsPipeline.name }}
534-
</v-card-title>
535-
<v-card-text>
536-
<p class="text-body-2 mb-4">
537-
This pipeline requires the following parameters:
538-
</p>
539-
<template v-for="req in requirementsPipeline.requirements">
540-
<v-checkbox
541-
v-if="req.param_type === 'bool'"
542-
:key="req.kwiver_override"
543-
v-model="requirementValues[req.kwiver_override]"
544-
:label="req.title"
545-
true-value="true"
546-
false-value="false"
547-
dense
548-
class="mt-1"
549-
/>
550-
<v-text-field
551-
v-else-if="req.param_type === 'int'"
552-
:key="req.kwiver_override"
553-
v-model="requirementValues[req.kwiver_override]"
554-
:label="req.title"
555-
type="number"
556-
step="1"
557-
outlined
558-
dense
559-
class="mt-2"
560-
/>
561-
<v-text-field
562-
v-else-if="req.param_type === 'float'"
563-
:key="req.kwiver_override"
564-
v-model="requirementValues[req.kwiver_override]"
565-
:label="req.title"
566-
type="number"
567-
step="0.01"
568-
outlined
569-
dense
570-
class="mt-2"
571-
/>
572-
<v-text-field
573-
v-else
574-
:key="req.kwiver_override"
575-
v-model="requirementValues[req.kwiver_override]"
576-
:label="req.title"
577-
outlined
578-
dense
579-
class="mt-2"
580-
/>
581-
</template>
582-
</v-card-text>
583-
<v-card-actions>
584-
<v-spacer />
585-
<v-btn
586-
text
587-
@click="cancelRequirements"
588-
>
589-
Cancel
590-
</v-btn>
591-
<v-btn
592-
color="primary"
593-
@click="submitRequirements"
594-
>
595-
Run Pipeline
596-
</v-btn>
597-
</v-card-actions>
598-
</v-card>
599-
</v-dialog>
600470
<PipelineParamsDialog
601471
v-model="showParamsDialog"
602472
:pipeline="selectedPipeline"

client/platform/desktop/backend/native/common.ts

Lines changed: 2 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import {
2323
AnnotationSchema,
2424
SaveAttributeTrackFilterArgs,
2525
Pipe,
26-
PipelineRequirement,
2726
PipeMetadata,
2827
PipelineParamType,
2928
} from 'dive-common/apispec';
@@ -72,112 +71,6 @@ async function readLines(filePath: string): Promise<string[]> {
7271
return rawBuffer.toString().replace(/\r\n/g, '\n').split('\n');
7372
}
7473

75-
/**
76-
* Extract description from a .pipe file header.
77-
* Looks for "# Description: " in the first 5 lines of the file.
78-
* Description can span multiple lines and ends when:
79-
* - A line starting with "# " followed by "=" is found (e.g., "# ===")
80-
* - A line starting with "#" followed by only whitespace is found
81-
* - A non-comment line is found
82-
*/
83-
async function extractPipeDescription(filePath: string): Promise<string | undefined> {
84-
try {
85-
const lines = await readLines(filePath);
86-
let description = '';
87-
let inDescription = false;
88-
let descriptionStartLine = -1;
89-
90-
// Find the Description: field within the first 5 lines
91-
const headerLines = lines.slice(0, 5);
92-
const descStartIndex = headerLines.findIndex((line) => /^#\s*Description:\s*/i.test(line));
93-
94-
if (descStartIndex === -1) {
95-
return undefined;
96-
}
97-
98-
// Extract the initial description text
99-
const descMatch = headerLines[descStartIndex].match(/^#\s*Description:\s*(.*)$/i);
100-
if (descMatch) {
101-
description = descMatch[1].trim();
102-
inDescription = true;
103-
descriptionStartLine = descStartIndex;
104-
}
105-
106-
// Continue reading from the line after Description: was found
107-
if (inDescription) {
108-
const remainingLines = lines.slice(descriptionStartLine + 1);
109-
remainingLines.some((line) => {
110-
// End conditions:
111-
// 1. Line starting with "# " followed by "=" (e.g., "# ===")
112-
if (/^#\s*=/.test(line)) {
113-
return true; // stop iteration
114-
}
115-
// 2. Line starting with "#" followed by only whitespace
116-
if (/^#\s*$/.test(line)) {
117-
return true; // stop iteration
118-
}
119-
// 3. Non-comment line (not starting with #)
120-
if (!line.startsWith('#')) {
121-
return true; // stop iteration
122-
}
123-
124-
// Continue reading multi-line description
125-
const continuedText = line.replace(/^#\s*/, '').trim();
126-
if (continuedText) {
127-
description += ` ${continuedText}`;
128-
}
129-
return false; // continue iteration
130-
});
131-
}
132-
133-
return description || undefined;
134-
} catch {
135-
return undefined;
136-
}
137-
}
138-
139-
/**
140-
* Extract requirements from a .pipe file header.
141-
* Looks for "# Requirements: " lines in the first 20 lines.
142-
* Each requirement is specified as: { Title, kwiver_override_key, type }
143-
*/
144-
async function extractPipeRequirements(
145-
filePath: string,
146-
): Promise<PipelineRequirement[] | undefined> {
147-
try {
148-
const lines = await readLines(filePath);
149-
const requirements: PipelineRequirement[] = [];
150-
151-
const headerLines = lines.slice(0, 20);
152-
headerLines.forEach((line) => {
153-
const match = line.match(/^#\s*Requirements?:\s*(.+)$/i);
154-
if (match) {
155-
const raw = match[1].trim();
156-
// Support multiple requirements on same line separated by ;
157-
raw.split(';').forEach((entry) => {
158-
let trimmed = entry.trim();
159-
// Remove surrounding braces if present
160-
if (trimmed.startsWith('{') && trimmed.endsWith('}')) {
161-
trimmed = trimmed.slice(1, -1).trim();
162-
}
163-
const parts = trimmed.split(',').map((p) => p.trim());
164-
if (parts.length >= 3) {
165-
requirements.push({
166-
title: parts[0],
167-
kwiver_override: parts[1],
168-
param_type: parts[2],
169-
});
170-
}
171-
});
172-
}
173-
});
174-
175-
return requirements.length > 0 ? requirements : undefined;
176-
} catch {
177-
return undefined;
178-
}
179-
}
180-
18174
/**
18275
* Extract metadata from a .pipe file header.
18376
*/
@@ -587,18 +480,12 @@ async function getPipelineList(settings: Settings): Promise<Pipelines> {
587480
}
588481

589482
const pipeFilePath = npath.join(pipelinePath, p);
590-
const [description, requirements, metadata] = await Promise.all([
591-
extractPipeDescription(pipeFilePath),
592-
extractPipeRequirements(pipeFilePath),
593-
extractPipeMetadata(pipeFilePath),
594-
]);
483+
const metadata = await extractPipeMetadata(pipeFilePath);
595484

596485
const pipeInfo: Pipe = {
597486
name: pipeName,
598487
type: pipeType,
599488
pipe: p,
600-
description,
601-
requirements,
602489
metadata,
603490
};
604491
if (pipeType in ret) {
@@ -698,7 +585,7 @@ async function getTrainingConfigs(settings: Settings): Promise<TrainingConfigs>
698585

699586
const configs: TrainingConfig[] = await Promise.all(configNames.map(async (name) => {
700587
const configFilePath = npath.join(pipelinePath, name);
701-
const description = await extractPipeDescription(configFilePath);
588+
const { description } = await extractPipeMetadata(configFilePath);
702589
return { name, description };
703590
}));
704591

0 commit comments

Comments
 (0)