Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
146 changes: 73 additions & 73 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,73 +1,73 @@
name: Publish Python Package

on:
push:
branches: [main]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
pull_request:
branches: [main]

jobs:
release-build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH

- name: Build Package with UV
run: |
uv build

- name: Upload Built Package
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/

pypi-publish:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [release-build]
permissions:
id-token: write # OIDC auth for PyPI
contents: read
steps:
- name: Retrieve Built Package
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.4

github-release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [release-build]
permissions:
contents: write
steps:
- name: Retrieve Built Package
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*
tag_name: ${{ github.ref_name }}
name: "Release ${{ github.ref_name }}"
draft: false
prerelease: ${{ contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') || contains(github.ref_name, '-rc') }}
name: Publish Python Package
on:
push:
branches: [main]
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-alpha.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+'
- '[0-9]+.[0-9]+.[0-9]+-rc.[0-9]+'
pull_request:
branches: [main]
jobs:
release-build:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Install UV
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Build Package with UV
run: |
uv build
- name: Upload Built Package
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/
pypi-publish:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [release-build]
permissions:
id-token: write # OIDC auth for PyPI
contents: read
steps:
- name: Retrieve Built Package
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.12.4
github-release:
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs: [release-build]
permissions:
contents: write
steps:
- name: Retrieve Built Package
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: dist/*
tag_name: ${{ github.ref_name }}
name: "Release ${{ github.ref_name }}"
draft: false
prerelease: ${{ contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') || contains(github.ref_name, '-rc') }}
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,10 @@ src/*.egg-info/
**/artifacts/

*.ini
*.env
*.env

# User/Agent Documentation
JOBS_DOCUMENTATION.md
AGENTS.md
.antigravity/
reports/
116 changes: 40 additions & 76 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,126 +14,90 @@ It uses `.dmtri_jobs.json` per host to track async job state and integrates with

---

## Quick Start
## Installation & Setup

You can use `dmtri` in two ways, depending on your preference:

### Option 1: Using `uvx`

You can run commands using:
### 1. Install or Run
You can run `dmtri` directly or install it as a tool:

#### Run without installing (via `uvx`)
```bash
uvx dmtri <command> [options]

uvx dmtri <command>
```

---

### Option 2: Global (Tool-based) — Ideal for global CLI use

#### Install as a global tool
```bash
# Using uv (recommended)
uv tool install dmtri
```

This makes `dmtri` available globally:

```bash
dmtri <command> [options]

# Using pip
pip install dmtri
```

You can update it any time using:
### 2. Configure
Once installed, set up your local configuration directory:

```bash
uv tool upgrade dmtri
dmtri init
```

---

### 2. Configure inventory

Edit the file: `src/inventory/hosts.ini`

Example:

```ini
[seedpsd_nodes]
<SEEDPSD_HOST> ansible_user=<USER> ansible_ssh_pass="<PASSWORD>" ansible_connection=ssh ansible_become=false ansible_ssh_common_args='-o StrictHostKeyChecking=no'
This creates a config folder (e.g., `~/.config/dmtri/` on Linux) with a template `hosts.ini` and all standard playbooks.

[seedpsd_nodes:vars]
seedpsd_dir=/home/<USER>/seedpsd
#### Edit your Inventory
Use `nano` (or any text editor) to fill in your EIDA server details:

[wf_catalogue]
<WFCATALOG_HOST> ansible_user=<USER> ansible_ssh_pass="<PASSWORD>" ansible_connection=ssh ansible_become=false ansible_ssh_common_args='-o StrictHostKeyChecking=no'

[wf_catalogue:vars]
collector_dir=/home/<USER>/Programs/wfcatalogue<VERSION>/wfcatalog/collector2

[ws_availability]
<AVAILABILITY_HOST> ansible_user=<USER> ansible_ssh_pass="<PASSWORD>" ansible_connection=ssh ansible_become=false ansible_ssh_common_args='-o StrictHostKeyChecking=no'
```bash
nano ~/.config/dmtri/hosts.ini
```

[ws_availability:vars]
availability_dir=/home/<USER>/Programs/ws-availability<VERSION>/views
mongo_user=<MONGO_USERNAME>
mongo_pass=<MONGO_PASSWORD>
mongo_authdb=<MONGO_DATABASE>
#### Verify Connectivity
Check if your servers are reachable:

```bash
dmtri doctor
```

---

### 3. Run example jobs
## Usage

By default, this command runs **all refresh playbooks** (seedpsd, wfcatalog, and availability):
### Run Refresh Jobs
Trigger refresh playbooks across your nodes:

```bash
uv run dmtri refresh --network HL --station ATH --starttime 2024-01-01T00:00:00 --endtime 2024-01-02T00:00:00

dmtri refresh --network HL --station ATH --starttime 2024-01-01
```

---

### 4. Track jobs across hosts
### Track Job Status
Monitor the status of asynchronous jobs:

```bash
uv run dmtri track
```

Shows per-host job status:
```
Job ID: j123... Type: seedpsd Station: ATH Status: ✅ Finished
Job ID: manual-... Type: availability Status: ✅ Manual (not tracked)
dmtri track
```

---

### 5. Troubleshooting with `dmtri doctor`
## Customization

Check SSH connectivity to your configured hosts using:
### Local Playbooks
`dmtri init` copies all playbooks to your config directory. You can edit them to change automation logic:

```bash
uv run dmtri doctor
# Location: ~/.config/dmtri/playbooks/
nano ~/.config/dmtri/playbooks/refresh/availability_refresh.yml
```

This uses the Ansible `ping` module to test access to all servers in your inventory.

#### Options
`dmtri` prioritizes these local playbooks over the bundled defaults.

- `--verbose` — Show full output from each host

#### Example
### Inventory Overrides
Override the inventory at runtime:

```bash
uv run dmtri doctor --verbose
dmtri doctor --inventory ./my_custom_hosts.ini
```

If no response is received, ensure:

- You're connected to the VPN (if applicable)
- SSH access is configured correctly in your inventory file
- Host IPs and credentials are reachable and valid
---

### Operation Details
## Operation Details

`dmtri` supports two main operations for both metadata and data: `refresh` and `clean`. These affect the following components:

Expand Down
42 changes: 21 additions & 21 deletions badges/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 6 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,19 @@ dependencies = [
]
readme = "README.md"
requires-python = ">=3.8"
[tool.uv]
dev-dependencies = [
[dependency-groups]
dev = [
"pytest",
"pytest-cov"
]


[project.scripts]
dmtri = "dmtri.cli:main"

[tool.setuptools.package-data]
dmtri = ["data/**/*"]

[build-system]
requires = ["setuptools>=62.0", "wheel"]
build-backend = "setuptools.build_meta"
Loading
Loading