From a58a747c6b4cf49d10052cb14fc5979a54ad5c6b Mon Sep 17 00:00:00 2001 From: Meng Zhang Date: Thu, 2 May 2024 17:16:14 -0700 Subject: [PATCH] chore: add coloreye for ease of debugging --- .github/workflows/release.yml | 18 +++++------ Cargo.lock | 60 +++++++++++++++++++++++++++++++++++ crates/tabby/Cargo.toml | 5 +-- crates/tabby/src/main.rs | 3 ++ docker/Dockerfile.cuda | 4 +-- docker/Dockerfile.rocm | 4 +-- 6 files changed, 79 insertions(+), 15 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 18d6789aaa2c..2b40b60b8a77 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,50 +41,50 @@ jobs: - os: macos-latest target: aarch64-apple-darwin binary: aarch64-apple-darwin - build_args: --features prod + build_args: --no-default-features --features prod - os: dimerun-k3-ubuntu2204 target: x86_64-unknown-linux-gnu binary: x86_64-manylinux2014 container: quay.io/pypa/manylinux2014_x86_64 - build_args: --features static-ssl,prod + build_args: --no-default-features --features static-ssl,prod - os: dimerun-k3-ubuntu2204 target: x86_64-unknown-linux-gnu binary: x86_64-manylinux2014-cuda117 container: sameli/manylinux2014_x86_64_cuda_11.7 - build_args: --features static-ssl,cuda,prod + build_args: --no-default-features --features static-ssl,cuda,prod - os: dimerun-k3-ubuntu2204 target: x86_64-unknown-linux-gnu binary: x86_64-manylinux2014-cuda122 container: sameli/manylinux2014_x86_64_cuda_12.2 - build_args: --features static-ssl,cuda,prod + build_args: --no-default-features --features static-ssl,cuda,prod - os: dimerun-k3-ubuntu2204 target: x86_64-unknown-linux-gnu binary: x86_64-manylinux2014-vulkan container: quay.io/pypa/manylinux2014_x86_64 - build_args: --features static-ssl,vulkan,prod + build_args: --no-default-features --features static-ssl,vulkan,prod vulkan_sdk: '1.3.239.0' - os: windows-latest target: x86_64-pc-windows-msvc binary: x86_64-windows-msvc - build_args: --features prod + build_args: --no-default-features --features prod ext: .exe - os: windows-latest target: x86_64-pc-windows-msvc binary: x86_64-windows-msvc-vulkan ext: .exe - build_args: --features vulkan,prod + build_args: --no-default-features --features vulkan,prod vulkan_sdk: '1.3.280.0' - os: windows-latest target: x86_64-pc-windows-msvc binary: x86_64-windows-msvc-cuda117 ext: .exe - build_args: --features cuda,prod + build_args: --no-default-features --features cuda,prod windows_cuda: '11.7.1' - os: windows-latest target: x86_64-pc-windows-msvc binary: x86_64-windows-msvc-cuda122 ext: .exe - build_args: --features cuda,prod + build_args: --no-default-features --features cuda,prod windows_cuda: '12.2.0' env: diff --git a/Cargo.lock b/Cargo.lock index 2b8c4d948dce..c4b7fa1c4cec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -774,6 +774,33 @@ dependencies = [ "unicode-width", ] +[[package]] +name = "color-eyre" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55146f5e46f237f7423d74111267d4597b59b0dad0ffaf7303bce9945d843ad5" +dependencies = [ + "backtrace", + "color-spantrace", + "eyre", + "indenter", + "once_cell", + "owo-colors", + "tracing-error", +] + +[[package]] +name = "color-spantrace" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd6be1b2a7e382e2b98b43b2adcca6bb0e465af0bdd38123873ae61eb17a72c2" +dependencies = [ + "once_cell", + "owo-colors", + "tracing-core", + "tracing-error", +] + [[package]] name = "colorchoice" version = "1.0.0" @@ -1375,6 +1402,16 @@ dependencies = [ "pin-project-lite", ] +[[package]] +name = "eyre" +version = "0.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd915d99f24784cdc19fd37ef22b97e3ff0ae756c7e492e9fbfe897d61e2aec" +dependencies = [ + "indenter", + "once_cell", +] + [[package]] name = "fastdivide" version = "0.4.0" @@ -2271,6 +2308,12 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "indenter" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" + [[package]] name = "indexmap" version = "1.9.3" @@ -3303,6 +3346,12 @@ dependencies = [ "stable_deref_trait", ] +[[package]] +name = "owo-colors" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1b04fb49957986fdce4d6ee7a65027d55d4b6d2265e5848bbb507b58ccfdb6f" + [[package]] name = "package-lock-json-parser" version = "0.4.0" @@ -4958,6 +5007,7 @@ dependencies = [ "cached", "chrono", "clap", + "color-eyre", "futures", "http-api-bindings", "hyper 1.3.1", @@ -5783,6 +5833,16 @@ dependencies = [ "valuable", ] +[[package]] +name = "tracing-error" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +dependencies = [ + "tracing", + "tracing-subscriber 0.3.17", +] + [[package]] name = "tracing-futures" version = "0.2.5" diff --git a/crates/tabby/Cargo.toml b/crates/tabby/Cargo.toml index bc737436615a..123afd7c7b41 100644 --- a/crates/tabby/Cargo.toml +++ b/crates/tabby/Cargo.toml @@ -6,7 +6,7 @@ authors.workspace = true homepage.workspace = true [features] -default = ["ee", "experimental-http"] +default = ["ee", "dep:color-eyre"] ee = ["dep:tabby-webserver"] cuda = ["llama-cpp-bindings/cuda"] rocm = ["llama-cpp-bindings/rocm"] @@ -16,7 +16,7 @@ experimental-http = ["dep:http-api-bindings"] # architecture, enable this feature to compile OpenSSL as part of the build. # See https://docs.rs/openssl/#vendored for more. static-ssl = ['openssl/vendored'] -prod = ['tabby-webserver/prod-db'] +prod = ["ee", 'tabby-webserver/prod-db'] [dependencies] tabby-common = { path = "../tabby-common" } @@ -58,6 +58,7 @@ axum-prometheus = "0.6" uuid.workspace = true cached = { workspace = true, features = ["async"] } parse-git-url = "0.5.1" +color-eyre = { version = "0.6.3", optional = true } [dependencies.openssl] optional = true diff --git a/crates/tabby/src/main.rs b/crates/tabby/src/main.rs index e62beb54a9a4..0f79b8442fa2 100644 --- a/crates/tabby/src/main.rs +++ b/crates/tabby/src/main.rs @@ -127,6 +127,9 @@ impl Device { #[tokio::main] async fn main() { + #[cfg(feature = "color-eyre")] + color_eyre::install().expect("Must be able to install color_eyre"); + let cli = Cli::parse(); init_logging(); diff --git a/docker/Dockerfile.cuda b/docker/Dockerfile.cuda index ed789d446684..5b2b85e5de26 100644 --- a/docker/Dockerfile.cuda +++ b/docker/Dockerfile.cuda @@ -38,12 +38,12 @@ COPY . . RUN --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/root/workspace/target \ - cargo build --features cuda,prod --release --package tabby && \ + cargo build --no-default-features --features cuda,prod --release --package tabby && \ cp target/release/tabby /opt/tabby/bin/ RUN --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/root/workspace/target \ - cargo build --features prod --release --package tabby && \ + cargo build --no-default-features --features prod --release --package tabby && \ cp target/release/tabby /opt/tabby/bin/tabby-cpu FROM ${BASE_CUDA_RUN_CONTAINER} as runtime diff --git a/docker/Dockerfile.rocm b/docker/Dockerfile.rocm index 61e0640239e6..232373498ece 100644 --- a/docker/Dockerfile.rocm +++ b/docker/Dockerfile.rocm @@ -38,12 +38,12 @@ COPY . . RUN --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/root/workspace/target \ - cargo build --features rocm,prod --release --package tabby && \ + cargo build --no-default-features --features rocm,prod --release --package tabby && \ cp target/release/tabby /opt/tabby/bin/ RUN --mount=type=cache,target=/usr/local/cargo/registry \ --mount=type=cache,target=/root/workspace/target \ - cargo build --features prod --release --package tabby && \ + cargo build --no-default-features --features prod --release --package tabby && \ cp target/release/tabby /opt/tabby/bin/tabby-cpu FROM ${BASE_ROCM_RUN_CONTAINER} AS runtime