Skip to content

Commit

Permalink
raise OSError on post result graph error
Browse files Browse the repository at this point in the history
  • Loading branch information
muddymudskipper committed Jul 13, 2024
1 parent 64d1dec commit 2634c78
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cmem_plugin_reason/plugin_reason.py
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ def _execute(self, inputs: Sequence[Entities], context: ExecutionContext) -> Non
create_xml_catalog_file(self.temp, graphs)
self.reason(graphs)
setup_cmempy_user_access(context.user)
send_result(self, self.output_graph_iri, Path(self.temp) / "result.ttl")
send_result(self.output_graph_iri, Path(self.temp) / "result.ttl")
if self.validate_profile:
self.post_valid_profiles(inputs, graphs)
post_provenance(self, get_provenance(self, context))
Expand Down
2 changes: 1 addition & 1 deletion cmem_plugin_reason/plugin_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def _execute(self, context: ExecutionContext) -> Entities:

if self.produce_graph:
setup_cmempy_user_access(context.user)
send_result(self, self.output_graph_iri, Path(self.temp) / "output.ttl")
send_result(self.output_graph_iri, Path(self.temp) / "output.ttl")
setup_cmempy_user_access(context.user)
post_provenance(self, get_provenance(self, context))

Expand Down
4 changes: 2 additions & 2 deletions cmem_plugin_reason/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def get_graphs_tree(graph_iris: tuple) -> dict:
return graphs


def send_result(plugin: WorkflowPlugin, iri: str, filepath: Path) -> None:
def send_result(iri: str, filepath: Path) -> None:
"""Send result"""
res = post_streamed(
iri,
Expand All @@ -108,7 +108,7 @@ def send_result(plugin: WorkflowPlugin, iri: str, filepath: Path) -> None:
content_type="text/turtle",
)
if res.status_code != 204: # noqa: PLR2004
plugin.log.error("Error posting result graph.")
raise OSError(f"Error posting result graph (status code {res.status_code}).")


def post_provenance(plugin: WorkflowPlugin, prov: dict | None) -> None:
Expand Down

0 comments on commit 2634c78

Please sign in to comment.