-
Notifications
You must be signed in to change notification settings - Fork 5
Add more metadata for pipelines #399
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
base: main
Are you sure you want to change the base?
Conversation
blcham
left a comment
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.
Done just partial review ... please rebase as well
s-pipes-core/src/main/java/cz/cvut/spipes/engine/ExecutionEngineImpl.java
Outdated
Show resolved
Hide resolved
12cec5c to
0f355a6
Compare
0f355a6 to
cdd3d2d
Compare
blcham
left a comment
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
| public static final Property has_script = property("has-script"); | ||
|
|
||
| public static final Property has_pipeline_execution_status = property("has-pipeline-execution-status"); | ||
| public static final Property has_executed_function_name = property("has-executed-function-name"); |
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 not have in addition to this has-executed-function, that would represent IRI of the function. I.e. it should be similar to how SPIPES.has_module_id is added.
Not sure if has-execution-function-name is needed as well, but I guess we can leave it like that if you need it.
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.
It actually returns IRI like http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1/execute-greeting, not just execute-greeting. I think I've named it like that because we already have a field has_pipeline_name, that returns Script IRI, so it follows the same naming logic
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 guess we can resolve this one right?
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.
Not quite yet. As far as I understood, it should be IRI in GraphDB too? In this case, it's still literal, so we can't. But I finally understand how to fix it, so I'll soon push it.
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.
Should be done now. All things that should be IRIs are actually IRIs now.
| addProperty(pipelineExecution, SPIPES.has_pipeline_execution_finish_date_unix, finishDate.getTime()); | ||
| addProperty(pipelineExecution, SPIPES.has_pipeline_execution_duration, computeDuration(startDate, finishDate)); | ||
| addProperty(pipelineExecution, SPIPES.has_pipeline_name, pipelineName); | ||
| addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status, "FINISHED"); |
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.
We want to represent status using IRI instead of literal! Moreover, we should represented through specific entities which will be connected to ?execution using rdf:type.
I.e. we would have two new constants in Vocabulary.java:
http://onto.fel.cvut.cz/ontologies/dataset-descriptor/failed-pipeline-execution
http://onto.fel.cvut.cz/ontologies/dataset-descriptor/finished-pipeline-execution
And there would be an ?execution and its related triples would be:
?execution a ddo:pipeline-execution, ddo:failed-pipeline-execution
or
?execution a ddo:pipeline-execution, ddo:finished-pipeline-execution
This is done in JOPA using @types, see https://github.com/kbss-cvut/termit/blob/782f2db881d6c882ebdda810207af54f52601805/src/main/java/cz/cvut/kbss/termit/model/UserAccount.java#L183 for inspiration.
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.
Done. I'm not sure that I've added it in the correct way, since s-pipes-model.ttl has Generated by the OWL API in it, so I don't know if it won't be overwritten at some point
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.
-- good catch w.r.t. Generated by the OWL API but it is ok : this is added here only if you are editing this file using Progege tool, which is ok.
-- however you modified s-pipes-model.ttl incorrectly see my comments on that file and try to read this thread again.
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.
s-pipes-core/src/main/java/cz/cvut/spipes/logging/AdvancedLoggingProgressListener.java
Outdated
Show resolved
Hide resolved
|
|
||
| String pipelineName = metadataMap.get(SPIPES.has_pipeline_name.toString()).toString(); | ||
| addProperty(pipelineExecution, SPIPES.has_pipeline_name, pipelineName); | ||
| addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status, "FAILED"); |
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.
should be IRI represented using @types ... as explained above.
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.
Done
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.
not done as i can still see addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status ...., why should be described elsewhere ...
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.
It's definitely an IRI now. Should be done
| } | ||
|
|
||
| private void persistPipelineExecutionStarted(final EntityManager em, long pipelineExecutionId, Thing pipelineExecution) { | ||
| private void persistPipelineExecutionStarted(final EntityManager em, long pipelineExecutionId, Thing pipelineExecution, final String functionName, final String scriptPath) { |
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 would add scriptIRI in addition to scriptPath ... as scriptIRI is typically something that does not change even if scriptPath is changed. We want to log that !
scriptIRI basically represents the identity of the script -- it should ideally not be changed if the script is doing the same task ... it must change if it is doing something else.
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.
It already has Script IRI like http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1 in has_pipeline_name field, or in Script Name columns at the executions page.
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 what do you mean by that ...
Do you mean that there is a triple:
?execution :has-pipeline-name http://onto.fel.cvut.cz/ontologies/s-pipes/hello-world-example-0.1 . ?
If so, we should call it :has-pipeline instead.
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.
or wait ... it is not pipeline
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.
it is :has-script right ?
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.
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.
So should I just rename has-pipeline-name and has-executed-function-name to has-pipeline and has-executed-function respectively?
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 it is pointing to IRI than it is not name ... it is the object itself ...
You are however pointing to Script and not the Pipeline ... so you should name it:
has-pipeline-name --> has-script
has-executed-function-name --> has-executed-function
See some insights into terminology here
| fire((l) -> {l.pipelineExecutionFinished(pipelineExecutionId); return null;}); | ||
| return outputContext; | ||
| String functionName = module.getFunctionName(); | ||
| String scriptPath = module.getScriptPath(); |
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 also wondering how to align your approach to what was done in https://github.com/kbss-cvut/s-pipes/pull/406/files#diff-2c6ee28836a277018037b96e4cf50d4f76b07f4c6a8f31bbaac8e20e4fc24df9
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.
This requires discussion.
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.
We have to wait for #406 to be resolved.
s-pipes-core/src/main/java/cz/cvut/spipes/logging/AdvancedLoggingProgressListener.java
Outdated
Show resolved
Hide resolved
s-pipes-core/src/main/java/cz/cvut/spipes/logging/AdvancedLoggingProgressListener.java
Outdated
Show resolved
Hide resolved
s-pipes-debug/src/main/java/cz/cvut/spipes/debug/dto/PipelineExecutionDto.java
Outdated
Show resolved
Hide resolved
| try { | ||
| URI script = new URI(metadataMap.get(SPIPES.has_script.toString()).toString()); | ||
| addProperty(pipelineExecution, SPIPES.has_script, script); | ||
| } catch (URISyntaxException e) { | ||
| log.error("Invalid script URI in metadata map: {}", metadataMap.get(SPIPES.has_script.toString()), e); | ||
| throw new IllegalStateException("Invalid script URI in metadata map", e); | ||
| } |
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.
You are polluting code with try block that basically cannot fail because you are using it only privately:
private static final Map<String, Object> metadataMap = new HashMap<>();
Then you have exactly same code 30 lines after this ... I am surprised that Intellij idea did not give you hint that it is duplicate code ...
Moreover, i suggest to create private method getURIFromMetadataMap() that handles all that. I.e. new code will look like:
addProperty(pipelineExecution, SPIPES.has_script, getURIFromMetadataMap(SPIPES.has_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.
Done
|
|
||
| String pipelineName = metadataMap.get(SPIPES.has_script.toString()).toString(); | ||
| addProperty(pipelineExecution, SPIPES.has_script, pipelineName); | ||
| try { |
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 comment above.
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.
Done
| addProperty(moduleExecution, SPIPES.has_script, module.getResource().toString().replaceAll("\\/[^.]*$", "")); | ||
| if(!metadataMap.containsKey(SPIPES.has_script.toString())){ | ||
| metadataMap.put(SPIPES.has_script.toString(), module.getResource().toString().replaceAll("\\/[^.]*$", "")); |
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.
| addProperty(moduleExecution, SPIPES.has_script, module.getResource().toString().replaceAll("\\/[^.]*$", "")); | |
| if(!metadataMap.containsKey(SPIPES.has_script.toString())){ | |
| metadataMap.put(SPIPES.has_script.toString(), module.getResource().toString().replaceAll("\\/[^.]*$", "")); | |
| String script = module.getResource().toString().replaceAll("\\/[^.]*$", ""); | |
| addProperty(moduleExecution, SPIPES.has_script, script); | |
| if(!metadataMap.containsKey(SPIPES.has_script.toString())){ | |
| metadataMap.put(SPIPES.has_script.toString(), 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.
duplicate code but i still do not understand why we need to do this ... can you explain me whole this part what is doing, why we need it ?
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.
Done. It saves the script's name as a property to be added to the database, then saves it to metadataMap if it's not there. We need to have it there so we'll have access to it from any function in the logger. E.g. right now I have a code like:
private void persistPipelineExecutionStarted(final EntityManager em, long pipelineExecutionId, Thing pipelineExecution, final String functionName, final String scriptPath)
Where functionName and scriptPath are parameters of the function I've added. To avoid using them as inputs of the function, I should use metadataMap and put these parameters there. It will also allow for easy access to these parameters from any other function if needed.
| public static final Property has_output_content = property("has-output-content"); | ||
| public static final Property has_script = property("has-script"); | ||
|
|
||
| public static final Property has_pipeline_execution_status = property("has-pipeline-execution-status"); |
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.
didn't we decide to move it to type of ?pipelineExecution ?
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.
Done
blcham
left a comment
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
| ### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/finished-pipeline-execution | ||
| s-pipes:finished-pipeline-execution rdf:type owl:DatatypeProperty ; | ||
| rdfs:domain ddo:module-execution ; | ||
| rdfs:range xsd:boolean ; | ||
| rdfs:label "has finished successfully" . | ||
|
|
||
| ### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/failed-pipeline-execution | ||
| s-pipes:failed-pipeline-execution rdf:type owl:DatatypeProperty ; | ||
| rdfs:domain ddo:module-execution ; | ||
| rdfs:range xsd:boolean ; | ||
| rdfs:label "has finished with error" . |
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.
| ### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/finished-pipeline-execution | |
| s-pipes:finished-pipeline-execution rdf:type owl:DatatypeProperty ; | |
| rdfs:domain ddo:module-execution ; | |
| rdfs:range xsd:boolean ; | |
| rdfs:label "has finished successfully" . | |
| ### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/failed-pipeline-execution | |
| s-pipes:failed-pipeline-execution rdf:type owl:DatatypeProperty ; | |
| rdfs:domain ddo:module-execution ; | |
| rdfs:range xsd:boolean ; | |
| rdfs:label "has finished with error" . | |
| ### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/finished-pipeline-execution | |
| s-pipes:finished-pipeline-execution rdf:type owl:Class ; | |
| rdfs:subClassOf s-pipes:pipeline-execution ; | |
| rdfs:label "Pipeline execution that finished successfully" . | |
| ### http://onto.fel.cvut.cz/ontologies/dataset-descriptor/failed-pipeline-execution | |
| s-pipes:failed-pipeline-execution rdf:type owl:Class ; | |
| rdfs:subClassOf s-pipes:pipeline-execution ; | |
| rdfs:label "Pipeline execution that finished with error .``` |
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 guess we did not understand each other... please read my comments again.
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.
Should be done
| addProperty(pipelineExecution, SPIPES.has_pipeline_execution_finish_date_unix, finishDate.getTime()); | ||
| addProperty(pipelineExecution, SPIPES.has_pipeline_execution_duration, computeDuration(startDate, finishDate)); | ||
| addProperty(pipelineExecution, SPIPES.has_pipeline_name, pipelineName); | ||
| addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status, "FINISHED"); |
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.
-- good catch w.r.t. Generated by the OWL API but it is ok : this is added here only if you are editing this file using Progege tool, which is ok.
-- however you modified s-pipes-model.ttl incorrectly see my comments on that file and try to read this thread again.
|
|
||
| String pipelineName = metadataMap.get(SPIPES.has_pipeline_name.toString()).toString(); | ||
| addProperty(pipelineExecution, SPIPES.has_pipeline_name, pipelineName); | ||
| addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status, "FAILED"); |
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.
not done as i can still see addProperty(pipelineExecution, SPIPES.has_pipeline_execution_status ...., why should be described elsewhere ...
3f011cc to
adc41d3
Compare
0412d55 to
516ae21
Compare


Resolves partially kbss-cvut/s-pipes-editor-ui#195
Resolves kbss-cvut/s-pipes-editor-ui#206