Skip to content
Merged
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
13 changes: 13 additions & 0 deletions socs/agents/pysmurf_controller/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,8 @@ def stream(self, session, params):

>> response.session['data']
{
'stream_on': True,
'last_updated': 1749846521.2596238,
'stream_id': Stream-id for the slot,
'sid': Session-id for the streaming session,
}
Expand All @@ -444,6 +446,9 @@ def stream(self, session, params):
if not acquired:
return False, f"Operation failed: {self.lock.job} is running."

session.data['stream_on'] = False
session.data['last_updated'] = time.time()
init_start = time.time()
S, cfg = self._get_smurf_control(session=session,
load_tune=params['load_tune'])

Expand All @@ -453,7 +458,13 @@ def stream(self, session, params):

session.data['stream_id'] = cfg.stream_id
session.data['sid'] = sdl.stream_g3_on(S, **params['kwargs'])
session.data['stream_on'] = True
init_end = time.time()
init_duration = init_end - init_start
self.log.info("Stream initialization took {duration:.2f} seconds",
duration=init_duration)
while session.status in ['starting', 'running']:
session.data['last_updated'] = time.time()
if stop_time is not None:
if time.time() > stop_time:
break
Expand All @@ -462,6 +473,8 @@ def stream(self, session, params):
if params['test_mode']:
break
sdl.stream_g3_off(S)
session.data['stream_on'] = False
session.data['last_updated'] = time.time()

return True, 'Finished streaming data'

Expand Down