#2350: add num_access, num_file_deletions and num_creations to file system

This commit is contained in:
Czar Echavez
2024-03-08 11:16:27 +00:00
parent 59bbc0e733
commit e9eef2b4c0
8 changed files with 108 additions and 5 deletions

View File

@@ -59,6 +59,16 @@ class Application(IOSoftware):
)
return state
def apply_timestep(self, timestep: int) -> None:
"""
Apply a timestep to the application.
:param timestep: The current timestep of the simulation.
"""
super().apply_timestep(timestep=timestep)
self.num_executions = 0 # reset number of executions
def _can_perform_action(self) -> bool:
"""
Checks if the application can perform actions.

View File

@@ -76,6 +76,8 @@ class DatabaseClient(Application):
if not self._can_perform_action():
return False
self.num_executions += 1 # trying to connect counts as an execution
if not connection_id:
connection_id = str(uuid4())

View File

@@ -194,6 +194,8 @@ class DataManipulationBot(Application):
"""
if not self._can_perform_action():
return
self.num_executions += 1
if self.server_ip_address and self.payload:
self.sys_log.info(f"{self.name}: Running")
self._logon()

View File

@@ -80,6 +80,8 @@ class WebBrowser(Application):
if not self._can_perform_action():
return False
self.num_executions += 1 # trying to connect counts as an execution
# reset latest response
self.latest_response = HttpResponsePacket(status_code=HttpStatusCode.NOT_FOUND)