Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from hyperstream.utils import StreamNotFoundError, reconstruct_interval
hyperstream = HyperStream(loglevel=loglevel)
M = hyperstream.channel_manager.memory
D = hyperstream.channel_manager.mongo
A = hyperstream.channel_manager.assets
workflow_id0 = "list_technicians_walkarounds"
if delete_existing_workflows:
hyperstream.workflow_manager.delete_workflow(workflow_id0)
try:
w0 = hyperstream.workflow_manager.workflows[workflow_id0]
except KeyError:
w0 = create_workflow_list_technicians_walkarounds(hyperstream, house=house, safe=False)
hyperstream.workflow_manager.commit_workflow(workflow_id0)
time_interval = TimeInterval.up_to_now()
w0.execute(time_interval)
# from datetime import timedelta
# time_interval.end += timedelta(milliseconds=1)
df = M[StreamId('experiments_dataframe', dict(house=house))].window().values()[0]
experiment_ids = set([df['experiment_id'][i - 1] for i in selection])
experiment_ids_str = '_'.join(experiment_ids)
create_selected_localisation_plates(hyperstream)
# Ensure the model is overwritten if it's already there
model_id = StreamId(
name="location_prediction",
description="All houses",
meta_data_id="house",
values=[],
complement=True,
parent_plate=None
)
workflow_id = "list_technicians_walkarounds"
if delete_existing_workflows:
hyperstream.workflow_manager.delete_workflow(workflow_id)
try:
w = hyperstream.workflow_manager.workflows[workflow_id]
except KeyError:
w = create_workflow_list_technicians_walkarounds(hyperstream, house, safe=False)
hyperstream.workflow_manager.commit_workflow(workflow_id)
time_interval = TimeInterval.up_to_now()
w.execute(time_interval)
print('number of sphere non_empty_streams: {}'.format(len(S.non_empty_streams)))
print('number of memory non_empty_streams: {}'.format(len(M.non_empty_streams)))
df = M[StreamId('experiments_dataframe', dict(house=house))].window().values()[0]
# arrow.get(x).humanize()
# df['start'] = df['start'].map('{:%Y-%m-%d %H:%M:%S}'.format)
df['duration'] = df['end'] - df['start']
df['start'] = map(lambda x: '{:%Y-%m-%d %H:%M:%S}'.format(x), df['start'])
df['end'] = map(lambda x: '{:%Y-%m-%d %H:%M:%S}'.format(x), df['end'])
# df['duration'] = map(lambda x:'{:%Mmin %Ssec}'.format(x),df['duration'])
df['start_as_text'] = map(lambda x: arrow.get(x).humanize(), df['start'])
from hyperstream import HyperStream, StreamId, TimeInterval, UTC
from workflows.display_experiments import create_workflow_list_technicians_walkarounds
from workflows.deploy_localisation_model import create_workflow_localisation_predict
hyperstream = HyperStream(loglevel=loglevel)
M = hyperstream.channel_manager.memory
workflow_id0 = "list_technicians_walkarounds"
if delete_existing_workflows:
hyperstream.workflow_manager.delete_workflow(workflow_id0)
try:
w0 = hyperstream.workflow_manager.workflows[workflow_id0]
except KeyError:
w0 = create_workflow_list_technicians_walkarounds(hyperstream, house=house, safe=False)
hyperstream.workflow_manager.commit_workflow(workflow_id0)
time_interval = TimeInterval.up_to_now()
w0.execute(time_interval)
df = M[StreamId('experiments_dataframe', dict(house=house))].window(TimeInterval.up_to_now()).values()[0]
experiment_ids = set([df['experiment_id'][i - 1] for i in selection])
hyperstream.plate_manager.delete_plate("H.SelectedLocalisationExperiment")
hyperstream.plate_manager.create_plate(
plate_id="H.SelectedLocalisationExperiment",
description="Localisation experiments selected by the technician in SPHERE house",
meta_data_id="localisation-experiment",
values=[],
complement=True,
parent_plate="H"
)
from hyperstream.utils import StreamNotFoundError
hyperstream = HyperStream(loglevel=logging.INFO)
M = hyperstream.channel_manager.memory
D = hyperstream.channel_manager.mongo
A = hyperstream.channel_manager.assets
workflow_id0 = "list_technicians_walkarounds"
if delete_existing_workflows:
hyperstream.workflow_manager.delete_workflow(workflow_id0)
try:
w0 = hyperstream.workflow_manager.workflows[workflow_id0]
except KeyError:
w0 = create_workflow_list_technicians_walkarounds(hyperstream, house=house, safe=False)
hyperstream.workflow_manager.commit_workflow(workflow_id0)
time_interval = TimeInterval.up_to_now()
w0.execute(time_interval)
df = M[StreamId('experiments_dataframe', dict(house=house))].window(TimeInterval.up_to_now()).values()[0]
experiment_ids = set([df['experiment_id'][i - 1] for i in selection])
hyperstream.plate_manager.delete_plate("H.SelectedLocalisationExperiment")
hyperstream.plate_manager.create_plate(
plate_id="H.SelectedLocalisationExperiment",
description="Localisation experiments selected by the technician in SPHERE house",
meta_data_id="localisation-experiment",
values=[],
complement=True,
parent_plate="H"
)
from workflows.display_experiments import create_workflow_list_technicians_walkarounds
from workflows.rssi_distributions_per_room import create_workflow_rssi_distributions_per_room
from hyperstream.utils import StreamNotFoundError
hyperstream = HyperStream(loglevel=logging.INFO)
M = hyperstream.channel_manager.memory
workflow_id0 = "list_technicians_walkarounds"
if delete_existing_workflows:
hyperstream.workflow_manager.delete_workflow(workflow_id0)
try:
w0 = hyperstream.workflow_manager.workflows[workflow_id0]
except KeyError:
w0 = create_workflow_list_technicians_walkarounds(hyperstream, house=house, safe=False)
hyperstream.workflow_manager.commit_workflow(workflow_id0)
time_interval = TimeInterval.up_to_now()
w0.execute(time_interval)
df = M[StreamId('experiments_dataframe', dict(house=house))].window(TimeInterval.up_to_now()).values()[0]
experiment_indices = selection
experiment_ids = set([df['experiment_id'][i - 1] for i in selection])
hyperstream.plate_manager.delete_plate("H.SelectedLocalisationExperiment")
hyperstream.plate_manager.create_plate(
plate_id="H.SelectedLocalisationExperiment",
description="Localisation experiments selected by the technician in SPHERE house",
meta_data_id="localisation-experiment",
values=[],
complement=True,
parent_plate="H"