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

fix(cli): Readiness check fixes and grouping the per DB checks #469

Merged
merged 10 commits into from
Oct 29, 2024
Merged
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ jobs:
CARGO: cargo
CARGO_BUILD_TARGET: ${{ matrix.job.target }}
PYAPP_REPO: pyapp
PYAPP_VERSION: v0.23.0
PYAPP_VERSION: v0.24.0
PYAPP_PYTHON_VERSION: "3.12"
PYAPP_PROJECT_FEATURES: oracle,postgres,mssql,mysql,server
PYAPP_DISTRIBUTION_EMBED: "1"
Expand Down
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ exclude: "^docs/conf.py"

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
Expand All @@ -32,7 +32,7 @@ repos:

# Ruff replaces black, flake8, autoflake and isort
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.5.6" # make sure this is always consistent with hatch configs
rev: "v0.7.1" # make sure this is always consistent with hatch configs
hooks:
- id: ruff
args: [--config, ./pyproject.toml]
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ dma = "dma.cli.main:app"

[build-system]
build-backend = "hatchling.build"
requires = ["hatchling", "nodeenv"]
requires = ["hatchling"]

[tool.hatch.metadata]
# direct dependency references, e.g `pip @ git+https://github.com/pypa/pip.git@master`
Expand Down
2 changes: 1 addition & 1 deletion scripts/collector/sqlserver/dmaSQLServerPerfmonDataset.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -722,4 +722,4 @@ elseif ($operation.ToLower() -eq "status") {
}
else {
Write-Output "Operation $operation specified is invalid"
}
}
56 changes: 56 additions & 0 deletions scripts/intall-hatch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#!/bin/bash

# --- Constants ---
BASE_URL="https://github.com/pypa/hatch/releases/latest/download"
EXTRACT_CMD="tar -xzf"

# --- Handle Optional Installation Directory ---
INSTALL_DIR="$1" # Default: current directory
if [[ -n "$INSTALL_DIR" ]]; then
if [[ ! -d "$INSTALL_DIR" ]]; then # Check if directory exists
INSTALL_DIR="$HOME/.local/bin"
echo "Error: Invalid install directory '$INSTALL_DIR'"
exit 1
fi
INSTALL_DIR=$(realpath "$INSTALL_DIR") # Get absolute path
fi

# --- Determine Platform ---
PLATFORM=$(uname -s)
MACHINE=$(uname -m)
FILE_EXT="tar.gz"

if [[ $PLATFORM == "Darwin" ]]; then
PLATFORM_NAME="apple-darwin"
elif [[ $PLATFORM == "Linux" ]]; then
PLATFORM_NAME="unknown-linux-gnu"
if [[ $MACHINE == "aarch64" ]]; then
MACHINE="aarch64"
fi
elif [[ $PLATFORM == "Windows" ]]; then
PLATFORM_NAME="pc-windows-msvc"
FILE_EXT="zip"
EXTRACT_CMD="unzip"
else
echo "Unsupported platform: $PLATFORM"
exit 1
fi

# --- Construct File Name and URL ---
FILENAME="hatch-$MACHINE-$PLATFORM_NAME.$FILE_EXT"
URL="$BASE_URL/$FILENAME"

# --- Download and Extract ---
echo "Downloading Hatch binary: $FILENAME"
curl -L -o "$FILENAME" "$URL"

echo "Extracting to '$INSTALL_DIR'..."
$EXTRACT_CMD "$FILENAME" -C "$INSTALL_DIR" # Extract to install directory
rm "$FILENAME" # Remove archive

HATCH_BINARY="$INSTALL_DIR/hatch" # Path to the extracted binary
if [[ -x "$HATCH_BINARY" ]]; then
echo "Hatch binary successfully installed at '$HATCH_BINARY'"
else
echo "Error: Hatch binary not found or not executable."
fi
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ with src as (
r.usesysid,
r.usename,
r.application_name,
r.client_addr,
host(r.client_addr) as client_addr,
r.client_hostname,
r.client_port,
r.backend_start,
Expand Down
2 changes: 1 addition & 1 deletion src/dma/collector/sql/sources/postgres/init.sql
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
limitations under the License.
*/
-- name: init-get-db-version$
select current_setting('server_version_num')::VARCHAR as db_version;
select current_setting('server_version')::VARCHAR as db_version;

-- name: init-get-execution-id$
select 'postgres_' || current_setting('server_version_num') || '_' || to_char(current_timestamp, 'YYYYMMDDHH24MISSMS') as execution_id;
Expand Down
Loading
Loading