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

Implement --log-config for all server CLI commands. #730

Merged
merged 3 commits into from
Apr 26, 2024

Conversation

danielballan
Copy link
Member

This PR implements --log-config on:

  • tiled serve directory
  • tiled serve catalog
  • tiled serve config (where it would override the config)

(It skips tiled serve demo, which is intentionally bare bones and does not accept many of the other options common to the others.)

Previously --log-config was accepted by tiled serve directory only, and it was then ignored. 🤦 Expand for interactive tests demonstrating that we got it right this time, for each of the above.

$ tiled serve catalog --temp --log-config example_log_config.yml 
Creating catalog database at /tmp/tmpbb9mpn3_/catalog.db
Creating writable catalog data directory at /tmp/tmpbb9mpn3_/data

    Navigate a web browser or connect a Tiled client to:

    http://127.0.0.1:8000?api_key=0596b6db450d8d128197cf8f5e8b00d8e50f0c32788dd40b5245c8ab828e6af0


[2024-04-25T15:13:26.117Z] [-] INFO:     Started server process [137107]
[2024-04-25T15:13:26.118Z] [-] INFO:     Waiting for application startup.
Tiled version 0.1.0a117.dev57+g0cd0407b
[2024-04-25T15:13:26.120Z] [-] INFO:     Application startup complete.
[2024-04-25T15:13:26.121Z] [-] INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
$ tiled serve directory /tmp/data --log-config example_log_config.yml 
Creating catalog database at /tmp/tmpfbf9dqpk/catalog.db

    Navigate a web browser or connect a Tiled client to:

    http://127.0.0.1:8000?api_key=f760c7b4b8dff957b22aa69559fe77b301f20334a42bd7079041bf5103526e26


[2024-04-25T15:15:03.062Z] [-] INFO:     Started server process [137221]
[2024-04-25T15:15:03.062Z] [-] INFO:     Waiting for application startup.
Tiled version 0.1.0a117.dev57+g0cd0407b
[2024-04-25T15:15:03.066Z] [-] INFO:     Application startup complete.
[2024-04-25T15:15:03.066Z] [-] INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)
[2024-04-25T15:15:03.177Z] [9f868d706a9c17a7] INFO:     127.0.0.1:49660 - "GET /api/v1/ HTTP/1.1" 200 OK
[2024-04-25T15:15:03.269Z] [3a0e3028f590fb47] INFO:     127.0.0.1:49660 - "GET /api/v1/metadata/?include_data_sources=false HTTP/1.1" 200 OK
Server is up. Indexing files in /tmp/data...
[2024-04-25T15:15:03.280Z] [283a08dd56c8a025] INFO:     127.0.0.1:49660 - "DELETE /api/v1/nodes/ HTTP/1.1" 200 OK
[2024-04-25T15:15:03.604Z] [b74009411c58cdb1] INFO:     127.0.0.1:49660 - "POST /api/v1/register/ HTTP/1.1" 200 OK
Indexing complete.
 TILED_SINGLE_USER_API_KEY=secret tiled serve config example_configs/small_single_user_demo.yml --log-config example_log_config.yml 
Using configuration from /home/dallan/Repos/bnl/tiled/example_configs/small_single_user_demo.yml
[2024-04-25T15:16:59.403Z] [-] INFO:     Started server process [137639]
[2024-04-25T15:16:59.403Z] [-] INFO:     Waiting for application startup.
Tiled version 0.1.0a117.dev57+g0cd0407b
[2024-04-25T15:16:59.404Z] [-] INFO:     Application startup complete.
[2024-04-25T15:16:59.404Z] [-] INFO:     Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)

This PR also adds example_log_config.yml to the repo root

@Kezzsim
Copy link
Contributor

Kezzsim commented Apr 26, 2024

Testing for thoroughness and editing the code:

  1. Test with tiled serve catalog and we see the correlation-ID being inserted
    image
  2. Insert something into the string template and test with serve directory, cause an error
    image
  3. Test with serve config using the toy auth config and it works
    image

All of these work find and wrap the error messages successfully, I'm going to merge it.

@Kezzsim Kezzsim merged commit f24b392 into bluesky:main Apr 26, 2024
9 checks passed
@danielballan danielballan deleted the log-config branch April 26, 2024 19:16
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 this pull request may close these issues.

2 participants