Skip to content

Interface new implementation (API server) in dandi-cli top-level interfaces #320

@yarikoptic

Description

@yarikoptic

A decision was made in #283 to aim to get master in a shape to support interaction with both current girder-based deployed dandiarchive and WiP https://github.com/dandi/dandi-api implementations within the same code base. I think it is doable. #283 will provide "internal" interfaces for an upload/download cycle and then we would need to use/expose them through top level interfaces. For that, I think we should

  • to known_instances add a new entry "dandi-api" which would have no girder, we ui, redirector and only API.
    • we would need also at least a dandi-api-local-docker-tests to point to the fixture'd instance
    • we should not occlude other existing fixtures/instances such as local-docker-tests since they reflect the instances of currently deployed dandiarchive setup (albeit now without any API which was provided by publish. for a bit)
    • most likely we should add metadata-version "field" to those records, where for old ones it would be 0 (unversioned ad-hoc), and then 1 for the new version of metadata (ideally it should be the API server which tells which version of metadata schema it expects, but that is -- later).

upload

  • --dandi-instance option of dandi upload (in DANDI_DEVEL mode) would automagically list those added instance(s)
    • upload code should be RFed (main logic is in process_path so it could support both upload to original girder-based client and new API-based one
      • for new API-based one, metadata extraction should use new metadata (version 1) schema

download

for download, which does not rely on explicit specification of which instance to talk to, but parses from URL/identifier we need to come up with a "schema" on how to reference content from new API server, which would be easy on humans and flexible to support multiple instances/servers. Specification/parsing of such urls should be added to known_urls (https://github.com/dandi/dandi-cli/blob/master/dandi/dandiarchive.py#L109).

So what about just taking what we had/(have) on a recent iteration with publish API and tune it to correspond to our API (/dandisets/{version__dandiset__pk}/versions/{version__version}/assets/paths/) call:

       f"{server_grp}#.*/(?P<asset_type>dandiset)s/{dandiset_id_grp}"
        "/(?P<version>versions/([.0-9]{5,}|draft))"
        "(/assets/path(?location=(?P<location>.*)?)?)?"
        "$": {"server_type": "dandi-api"}

NB initially I thought we might need to add some optional prefix f"(dandi-api::)?" for early "decision making" but because of unique /dandisets/` I think we do not need it

so sample url for download would look like

  • https://api.dandiarchive.org/dandisets/000001, https://api.dandiarchive.org/dandisets/000001/versions/draft, https://api.dandiarchive.org/dandisets/000001/versions/draft/path/ -- entire dataset, draft version
  • https://api.dandiarchive.org/dandisets/000001/0.0.1 -- entire dataset, 0.0.1 version
  • https://api.dandiarchive.org/dandisets/000001/draft/path/sub-XXX -- sub-XXX folder (or a file if points to an asset) of draft version

instead of api.dandiarchive.org, urls could point to localhost:port in the test.

Later, whenever web UI starts using API, we would need to adjust other "schemas". redirector will start redirecting to new web ui, possibly different urls. But for now, IMHO it is sensible to just follow the API URLs. Those will not be really "visible" to users, but would allow us to test new functionality/interaction with API server.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions