Total Complexity | 4 |
Total Lines | 41 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # Author: Simon Blanke |
||
2 | # Email: [email protected] |
||
3 | # License: MIT License |
||
4 | |||
5 | |||
6 | import os |
||
7 | import uuid |
||
8 | |||
9 | from ...data_tools import DataCollector |
||
10 | from .progress_io import ProgressIO |
||
11 | |||
12 | |||
13 | class ProgressBoard: |
||
14 | def __init__(self, filter_file=None): |
||
15 | self.filter_file = filter_file |
||
16 | |||
17 | self.uuid = uuid.uuid4().hex |
||
18 | self.search_ids = [] |
||
19 | |||
20 | self._io_ = ProgressIO("./") |
||
21 | |||
22 | def init_paths(self, search_id, search_space): |
||
23 | self._io_.remove_progress(search_id) |
||
24 | data_c = DataCollector(self._io_.get_progress_data_path(search_id)) |
||
25 | |||
26 | self.search_ids.append(search_id) |
||
27 | if self.filter_file: |
||
28 | self._io_.create_filter(search_id, search_space) |
||
29 | |||
30 | return data_c |
||
31 | |||
32 | def open_dashboard(self): |
||
33 | abspath = os.path.abspath(__file__) |
||
34 | dir_ = os.path.dirname(abspath) |
||
35 | |||
36 | paths = " ".join(self.search_ids) |
||
37 | open_streamlit = "streamlit run " + dir_ + "/run_streamlit.py " + paths |
||
38 | |||
39 | # from: https://stackoverflow.com/questions/7574841/open-a-terminal-from-python |
||
40 | os.system("gnome-terminal -e 'bash -c \" " + open_streamlit + " \"'") |
||
41 |