Skip to content

Commit

Permalink
undo resource setters
Browse files Browse the repository at this point in the history
  • Loading branch information
ssssarah committed Oct 30, 2023
1 parent 9cab93f commit 59026ff
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion kgforge/core/commons/execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def _run_one(fun: Callable, resource: Resource, exception: Type[RunException], i
if monitored_status:
setattr(resource, monitored_status, status)

resource.set_last_action(Action(fun.__name__, succeeded, exception))
resource._last_action = Action(fun.__name__, succeeded, exception)

if not catch_exceptions and exception:
raise exception
5 changes: 0 additions & 5 deletions kgforge/core/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ def _sync_resource(item, vlist, sync_value=True):
else:
vlist.append(item)

def set_validated(self, validation_status: bool):
self._validated = validation_status

def set_last_action(self, action: "Action"):
self._last_action = action

def _get_synchronized(self) -> bool:
inner = []
Expand Down
6 changes: 3 additions & 3 deletions kgforge/specializations/models/rdf_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,16 @@ def _validate_many(self, resources: List[Resource], type_: str) -> None:
for resource in resources:
conforms, graph, _ = self.service.validate(resource, type_=type_)
if conforms:
resource.set_validated(True)
resource._validated = True
action = Action(self._validate_many.__name__, conforms, None)
else:
resource.set_validated(False)
resource._validated = False
violations = set(" ".join(re.findall('[A-Z][^A-Z]*', as_term(o)))
for o in graph.objects(None, SH.sourceConstraintComponent))
message = f"violation(s) of type(s) {', '.join(sorted(violations))}"
action = Action(self._validate_many.__name__, conforms, ValidationError(message))

resource.set_last_action(action)
resource._last_action = action

def _validate_one(self, resource: Resource, type_: str) -> None:
conforms, _, report = self.service.validate(resource, type_)
Expand Down
2 changes: 1 addition & 1 deletion kgforge/specializations/stores/nexus/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ def synchronize_resource(
else:
action = Action(action_name, succeeded, response)

resource.set_last_action(action)
resource._last_action = action
resource._synchronized = synchronized

def default_callback(self, fun_name: str) -> Callable:
Expand Down

0 comments on commit 59026ff

Please sign in to comment.