Skip to main content

A script that starts and stops Tango Device Server(s)

Project description

tango-takeoff

A tool that can find, start and stop Tango Device Servers. It's like Astor for the command line.

In general, the tool is explaining itself. Run it and look at the output.

Installation

tango-takeoff is on PyPI and conda-forge. Install it with your preferred package manager: pip, uv, conda or pixi.

As it's intended to be used as a script, we recommend installing it globally. With uv, do:

uv tool install tango-takeoff

And with pixi:

pixi global install tango-takeoff

Usage

The tool depends on the TANGO_HOST environment variable.

Help

> takeoff --help
usage: takeoff [-h] {find,up,down,restart} ...

Start (up), stop (down) or restart (restart) Tango Device Servers

positional arguments:
  {find,up,start,down,stop,restart}
    find                Finds servers based on terms and shows the 'dry run' version of what will be used in 'up' and 'down'
    up (start)          Bring servers up based on terms
    down (stop)         Bring servers down based on terms
    restart             Restart servers based on terms

options:
  -h, --help      show this help message and exit

Find

> takeoff find --help
usage: takeoff find [-h] [--json] [--default-host DEFAULT_HOST] [-v] servers [servers ...]

positional arguments:
  servers               A name or search term of a server, use * for wildcard in the end of the name. Use the format [host,]<server-name>

  options:
    -h, --help            show this help message and exit
    --json                Output structured as JSON (default: False)
    --default-host DEFAULT_HOST
                          Default host for Tango device servers (default: None)
    -v, --verbose         Set the trace level. Can be used in count way: -vv or --verbose --verbose (default: None)

Up / Start

> takeoff up --help
usage: takeoff up [-h] [--json] [--default-host DEFAULT_HOST] [-v] [-t RUNNING_TIMEOUT] [-s STARTER_TIMEOUT] [-d] servers [servers ...]

positional arguments:
  servers               A name or search term of a server, use * for wildcard in the end of the name. Use the format [host,]<server-name>[,<level>]

options:
  -h, --help            show this help message and exit
  --json                Output structured as JSON (default: False)
  --default-host DEFAULT_HOST
                        Default host for Tango device servers (default: None)
  -v, --verbose         Set the trace level. Can be used in count way: -vv or --verbose --verbose (default: None)
  -t RUNNING_TIMEOUT, --timeout RUNNING_TIMEOUT
                        Time to wait for a server to be running (in seconds) (default: 60)
  -s STARTER_TIMEOUT, --starter-timeout STARTER_TIMEOUT
                        Time to wait for starter if it's not running (in seconds) (default: 10)
  -d, --dry-run         outputs the servers with the details that will take effect by the command (default: False)

Down / Stop

> takeoff down --help
usage: takeoff down [-h] [--json] [--default-host DEFAULT_HOST] [-v] [-f] [-k KILL_TIMEOUT] [-s STARTER_TIMEOUT] [-d] servers [servers ...]

positional arguments:
  servers               A name or search term of a server, use * for wildcard in the end of the name. Use the format [host,]<server-name>

options:
  -h, --help            show this help message and exit
  --json                Output structured as JSON (default: False)
  --default-host DEFAULT_HOST
                        Default host for Tango device servers (default: None)
  -v, --verbose         Set the trace level. Can be used in count way: -vv or --verbose --verbose (default: None)
  -f, --force           Force kill servers (default: False)
  -k KILL_TIMEOUT, --kill-timeout KILL_TIMEOUT
                        Time before force killing (in seconds) (default: 30)
  -s STARTER_TIMEOUT, --starter-timeout STARTER_TIMEOUT
                        Time to wait for starter if it's not running (in seconds) (default: 10)
  -d, --dry-run         outputs the servers with the details that will take effect by the command (default: False)

Restart

> takeoff restart --help
usage: takeoff restart [-h] [--json] [--default-host DEFAULT_HOST] [-v] [-f] [-k KILL_TIMEOUT] [-t RUNNING_TIMEOUT] [-s STARTER_TIMEOUT] [-d] [-w WAIT_AFTER_STOP] servers [servers ...]

positional arguments:
  servers               A name or search term of a server, use * for wildcard in the end of the name. Use the format [host,]<server-name>

options:
  -h, --help            show this help message and exit
  --json                Output structured as JSON (default: False)
  --default-host DEFAULT_HOST
                        Default host for Tango device servers (default: None)
  -v, --verbose         Set the trace level. Can be used in count way: -vv or --verbose --verbose (default: None)
  -f, --force           Force kill servers (default: False)
  -k KILL_TIMEOUT, --kill-timeout KILL_TIMEOUT
                        Time before force killing (in seconds) (default: 30)
  -t RUNNING_TIMEOUT, --timeout RUNNING_TIMEOUT
                        Time to wait for a server to be running (in seconds) (default: 60)
  -s STARTER_TIMEOUT, --starter-timeout STARTER_TIMEOUT
                        Time to wait for starter if it's not running (in seconds) (default: 10)
  -d, --dry-run         outputs the servers with the details that will take effect by the command (default: False)
  -w WAIT_AFTER_STOP, --wait-after-stop WAIT_AFTER_STOP
                        Time to wait between stop / start (in seconds) (default: 1)

Testing

To test locally, you should use pixi.

  1. Run pixi install -e servers to install the servers environment (including Starter, TangoTest and UniversalTest that are used during the tests).
  2. Run pixi run pytest to launch the test suite. The tests use pytango-db fixtures and will automatically start a database and Starter.

To run takeoff yourself from this repo:

  1. Start a Tango PyDatabaseds by running pixi run pydb. You could use your own instance if you prefer. Press CTRL-C to stop it.

  2. export TANGO_HOST to point to your tango database (127.0.0.1:10000 if you used the previous steps).

  3. Start Starter by running pixi run starter. This will automatically create the required Tango devices and install some servers for testing purpose:

    • TangoTest
    • UniversalTest
    • SlowToStart: a dummy server that takes 7 seconds to start
    • SlowToStop: a dummy server that takes 7 seconds to stop
    • FailToStart: a dummy server that can't start (raises an exception in init_device)

You can manually test different scenarios by running pixi run takeoff and passing any argument you want. Or run pixi shell and then takeoff directly.

For convenience, you have 2 tasks predefined:

  • pixi run up to start all the servers
  • pixi run down to stop all the servers

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

tango_takeoff-3.1.1.tar.gz (61.3 kB view details)

Uploaded Source

Built Distribution

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

tango_takeoff-3.1.1-py3-none-any.whl (29.4 kB view details)

Uploaded Python 3

File details

Details for the file tango_takeoff-3.1.1.tar.gz.

File metadata

  • Download URL: tango_takeoff-3.1.1.tar.gz
  • Upload date:
  • Size: 61.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for tango_takeoff-3.1.1.tar.gz
Algorithm Hash digest
SHA256 7ade4c136f5a19534a41dc5b23b344a5e1300cba134cb428f929d831661dca3d
MD5 854075991e3f8be8988fdedb71d0e85b
BLAKE2b-256 a101b764d72a641f674f556824484eedac47284acc2eea2c099fe756ac8b9724

See more details on using hashes here.

File details

Details for the file tango_takeoff-3.1.1-py3-none-any.whl.

File metadata

  • Download URL: tango_takeoff-3.1.1-py3-none-any.whl
  • Upload date:
  • Size: 29.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.12.12

File hashes

Hashes for tango_takeoff-3.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8b92e26e6ef674310cd710bb7c2694c8df79a5b31ec292df9aa410f88400eb9e
MD5 1f944b11d459c5a687dbf51e1baec665
BLAKE2b-256 487bef3f755b99007f4d3706986198ebfa6eea1e03997242dd52bc36fe2da2b7

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