Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tickets/PREOPS-4896: make schedview's make_unique_survey_name more robust w.r.t. survey.observations type #79

Merged
merged 2 commits into from
Mar 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 10 additions & 5 deletions schedview/compute/scheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -317,11 +317,16 @@ def make_unique_survey_name(scheduler, survey_index=None):
except AttributeError:
survey_name = str(survey)

if (
hasattr(survey, "observations")
and ("note" in survey.observations)
and (survey.survey_name != survey.observations["note"][0])
):
# 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.
try:
observation_note = f"{survey.observations['note'][0]}"
except (AttributeError, ValueError, TypeError):
observation_note = None

if (observation_note is not None) and (survey.survey_name != observation_note):
survey_name = f"{survey.observations['note'][0]}"

survey_name = f"{survey_index[1]}: {survey_name}"
Expand Down
Loading