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

Update naming conventions and config structure #13

Closed
charles-turner-1 opened this issue Jan 20, 2025 · 1 comment · Fixed by #16
Closed

Update naming conventions and config structure #13

charles-turner-1 opened this issue Jan 20, 2025 · 1 comment · Fixed by #16
Assignees

Comments

@charles-turner-1
Copy link
Collaborator

Config.yaml currently contains the following:

catalog:
  endpoint: /intake/update
  items:
    - esm_datastore.search
    - DfFileCatalog.search
    - DfFileCatalog.__getitem__
payu: 
  endpoint: /payu/update
  items:
    - Experiment.run

which is of the more general form

service_1: 
  endpoint: endpoint_1
  items:
    - s1_li_1
    - s1_li_2
service_2:
  endpoint: endpoint_2
  items:
    - s2_li_1
    - s2_li_2
service_$N

This structure is necessary in order to respect the structures of the ApiHandler and TelemetryRegister classes. However, it enforces that we can only have a single endpoint per service. Conceptually, a service should really map to a Django app, and an endpoint to a model serializer, and so as things currently stand, we can only have one model per app, unless we resort to confusing tricks like

catalog:
  endpoint: /intake/update
  items:
    - esm_datastore.search
    - DfFileCatalog.search
    - DfFileCatalog.__getitem__
payu_run: 
  endpoint: /payu_run/update
  items:
    - Experiment.run
payu_restart: 
  endpoint: /payu_restart/update
  items:
    - Experiment.run

This needs fixing, so we have a schema more like

service_1: 
  endpoints:
    - endpoint_1:
      - s1_li_1
      - s1_li_2
    - endpoint_2:
      - s1_li_1
      - s1_li_2

...

eg

payu: 
  endpoints:
    - run:
      - Experiment.run
    - restart:
      - Experiment.restart
catalog:
  endpoints:
    - update:
      - esm_datastore.search
      - DfFileCatalog.search
      - DfFileCatalog.__getitem__
...
@charles-turner-1
Copy link
Collaborator Author

This can be further simplified by building the endpoints procedurally from the yaml structure: eg.

catalog:
  update:
    - esm_datastore.search
    - DfFileCatalog.search
    - DfFileCatalog.__getitem__
payu:
  run:
    - Experiment.run
  restart:
    - Experiment.restart

where calls to esm_datastore.search, DfFileCtalog.search, or DfFileCatalog.__getitem__ would send post requests to /catalog/update etc.

@charles-turner-1 charles-turner-1 self-assigned this Jan 20, 2025
@charles-turner-1 charles-turner-1 linked a pull request Jan 21, 2025 that will close this issue
2 tasks
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

Successfully merging a pull request may close this issue.

1 participant