Skip to content

Commit

Permalink
[#227] Fix module loading when contexts.keepUpdated=true
Browse files Browse the repository at this point in the history
Module configuration was not updated previously, because it was taken from provided snapshot of the pipeline (configModel). Now we are loading model from the filesystem instead.
  • Loading branch information
blcham committed Feb 24, 2025
1 parent 8c744d6 commit 2cc24d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public Module loadModule(final String moduleId,

// TODO check moduleTypeUri

return PipelineFactory.loadPipeline(scriptsRepository.getResource(resourceUri, resourceContextUri));
return PipelineFactory.loadModule(scriptsRepository.getResource(resourceUri, resourceContextUri));
}

public Module loadFunction(String functionId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import java.util.*;
import java.util.stream.Collectors;

import static cz.cvut.spipes.rest.util.ContextLoaderHelper.isKeepUpdated;

@Slf4j
@RestController
@EnableWebMvc
Expand Down Expand Up @@ -221,7 +223,12 @@ private Model runModule(final Model inputDataModel, final MultiValueMap<String,

ExecutionEngine engine = createExecutionEngine(configModel);
ContextLoaderHelper.updateContextsIfNecessary(scriptManager);
Module module = PipelineFactory.loadModule(configModel.createResource(id));
Module module = null;
if (isKeepUpdated()) {
module = scriptManager.loadModule(id, null, null);
} else {
module = PipelineFactory.loadModule(configModel.createResource(id));
}
if (module == null) {
throw new SPipesServiceException("Cannot load module with id=" + id);
}
Expand Down

0 comments on commit 2cc24d5

Please sign in to comment.