Skip to content

Commit

Permalink
SCHED-408: Fix testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergio committed Jul 27, 2023
1 parent 9e7a838 commit de97ed2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion scheduler/core/components/optimizer/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def schedule(self, selection: Selection) -> List[Plans]:
self.night_events = selection.night_events
# TODO: Assumes that all sites schedule the same amount of nights
# if num_nights_optimize is None:
# self.period = len(list(self.night_events.values())[0].time_grid)
self.period = len(list(self.night_events.values())[0].time_grid)
nights = [Plans(self.night_events, night) for night in range(self.period)]
self.algorithm.schedule(nights)
return nights
Expand Down
16 changes: 8 additions & 8 deletions scheduler/core/service/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,21 +39,21 @@ def __call__(self):

# Retrieve observations from Collector
collector = self.builder.build_collector(self.start_time,
self.end_time,
self.sites,
self.semesters,
Blueprints.collector)
self.end_time,
self.sites,
self.semesters,
Blueprints.collector)
collector.load_programs(program_provider_class=OcsProgramProvider,
data=programs)
# Create selection from Selector
selector = self.builder.build_selector(collector)
selection = selector.select(sites=self.sites)

# Execute the Optimizer.
optimizer = self.builder.build_optimizer(selection, Blueprints.optimizer)
plans = optimizer.schedule()
optimizer = self.builder.build_optimizer(Blueprints.optimizer)
plans = optimizer.schedule(selection)

#Calculate plans stats
# Calculate plans stats
plan_summary = calculate_plans_stats(plans, collector, selection)

# Save to database
Expand Down Expand Up @@ -127,7 +127,7 @@ def calculate_plans_stats(all_plans: List[Plans],
alt_degs = [val.dms[0] + (val.dms[1]/60) + (val.dms[2]/3600) for val in values]
plan.alt_degs.append(alt_degs)

plan.night_stats = NightStats(f'{plan.time_left()} min',
plan.night_stats = NightStats(f'{plan.time_left()} min',
plan_score,
Conditions.most_restrictive_conditions(plan_conditions),
n_toos,
Expand Down

0 comments on commit de97ed2

Please sign in to comment.