Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion ipsframework/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -1760,7 +1760,9 @@ def update_time_stamp(self, new_time_stamp=-1):
Update time stamp on portal.
"""
event_data = {}
event_data['sim_name'] = self.sim_name
event_data['sim_name'] = self.sim_conf['__PORTAL_SIM_NAME']
event_data['real_sim_name'] = self.sim_name

portal_data = {}
portal_data['phystimestamp'] = new_time_stamp
portal_data['eventtype'] = 'PORTALBRIDGE_UPDATE_TIMESTAMP'
Expand Down
1 change: 1 addition & 0 deletions tests/hello-world-nested/hello_driver_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ def step(self, timestamp=0.0, **keywords):
except Exception:
self.services.exception('Error accessing worker component')
raise
self.services.update_time_stamp(1)
self.services.call(worker_comp, 'step', 0.0)
with open(self.OUTPUT_FILES.split()[0], 'w') as f:
f.write("SUB OUTPUT FILE\n")
Expand Down
1 change: 1 addition & 0 deletions tests/hello-world-nested/hello_worker_sub.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ def __init__(self, services, config):
def step(self, timestamp=0.0, **keywords):
print('Hello from HelloWorker - sub')
self.services.info('Hello from HelloWorker - sub')
self.services.send_portal_event(event_comment='Hello from HelloWorker - sub')
25 changes: 25 additions & 0 deletions tests/hello-world-nested/test_hello-world-nested.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import os
import shutil
import json
import glob
from ipsframework import Framework


Expand Down Expand Up @@ -98,3 +100,26 @@ def test_hello_world_nested(tmpdir, capfd):
lines = f.readlines()

assert lines[0] == "SUB INPUT FILE\n"

# check the simulation log json
json_files = glob.glob(str(tmpdir.join("hello_example_SUPER").join("simulation_log").join("*.json")))
assert len(json_files) == 1
with open(json_files[0], 'r') as json_file:
events = [json.loads(event) for event in json_file.readlines()]

assert len(events) == 25
assert events[-1]['eventtype'] == "IPS_END"

codes = set(event["code"] for event in events)

# Check that the sub wortflow writes to the same json file
assert len(codes) == 5
assert "Framework" in codes
assert "DRIVERS_HELLO_HelloDriver" in codes
assert "WORKERS_HELLO_HelloWorker" in codes
assert "DRIVERS_HELLOSUB_HelloDriver" in codes
assert "WORKERSSUB_HELLO_HelloWorker" in codes

# Check that phystimestamp get updated by the sub workflow
assert events[0]["phystimestamp"] == -1
assert events[-1]["phystimestamp"] == 1