-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes scripts not updating on change in development mode #245
base: main
Are you sure you want to change the base?
Conversation
de19731
to
5c827bd
Compare
79cc0dd
to
bb83ef1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please comment on how it solves the issue
@@ -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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure that this is ok, i will check
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
loadPipeline() loads the script from the saved pipeline, not from the file we've changed, if I remember correctly. So, it will use the old version of the script.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here some detail is needed to understand if we need to refactor or it is reasonable change.
bb83ef1
to
9105376
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See my comments.
@@ -358,7 +362,11 @@ Model loadModelFromUrl(@NotNull String modelUrl) { | |||
private void extendBindingFromURL(VariablesBinding inputVariablesBinding, URL inputBindingURL) { | |||
try { | |||
final VariablesBinding vb2 = new VariablesBinding(); | |||
vb2.load(inputBindingURL.openStream(), FileUtils.langTurtle); | |||
String path = inputBindingURL.getPath(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do not understand why you are doing this ... and believe there will be inputstream that we will never close
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we are using old method, so vb2.load(inputBindingURL.openStream(), FileUtils.langTurtle);
, we'll get exception
java.net.ConnectException: Connection refused: getsockopt
E. g. if we want to rerun construct-greeting
, we'll get:
We do not have id
or is-greeted-by-message
, unlike here with my changes:
So, I'm loading the pipeline another way since it is saved on a disc.
@@ -221,7 +219,13 @@ 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 (scriptManager.doesRegistryContainsEntity(id)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why using once scriptManager and then PipelineFactory?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm trying to load it from the scriptManager
if the required module exists there. If it does not, e.g. we have deleted it from the file. In this case, I'm trying to load it from the saved pipeline (so it is the last saved instance before deletion), so we would have at least some working module. I'm not sure if it is the best solution; maybe it would be better to let the code throw an exception in
if (module == null) { throw new SPipesServiceException("Cannot load module with id=" + id); }
In case we are trying to load a non-existing module
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, deleting an attempt to load with PiplelineFactory will cause test failures, so the tests should be changed in this case
Resolves #227