Skip to content

Commit

Permalink
Add a check in case both the pipeline specs blocks and the specs on d…
Browse files Browse the repository at this point in the history
…isk have both parameters and containers (#164)
  • Loading branch information
FGRCL authored Jul 23, 2024
1 parent a02a881 commit 357ef1e
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions frontend/server/pipelineSerialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,14 @@ export async function saveBlock(blockKey, blockSpec, fromPath, toPath) {
}

//added a helper function to know if a block is a parameter block
function isParameterBlock(blockSpec) {
function hasParameter(blockSpec) {
return blockSpec && blockSpec.action && blockSpec.action.parameters;
}

function hasContainer(blockSpec) {
return blockSpec.action.container || blockSpec.action.pipeline;
}

export async function copyPipeline(pipelineSpecs, fromDir, toDir) {
const bufferPath = path.resolve(process.cwd(), fromDir);

Expand Down Expand Up @@ -92,7 +96,7 @@ export async function copyPipeline(pipelineSpecs, fromDir, toDir) {
}
}

if (existingBlockPath != newBlockPath && !isParameterBlock(blockSpec)) {
if (existingBlockPath != newBlockPath) {
// if it's the same folder, don't try to copy it
await fs.cp(existingBlockPath, newBlockPath, { recursive: true });
await fs.writeFile(
Expand Down Expand Up @@ -137,7 +141,7 @@ function getPipelineBlocks(pipelineSpecs) {
const blocks = new Set();
const pipeline = pipelineSpecs.pipeline;
for (const [key, block] of Object.entries(pipeline)) {
if (block.action.container || block.action.pipeline) {
if (hasContainer(block) && !hasParameter(block)) {
blocks.add(key);
}
}
Expand Down

0 comments on commit 357ef1e

Please sign in to comment.