Skip to content

Commit

Permalink
Merge pull request #291 from bryanmiller/GSCHED-434
Browse files Browse the repository at this point in the history
Fixed bugs related to atoms and observation splitting
  • Loading branch information
sraaphorst authored Aug 21, 2023
2 parents a638e56 + 686fd83 commit 2bc0aa1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions scheduler/core/components/collector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,14 +508,14 @@ def time_accounting(self, site_plans: Plans) -> None:
observation = self.get_observation(v.obs_id)
obs_seq = observation.sequence
# check that Observation is Observed
if v.atom_end_idx == len(obs_seq)-1:
if v.atom_end_idx == len(obs_seq) - 1:
logger.warning(f'Marking observation complete: {observation.id.id}')
observation.status = ObservationStatus.OBSERVED
else:
observation.status = ObservationStatus.ONGOING

# Update by atom in the sequence
for atom_idx in range(v.atom_start_idx, v.atom_end_idx):
for atom_idx in range(v.atom_start_idx, v.atom_end_idx + 1):
obs_seq[atom_idx].program_used = obs_seq[atom_idx].prog_time
obs_seq[atom_idx].partner_used = obs_seq[atom_idx].part_time

Expand Down
2 changes: 1 addition & 1 deletion scheduler/core/components/optimizer/greedymax.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def cumulative_seq_exec_times(sequence: Sequence) -> List[timedelta]:
for atom in sequence:
if not atom.observed:
total_exec += atom.exec_time
cumul_seq.append(total_exec)
cumul_seq.append(total_exec)
if len(cumul_seq) == 0:
cumul_seq.append(total_exec)

Expand Down
3 changes: 2 additions & 1 deletion scheduler/core/output/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def print_plans(all_plans: List[Plans]) -> None:
for plan in plans:
print(f'Plan for site: {plan.site.name}')
for visit in plan.visits:
print(f'\t{visit.start_time} {visit.obs_id.id:20} {visit.score:8.2f}')
print(f'\t{visit.start_time} {visit.obs_id.id:20} {visit.score:8.2f} {visit.atom_start_idx:4d} '
f'{visit.atom_end_idx:4d}')


def plans_table(all_plans: List[Plans]) -> List[Dict[Site, pd.DataFrame]]:
Expand Down

0 comments on commit 2bc0aa1

Please sign in to comment.