Skip to content
Snippets Groups Projects
Commit c9720bdf authored by Simon Crowle's avatar Simon Crowle
Browse files

Fixes merge duplication of status reporting

parent 76be7c3d
No related branches found
No related tags found
No related merge requests found
...@@ -149,43 +149,6 @@ class Sim(object): ...@@ -149,43 +149,6 @@ class Sim(object):
endpoint_states_config[agent]["current_state_time"] = 0.6 endpoint_states_config[agent]["current_state_time"] = 0.6
sim_time += 10*TICK_TIME sim_time += 10*TICK_TIME
# move mpegdash media component state from 'stopped' to 'starting'
# Total reports = 1, (completed: 0.2 seconds in 'stopped', current: 0.8 seconds in 'starting')
for ip_endpoint in ip_endpoints:
agent = ip_endpoint["agent_url"]
agent_url = urllib.parse.urlparse(agent)
influxClient = InfluxDBClient(host=agent_url.hostname, port=agent_url.port, database=self.influx_db_name, timeout=10)
completed_states = ( ('stopped', 0.2, 1 ), )
mc_curr_states[agent]["current_state"] = 'starting'
mc_curr_states[agent]["current_state_time"] = 0.8
self._changeMCState( influxClient, sim_time, 'mpegdash_mc_config', completed_states, 'starting', 0.8 )
sim_time += TICK_TIME
# move mpegdash media component state from 'starting' to 'running'
# Total reports = 5, (4 incomplete 'starting', completed: 0.8 + 4 + 0.7 seconds in 'starting', current: 0.3 seconds in 'running')
for ip_endpoint in ip_endpoints:
agent = ip_endpoint["agent_url"]
agent_url = urllib.parse.urlparse(agent)
influxClient = InfluxDBClient(host=agent_url.hostname, port=agent_url.port, database=self.influx_db_name, timeout=10)
# 4 seconds of starting
for i in range(0, 4):
mc_curr_states[agent]["current_state"] = 'running'
mc_curr_states[agent]["current_state_time"] += TICK_TIME
self._writeMCSingleState( influxClient, sim_time +(i * TICK_TIME), 'mpegdash_mc_config', 'running', mc_curr_states[agent]["current_state_time"] )
# Switch over to running
completed_states = ( ('starting', 0.8 + 4 + 0.7, 1 ), )
mc_curr_states[agent]["current_state"] = 'running'
mc_curr_states[agent]["current_state_time"] = 0.3
self._changeMCState( influxClient, sim_time, 'mpegdash_mc_config', completed_states, 'running', 0.3 )
sim_time += 5 * TICK_TIME
# Move endpoints from state booted to state connecting # Move endpoints from state booted to state connecting
# reports: 2, booted: 1.5s, connecting: 0.5s # reports: 2, booted: 1.5s, connecting: 0.5s
# addition to uncompleted states from previous report: booted += 0.6s # addition to uncompleted states from previous report: booted += 0.6s
...@@ -227,25 +190,40 @@ class Sim(object): ...@@ -227,25 +190,40 @@ class Sim(object):
endpoint_states_config[agent]["current_state_time"] = 0.3 endpoint_states_config[agent]["current_state_time"] = 0.3
sim_time += 10 * TICK_TIME sim_time += 10 * TICK_TIME
# move mpegdash_service media component state from 'stopped' to 'starting' # move mpegdash media component state from 'stopped' to 'starting'
# Total reports = 1, (0.2 seconds in 'stopped', 0.8 seconds in 'starting') # Total reports = 1, (completed: 0.2 seconds in 'stopped', current: 0.8 seconds in 'starting')
for ip_endpoint in ip_endpoints: for ip_endpoint in ip_endpoints:
agent_url = urllib.parse.urlparse(ip_endpoint["agent_url"]) agent = ip_endpoint["agent_url"]
agent_url = urllib.parse.urlparse(agent)
influxClient = InfluxDBClient(host=agent_url.hostname, port=agent_url.port, database=self.influx_db_name, timeout=10) influxClient = InfluxDBClient(host=agent_url.hostname, port=agent_url.port, database=self.influx_db_name, timeout=10)
self._changeMCState(influxClient, sim_time, 'mpegdash_service_config', 10, 2, 'stopped', 'starting')
completed_states = ( ('stopped', 0.2, 1 ), )
mc_curr_states[agent]["current_state"] = 'starting'
mc_curr_states[agent]["current_state_time"] = 0.8
self._changeMCState( influxClient, sim_time, 'mpegdash_mc_config', completed_states, 'starting', 0.8 )
sim_time += TICK_TIME sim_time += TICK_TIME
# move mpegdash_service media component state from 'starting' to 'running' # move mpegdash media component state from 'starting' to 'running'
# Total reports = 5, (4.7 seconds in 'starting', 0.3 seconds in 'running') # Total reports = 5, (4 incomplete 'starting', completed: 0.8 + 4 + 0.7 seconds in 'starting', current: 0.3 seconds in 'running')
for ip_endpoint in ip_endpoints: for ip_endpoint in ip_endpoints:
agent_url = urllib.parse.urlparse(ip_endpoint["agent_url"]) agent = ip_endpoint["agent_url"]
agent_url = urllib.parse.urlparse(agent)
influxClient = InfluxDBClient(host=agent_url.hostname, port=agent_url.port, database=self.influx_db_name, timeout=10) influxClient = InfluxDBClient(host=agent_url.hostname, port=agent_url.port, database=self.influx_db_name, timeout=10)
# 4 seconds of starting
for i in range(0, 4): for i in range(0, 4):
self._writeMCSingleState(influxClient, 'mpegdash_service_config', 'starting', sim_time + (i * TICK_TIME)) mc_curr_states[agent]["current_state"] = 'running'
mc_curr_states[agent]["current_state_time"] += TICK_TIME
self._writeMCSingleState( influxClient, sim_time +(i * TICK_TIME), 'mpegdash_mc_config', 'running', mc_curr_states[agent]["current_state_time"] )
self._changeMCState(influxClient, sim_time + (4 * TICK_TIME), 'mpegdash_service_config', 10, 7, 'starting', 'running') # Switch over to running
completed_states = ( ('starting', 0.8 + 4 + 0.7, 1 ), )
mc_curr_states[agent]["current_state"] = 'running'
mc_curr_states[agent]["current_state_time"] = 0.3
self._changeMCState( influxClient, sim_time, 'mpegdash_mc_config', completed_states, 'running', 0.3 )
sim_time += 5 * TICK_TIME sim_time += 5 * TICK_TIME
...@@ -330,26 +308,6 @@ class Sim(object): ...@@ -330,26 +308,6 @@ class Sim(object):
# Simulate tear-down of media components and endpoints # Simulate tear-down of media components and endpoints
# remove endpoints
# reports: 5, connected: 4.7s, unplaced: 0.3s
# addition to uncompleted states from previous report: connected += 3600s + 0.3s
for ip_endpoint in ip_endpoints:
agent = ip_endpoint["agent_url"]
agent_url = urllib.parse.urlparse(agent)
agent_db_client = InfluxDBClient(host=agent_url.hostname, port=agent_url.port, database=self.influx_db_name, timeout=10)
# since the current state in the dictionary is still connected, only the current state time is incremented
for i in range(4):
self._writeVMSingleState(agent_db_client, sim_time + (i * TICK_TIME), ip_endpoint, "connected")
endpoint_states_config[agent]["current_state_time"] += TICK_TIME
# here, the VM exits state connected, hence need to append the current state time
self._changeVMState(agent_db_client, sim_time + (4*TICK_TIME), ip_endpoint, (('connected', 0.7 + endpoint_states_config[agent]["current_state_time"], 1),), 'unplaced', 0.3)
# since VM changed its current state, readjust the config dictionary
endpoint_states_config[agent]["current_state"] = "unplaced"
endpoint_states_config[agent]["current_state_time"] = 0.3
sim_time += 5 * TICK_TIME
# move mpegdash media component state from 'running' to 'stopping' # move mpegdash media component state from 'running' to 'stopping'
# Total reports = 2, ( completed: n+1.8 seconds in 'running', current: 0.2 seconds in 'stopping') # Total reports = 2, ( completed: n+1.8 seconds in 'running', current: 0.2 seconds in 'stopping')
for ip_endpoint in ip_endpoints: for ip_endpoint in ip_endpoints:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment