Skip to content

Commit

Permalink
use scheduler_note instead of note when present
Browse files Browse the repository at this point in the history
  • Loading branch information
ehneilsen committed Nov 15, 2024
1 parent ac1a3ba commit d4a5f34
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions schedview/compute/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,21 @@ def make_unique_survey_name(scheduler, survey_index=None):

# For auxtel, different fields have the same survey_name, but
# the interface should show the field name. So, if we're
# getting a field name in note, use that instead of the survey_name
# attribute.
# getting a field name in scheduler_note or note, use that in addition to
# the survey_name attribute.
try:
observation_note = f"{survey.observations['note'][0]}"
if len(observation_note) == 0:
observation_note = None
except (AttributeError, ValueError, TypeError):
observation_note = None

if (observation_note is not None) and (survey.survey_name != observation_note):
survey_name = f"{survey.survey_name} ({survey.observations['note'][0]})"
try:
scheduler_note = f"{survey.observations['scheduler_note'][0]}"
except KeyError:
# The key used to be just "note". If "scheduler_note" is absent,
# we may be following the older convention, so fall back on
# that.
scheduler_note = f"{survey.observations['note'][0]}"
except (AttributeError, ValueError, TypeError, KeyError):
scheduler_note = None

if scheduler_note and scheduler_note not in survey_name:
survey_name = f"{survey_name} ({scheduler_note})"

survey_name = f"{survey_index[1]}: {survey_name}"

Expand Down

0 comments on commit d4a5f34

Please sign in to comment.