BCDA-APS / tiled-template

A template for a local tiled data server at the APS.
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

tiled has a breaking tag #2

Closed prjemian closed 10 months ago

prjemian commented 10 months ago

See tiled tag, v0.1.0a104 is not backwards-compatible with clients.

Update to this tag but change the default port to 8020 (if it is available).

Noted in https://github.com/BCDA-APS/gemviz/issues/53

prjemian commented 10 months ago

Need to re-learn how to deliver file directories (with custom, local Python support).

prjemian commented 10 months ago

Added this section to config.yml:

  - path: nexus
    tree: files
    args:
      directory: /home/prjemian/Documents/projects/BCDA-APS/tiled-template/dev_data/hdf5
      key_from_filename: tiled.adapters.files:identity
      mimetype_detection_hook: custom:detect_mimetype
      mimetypes_by_file_ext:
        .h5: application/x-hdf5

then try to start server:

Using configuration from /home/prjemian/Documents/projects/BCDA-APS/tiled-template/config.yml
Traceback (most recent call last):

  File "/home/prjemian/.conda/envs/tiled-test/bin/tiled", line 8, in <module>
    sys.exit(main())
             ^^^^^^

  File "/home/prjemian/.conda/envs/tiled-test/lib/python3.11/site-packages/tiled/commandline/_serve.py", line 563, in serve_config
    web_app = build_app_from_config(
              ^^^^^^^^^^^^^^^^^^^^^^

  File "/home/prjemian/.conda/envs/tiled-test/lib/python3.11/site-packages/tiled/server/app.py", line 839, in build_app_from_config
    kwargs = construct_build_app_kwargs(config, source_filepath=source_filepath)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "/home/prjemian/.conda/envs/tiled-test/lib/python3.11/site-packages/tiled/config.py", line 124, in construct_build_app_kwargs
    raise Exception(

Exception: The way that tiled serves files has changed.

See documentation section "Serve a Directory of Files".
prjemian commented 10 months ago

Serve a Directory of Files

This section has no documentation regarding the config.yml file.

prjemian commented 10 months ago

The tiled repo has example configuration files.

But none of them describe a config.yml file that exports a tree of files.

@danielballan - I need some advice here.

prjemian commented 10 months ago

See this section: https://blueskyproject.io/tiled/explanations/specialized-formats.html

prjemian commented 10 months ago

These steps to create and index the directory:

    tiled catalog init catalog.db
    PYTHONPATH=. \
        tiled catalog register \
        catalog.db \
        --verbose \
        --ext '.nx5=application/x-hdf5' \
        --ext '.nexus.hdf5=application/x-hdf5' \
        --mimetype-hook 'custom:detect_mimetype' \
        --adapter 'text/spec_data=spec_data:read_spec_data' \
        ./dev_data

then this content in the config.yml file:

  - path: dev_data
    tree: tiled.catalog:from_uri
    args:
      uri: ./catalog.db
      readable_storage:
        - ./dev_data
      adapters_by_mimetype:
        text/spec_data: spec_data:read_spec_data
prjemian commented 10 months ago

The tiled repo has example configuration files.

But none of them describe a config.yml file that exports a tree of files.

Because the code changed. In short, need to index the directory and collect metadata from the files. That goes into a SQLite file, say catalog.db. Configure the server to use that catalog file to serve the directory of file content. As needed, update the catalog file, either in total or by subdirectory or file content.

prjemian commented 10 months ago

Config file example: https://blueskyproject.io/tiled/explanations/specialized-formats.html#register-the-exporter