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

Fix API inconsistency #7

Open
28 of 29 tasks
NichtJens opened this issue Mar 26, 2024 · 1 comment
Open
28 of 29 tasks

Fix API inconsistency #7

NichtJens opened this issue Mar 26, 2024 · 1 comment
Assignees

Comments

@NichtJens
Copy link
Collaborator

NichtJens commented Mar 26, 2024

API breaking changes:

  • rename endpoints:

    • get_running_detectors_list -> get_running_detectors
    • get_allowed_detectors_list -> get_allowed_detectors
    • get_last_run_number -> get_current_run_number
    • get_next_run_number -> advance_run_number
  • move advance_run_number (previously get_next_run_number, see above) from ENDPOINTS_GET to ENDPOINTS_POST (see also below)

  • move get_* endpoints of "slow broker" from ENDPOINTS_POST to ENDPOINTS_GET (see also below), specifically:

    • get_dap_settings
    • get_detector_settings
  • return dict for error_handler_500 consistent with other errors

    • rename "status" -> "message"
    • rename "state" -> "status"
    • "status": "error" vs. "failed" -> "error" for all error cases
  • consistent return dicts:

    • broker
      • "status": "pass" (single occurrence: no channels in retrieve) -> "error"
      • set_pvlist -> change {"message": pv_list} to proper return dict incl. "status" and "message": {"pv_list": pv_list, ...}
      • get_last_run_number and get_next_run_number -> change {"message": run_number} to proper return dict incl. "status" and "message": {"run_number": run_number, ...}
      • take_pedestal -> remove {"run_number": "0", "acquisition_number": "0", "unique_acquisition_number": "0"}
    • "slow broker"
      • *_detector_settings -> move individual values into parameters dict
      • get_detector_settings -> add "message"
      • set_detector_settings -> add "changed_parameters"
      • *_dap_settings -> wrap result dict in actual return dict incl. "status" and "message", specifically:
        • get_dap_settings -> {"dap_settings": dap_settings, ...}
        • set_dap_settings -> {"changed_parameters": changed_parameters, ...}
      • get_dap_settings -> rename "dap_settings" -> "parameters"
  • reword all messages to be consistent, clear and helpful

  • update docs


Note regarding endpoint types:

  • ENDPOINTS_GET ==> use requests.get(url, ...)
  • ENDPOINTS_POST ==> use requests.post(url, ...)

Won't fix this shutdown:

  • names of request parameters
  • some POSTs should probably be PATCH (set_dap_settings?)

WIP branch: https://github.com/paulscherrerinstitute/sf_daq_broker/tree/shutdown

@NichtJens NichtJens self-assigned this Mar 26, 2024
@NichtJens NichtJens pinned this issue Mar 29, 2024
@NichtJens
Copy link
Collaborator Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant