Skip to main content

Jordan CLI — use Jordan without writing Python code.

Project description

jordan_cli

Command-line interface for Jordan — lets you use Jordan from shell scripts and pipelines without writing Python code.

Installation

pip install jordan_cli
# or from source:
pip install -e libraries/cli

This installs two commands: jordan (passive-client CLI) and jordan-admin (operator/admin CLI).

Quick start

# 1. Register with the server (creates a root task)
jordan register --server http://localhost:5000/jordan/

# 2. Send status updates during execution
jordan status "Starting data processing"
jordan progress "42"
jordan status "Done" --type success

# 3. Wait for an operator action (blocks up to 60 s)
jordan action --wait --timeout 60

# 4. Finish
jordan complete

Session file

jordan register writes a .jordan_session file in the current directory. All subsequent commands read from this file — no need to pass credentials on every call.

Add .jordan_session to your .gitignore.

Tasks

Every Jordan client is built around a task hierarchy. When you jordan register, the server creates a root task whose ID is stored in .jordan_session. All commands (status, progress, action, complete, error) operate on this root task by default.

For more granular tracking you can create sub-tasks with jordan task-create and target them with --task-id:

# Create two sub-tasks under the root; capture their IDs
TASK_A=$(jordan task-create "extract")
TASK_B=$(jordan task-create "load")

# Report progress per sub-task
jordan progress "10" --task-id "$TASK_A"
jordan progress "0"  --task-id "$TASK_B"

# Mark sub-tasks done independently (no unregister)
jordan complete --task-id "$TASK_A"
jordan complete --task-id "$TASK_B"

# Finish the root client
jordan complete

Sub-tasks can themselves be parents: pass --task-id PARENT_ID to jordan task-create to nest tasks further.

Commands

jordan register

jordan register --server URL [--name NAME]

Registers with the Jordan server and saves the session locally. The server creates a root task and returns its ID, which is stored in .jordan_session.

Option Default Description
--server (required) Server base URL (e.g. http://localhost:5000/jordan/)
--name default-client Display name for this client

jordan task-create

jordan task-create NAME [--task-id PARENT_ID]

Creates a sub-task and prints its task ID. By default the sub-task is created under the root task from the session. Pass --task-id to nest it under a different parent.

Option Default Description
--task-id root task Parent task ID
TASK_ETL=$(jordan task-create "etl-pipeline")
TASK_REPORT=$(jordan task-create "reporting" --task-id "$TASK_ETL")

jordan status

jordan status MESSAGE [--type TYPE] [--task-id TASK_ID]

Sends a status update. Prints the statusId on success.

Option Default Description
--type general One of: general, progress, success, failure
--task-id root task Target a specific sub-task

jordan progress

jordan progress VALUE [--task-id TASK_ID]

Shorthand for jordan status VALUE --type progress.

Option Default Description
--task-id root task Target a specific sub-task
jordan progress "75"
jordan progress "75%" --task-id 124

jordan action

jordan action [--wait] [--timeout SECONDS] [--interval SECONDS] [--task-id TASK_ID]

Reads the next pending action from the server and prints it as JSON.

{
  "messageId": "abc123",
  "actionName": "SEND_EMAIL",
  "placeholders": {
    "recipient": "user@example.com"
  }
}
Option Default Description
--wait false Block until an action arrives
--timeout 60 Max wait time in seconds (used with --wait)
--interval 2.0 Polling interval in seconds (used with --wait)
--task-id root task Read an action sent to a specific sub-task

Exits with code 1 if no action is pending (or timeout is reached).

Shell script example — react on an action:

result=$(jordan action --wait --timeout 120)
action=$(echo "$result" | python3 -c "import sys,json; print(json.load(sys.stdin)['actionName'])")

if [ "$action" = "SEND_REPORT" ]; then
    send_report.sh
fi

jordan complete

jordan complete [--task-id TASK_ID]

Marks a task as complete.

  • Without --task-id: marks the root task complete, unregisters the client, and deletes .jordan_session.
  • With --task-id: marks only that sub-task complete. The session and root task are left untouched.

jordan error

jordan error [MESSAGE] [--task-id TASK_ID]

Marks a task as failed, optionally sending an error status message.

  • Without --task-id: marks the root task failed, unregisters the client, and deletes .jordan_session.
  • With --task-id: marks only that sub-task failed. The session and root task are left untouched.
jordan error "Unexpected exit code from ffmpeg"
jordan error "Load step failed" --task-id 124

jordan unregister

jordan unregister

Unregisters the root client from the server and deletes .jordan_session without changing any task state.


Admin CLI (jordan-admin)

jordan-admin is the operator-side counterpart: it talks to the Jordan server's admin endpoints to monitor passive clients and send them actions. No session file is needed — pass the server URL via --server or the JORDAN_SERVER environment variable.

export JORDAN_SERVER=http://localhost:5000/jordan/

# List all registered clients and their sub-tasks
jordan-admin list

# Send an action to client 123 (or any sub-task ID)
jordan-admin send 123 SEND_EMAIL --param recipient=user@example.com

# Watch live status updates from task 124
jordan-admin watch 124

# Check the state machine history of message 456
jordan-admin message-status 456

jordan-admin list

jordan-admin list [--server URL]

Lists all registered passive clients with their sub-tasks and current states.

[123] my-script  state=REGISTERED
  task [124] extract  state=COMPLETE  progress=-
  task [125] load     state=RUNNING   progress=42

jordan-admin send

jordan-admin send TASK_ID ACTION_NAME [-p key=value ...] [--server URL]

Sends an action (message) to a task. TASK_ID can be the root client ID or any sub-task ID. The action name must match one declared by the client at registration.

Option Default Description
--param / -p (none) Parameter as key=value (repeatable)
--server $JORDAN_SERVER Server base URL
jordan-admin send 123 SEND_REPORT
jordan-admin send 124 SEND_EMAIL -p recipient=ops@example.com -p subject="Alert"

Prints the assigned message ID on success.


jordan-admin watch

jordan-admin watch TASK_ID [--interval SECONDS] [--lines N] [--server URL]

Polls the server for new status updates from the given task and prints them as they arrive. Press Ctrl+C to stop. Works on both root tasks and sub-tasks.

Option Default Description
--interval 3.0 Polling interval in seconds
--lines 10 Number of status lines fetched per poll
--server $JORDAN_SERVER Server base URL
Watching client 123... (Ctrl+C to stop)
[1751234567] [general] Starting data processing
[1751234570] [progress] 42
[1751234590] [success] Export complete

jordan-admin message-status

jordan-admin message-status MESSAGE_ID [--server URL]

Displays the raw JSON for a message, including its full state machine audit trail.

{
  "messageId": 456,
  "action": { "actionName": "SEND_EMAIL", "placeholders": { "recipient": "ops@example.com" } },
  "audit": [
    { "timestamp": 1751234500, "state": "SERVER_RECEIVED" },
    { "timestamp": 1751234503, "state": "MESSAGE_DELIVERED" },
    { "timestamp": 1751234504, "state": "CLIENT_RECEIVED" },
    { "timestamp": 1751234510, "state": "MESSAGE_PROCESSED" }
  ]
}

Full shell script example

#!/usr/bin/env bash
set -e

jordan register --server http://localhost:5000/jordan/ --name "nightly-export"

# Create sub-tasks for finer-grained tracking
TASK_EXTRACT=$(jordan task-create "extract")
TASK_LOAD=$(jordan task-create "load")

jordan status "Connecting to database" --task-id "$TASK_EXTRACT"
run_extract.sh && {
    jordan status "Extracted" --type success --task-id "$TASK_EXTRACT"
    jordan complete --task-id "$TASK_EXTRACT"
} || {
    jordan error "Extract failed" --task-id "$TASK_EXTRACT"
    jordan error "Pipeline aborted"
    exit 1
}

jordan status "Loading data" --task-id "$TASK_LOAD"
run_load.sh && {
    jordan status "Loaded" --type success --task-id "$TASK_LOAD"
    jordan complete --task-id "$TASK_LOAD"
} || {
    jordan error "Load failed" --task-id "$TASK_LOAD"
    jordan error "Pipeline aborted"
    exit 1
}

jordan complete

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jordan_cli-1.0.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jordan_cli-1.0.0-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

File details

Details for the file jordan_cli-1.0.0.tar.gz.

File metadata

  • Download URL: jordan_cli-1.0.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jordan_cli-1.0.0.tar.gz
Algorithm Hash digest
SHA256 81131a16ba2d953380a356c0b9c73139c074207c61d958196a222fff8156aa8b
MD5 93f74188ca670efc42b8e02a5a968b2f
BLAKE2b-256 7f11e14b4e8a418a264924a775919cfd12168646d41d0f31fc5bfa0c01ab8491

See more details on using hashes here.

Provenance

The following attestation bundles were made for jordan_cli-1.0.0.tar.gz:

Publisher: release-cli-python.yml on Mara-tech/jordan

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file jordan_cli-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: jordan_cli-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for jordan_cli-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4db6b5d63aa52afa7aa3bb4f3d95308eed8ed1b758df36e7d0778ea43a6f403
MD5 4a9e098ddde87317189abb22bde48d05
BLAKE2b-256 de327ac3a12753d1e2eea92ec70a8b810d5d3db92c5e699504572d1aff8c1f0f

See more details on using hashes here.

Provenance

The following attestation bundles were made for jordan_cli-1.0.0-py3-none-any.whl:

Publisher: release-cli-python.yml on Mara-tech/jordan

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page