Skip to content

Commit

Permalink
address review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
emanehab99 committed Oct 11, 2023
1 parent 44cd89c commit 24e0e04
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 31 deletions.
44 changes: 14 additions & 30 deletions schedview/app/scheduler_dashboard/scheduler_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@
DEFAULT_CURRENT_TIME = Time.now()
DEFAULT_TIMEZONE = "America/Santiago"
LOGO = "/assets/lsst_white_logo.png"
COLOR_PALETTES = [color for color in bokeh.palettes.__palettes__ if "256" in color]


pn.extension(
"tabulator",
Expand All @@ -73,11 +75,6 @@
"""


def get_color_palettes():
palettes = [color for color in bokeh.palettes.__palettes__ if "256" in color]
return palettes


def url_formatter(dataframe_row, name_column, url_column):
"""Format survey name as a HTML href to survey URL (if URL exists).
Expand Down Expand Up @@ -134,7 +131,7 @@ class Scheduler(param.Parameterized):
label="Map resolution (nside)",
doc="",
)
color_palette = param.Selector(default="Viridis256", objects=get_color_palettes(), doc="")
color_palette = param.Selector(default="Viridis256", objects=COLOR_PALETTES, doc="")
summary_widget = param.Parameter(default=None, doc="")
reward_widget = param.Parameter(default=None, doc="")
show_loading_indicator = param.Boolean(default=False)

Check warning on line 137 in schedview/app/scheduler_dashboard/scheduler_dashboard.py

View check run for this annotation

Codecov / codecov/patch

schedview/app/scheduler_dashboard/scheduler_dashboard.py#L137

Added line #L137 was not covered by tests
Expand Down Expand Up @@ -230,8 +227,6 @@ def _update_date(self):
)
).mjd

print(f"date in mjd: {self._date_time}")

if not self.make_scheduler_summary_df():
self.clear_dashboard()
self.show_loading_indicator = False

Check warning on line 232 in schedview/app/scheduler_dashboard/scheduler_dashboard.py

View check run for this annotation

Codecov / codecov/patch

schedview/app/scheduler_dashboard/scheduler_dashboard.py#L232

Added line #L232 was not covered by tests
Expand Down Expand Up @@ -473,8 +468,7 @@ def read_scheduler(self):
return False

def make_scheduler_summary_df(self):
"""
Update conditions, and make the reward
"""Update conditions, and make the reward
and scheduler summary dataframes.
Returns
Expand Down Expand Up @@ -594,8 +588,8 @@ def update_summary_widget_data(self):

@param.depends("_publish_summary_widget")
def publish_summary_widget(self):
"""
Publish the summary Tabulator widget to be displayed on the dashboard.
"""Publish the summary Tabulator widget
to be displayed on the dashboard.
Returns
-------
Expand Down Expand Up @@ -1070,8 +1064,8 @@ def generate_map_heading(self):

@param.depends("_update_headings")
def dashboard_subtitle(self):
"""
Load subtitle data and create/update a String pane to display subtitle.
"""Load subtitle data and create/update
a String pane to display subtitle.
Returns
-------
Expand All @@ -1092,8 +1086,8 @@ def dashboard_subtitle(self):

@param.depends("_update_headings")
def summary_table_heading(self):
"""
Load heading data and create/update a String pane to display heading.
"""Load heading data and create/update
a String pane to display heading.
Returns
-------
Expand Down Expand Up @@ -1322,14 +1316,6 @@ def generate_key():
return key


def get_grid_layout():
grid_layout = pn.GridSpec(
sizing_mode="stretch_both",
max_height=1000,
).servable()
return grid_layout


# ------------------------------------------------------------ Create dashboard


Expand All @@ -1350,12 +1336,10 @@ def scheduler_app(date=None, scheduler_pickle=None):
The dashboard.
"""
# Initialize the dashboard layout.
# sched_app = pn.GridSpec(
# sizing_mode='stretch_both',
# max_height=1000,
# ).servable()

sched_app = get_grid_layout()
sched_app = pn.GridSpec(

Check warning on line 1339 in schedview/app/scheduler_dashboard/scheduler_dashboard.py

View check run for this annotation

Codecov / codecov/patch

schedview/app/scheduler_dashboard/scheduler_dashboard.py#L1339

Added line #L1339 was not covered by tests
sizing_mode="stretch_both",
max_height=1000,
).servable()

scheduler = Scheduler()

Expand Down
1 change: 0 additions & 1 deletion tests/test_scheduler_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@ def test_scheduler_app(self):
bokeh.io.reset_output()

def test_read_scheduler(self):
print(TEST_PICKLE)
self.scheduler = Scheduler()
self.scheduler.scheduler_fname = TEST_PICKLE
self.scheduler._date_time = Time(Timestamp(TEST_DATE, tzinfo=ZoneInfo(DEFAULT_TIMEZONE))).mjd
Expand Down

0 comments on commit 24e0e04

Please sign in to comment.