Skip to main content

Apache Airflow provider for orchesjob – lightweight idempotent job runner

Project description

airflow-providers-orchesjob

Apache Airflow provider that runs jobs via orchesjob over SSH.

Uses Airflow's Deferrable Operator pattern — the worker slot is released while the remote job runs, and the task resumes automatically when the job reaches a terminal state.

Requirements

  • Apache Airflow ≥ 2.6
  • apache-airflow-providers-ssh ≥ 3.0
  • orchesjob installed on the remote host

Installation

pip install airflow-providers-orchesjob

Setup

Create an SSH Connection in Airflow (Admin → Connections):

Field Value
Conn Id my_ssh (any name)
Conn Type SSH
Host remote host
Username SSH user

Usage

from airflow_providers_orchesjob.operators.orchesjob import OrchesJobOperator

with DAG("my_dag", ...):
    import_task = OrchesJobOperator(
        task_id="daily_import",
        command=["/jobs/import.sh", "--date", "{{ ds }}"],
        ssh_conn_id="my_ssh",
    )

Idempotency

By default, run_key is auto-generated as {dag_id}__{task_id}__{run_id}, which makes each DAG run idempotent: re-triggering the same run returns the existing job if it is still active.

Supply an explicit run_key to control the key yourself:

OrchesJobOperator(
    task_id="import",
    command=["/jobs/import.sh"],
    ssh_conn_id="my_ssh",
    run_key="daily-import-{{ ds }}",
)

Use strict=True to prevent any re-execution with the same key, even after the previous job has finished:

OrchesJobOperator(
    ...,
    strict=True,
)

Parameters

Parameter Type Default Description
command list[str] required Command to run on the remote host
ssh_conn_id str required Airflow SSH Connection ID
run_key str | None auto orchesjob idempotency key
strict bool False Never re-run the same run_key
poll_interval float 30.0 Seconds between status polls
startup_timeout float 60.0 Seconds to wait for job to leave STARTING
orchesjob_home str | None None Override ORCHESJOB_HOME on remote host

Error Handling

Event Airflow behaviour
Job FAILED or LOST AirflowException → honours task retries
startup_timeout exceeded AirflowException → honours task retries
SSH connection failure AirflowException → honours task retries
Job CANCELLED AirflowException

License

MIT

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

airflow_providers_orchesjob-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

airflow_providers_orchesjob-0.1.0-py3-none-any.whl (9.3 kB view details)

Uploaded Python 3

File details

Details for the file airflow_providers_orchesjob-0.1.0.tar.gz.

File metadata

File hashes

Hashes for airflow_providers_orchesjob-0.1.0.tar.gz
Algorithm Hash digest
SHA256 59f224ee1f0e42ad46ce8756efef57f8e2aa866286a0d2ee52cbe34f01ba9d64
MD5 116616b4be78852a8c92837a34d5b8ef
BLAKE2b-256 b92c74aaf2ebcbf9892ad6b5b38d130b31b9c6f093e042d3c3d328d0e2b6f7f1

See more details on using hashes here.

File details

Details for the file airflow_providers_orchesjob-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for airflow_providers_orchesjob-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ef573efa8834841ee1a9304375213400533a324ffc3060f25ecf58a7fe8f970
MD5 c172971bb05879595a8fcf15eeef442b
BLAKE2b-256 fcf7ec4e357a16c8fefbc05ca112dcdfd758447decabbdb8140815e8e65535a5

See more details on using hashes here.

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