-
Notifications
You must be signed in to change notification settings - Fork 20
Ops: Usage
duffy --help
The rewritten version of Duffy provides a lot of functionality conveniently accessible from one command line application:
- Serve the primary web application
- Serve the legacy web application
- Run Celery workers to process backend tasks
- Administrate tenants
- Configuration
- Set up the database initially
- Migrate the database schema
- Query the API from the command line
- Python debugging shell
Usage: duffy [OPTIONS] COMMAND [ARGS]...
Options:
-l, --loglevel [critical|error|warning|info|debug|trace]
Set the log level.
-c, --config FILE_OR_DIR Read configuration from the specified YAML
files or directories instead of the default
paths (/etc/duffy, /home/nils/.config/duffy)
--version Show the version and exit.
--help Show this message and exit.
Commands:
admin Administrate Duffy tenants.
client Command line client for the Duffy API.
config Check and dump configuration.
dev-shell Run an interactive shell.
migration Handle database migrations.
serve Run the Duffy web application server.
serve-legacy Serve the Duffy Metaclient for Legacy Support app.
setup-db Create tables from the database model.
worker Start a Celery worker to process backend tasks.
duffy serve --help
The primary web server is the main interface with which clients can connect to Duffy and perform tasks like create a session, request baremetal or virtual nodes etc. The server can be started up using the aforementioned command by providing parameters like host address, port number, log level etc. These variables can either be passed as options appended to a command or be listed under the app
section of the YAML-based configuration file.
Usage: duffy serve [OPTIONS]
Run the Duffy web application server.
Duffy is the middle layer running ci.centos.org that manages the
provisioning, maintenance, teardown and rebuild of the Nodes (physical
hardware and virtual machines) that are used to run the tests in the CI
Cluster.
Options:
--reload / --no-reload Automatically reload if the code is changed.
-H, --host TEXT Set the host address to listen on.
-p, --port INTEGER RANGE Set the port value. [1<=x<=65535]
--help Show this message and exit.
duffy serve-legacy --help
The legacy web server acts as an intermediate between users of the old Duffy API and the more feature-rich current version. Clients can can use the legacy protocol to connect to the endpoints they're used to. to do the same tasks that they could in the primary interface with minimal changes to the workflow. As like the primary interface, this command can be customized with the use of appended options or as variables under the metaclient
section of the YAML-based configuration file.
Usage: duffy serve-legacy [OPTIONS]
Serve the Duffy Metaclient for Legacy Support app.
Duffy is the middle layer running ci.centos.org that manages the
provisioning, maintenance and teardown / rebuild of the Nodes (physical
hardware for now, VMs coming soon) that are used to run the tests in the CI
Cluster.
This metaclient exposes older endpoints for legacy support and connects them
to the path operations introduced by the newer version of the Duffy
endpoint, until the support for the older endpoints is deprecated.
Options:
--reload / --no-reload Automatically reload if the code is changed.
-H, --host TEXT Set the host address to listen on.
-p, --port INTEGER RANGE Set the port value. [1<=x<=65535]
-D, --dest TEXT Set the destination address of Duffy deployment.
--help Show this message and exit.
duffy worker --help
This command is a thin wrapper to run Celery task workers with the Duffy configuration applied. Detailed information about the command line arguments can be found in the respective Celery documentation.
Usage: duffy worker [OPTIONS]
Start worker instance.
Examples -------- $ celery --app=proj worker -l INFO $ celery -A proj worker
-l INFO -Q hipri,lopri $ celery -A proj worker --concurrency=4 $ celery -A
proj worker --concurrency=1000 -P eventlet $ celery worker --autoscale=10,0
Worker Options:
-n, --hostname HOSTNAME Set custom hostname (e.g., 'w1@%%h').
Expands: %%h (hostname), %%n (name) and %%d,
(domain).
-D, --detach Start worker as a background process.
-S, --statedb PATH Path to the state database. The extension
'.db' may be appended to the filename.
-l, --loglevel [DEBUG|INFO|WARNING|ERROR|CRITICAL|FATAL]
Logging level.
-O [default|fair] Apply optimization profile.
--prefetch-multiplier <prefetch multiplier>
Set custom prefetch multiplier value for
this worker instance.
Pool Options:
-c, --concurrency <concurrency>
Number of child processes processing the
queue. The default is the number of CPUs
available on your system.
-P, --pool [prefork|eventlet|gevent|solo|processes|threads]
Pool implementation.
-E, --task-events, --events Send task-related events that can be
captured by monitors like celery events,
celerymon, and others.
--time-limit FLOAT Enables a hard time limit (in seconds
int/float) for tasks.
--soft-time-limit FLOAT Enables a soft time limit (in seconds
int/float) for tasks.
--max-tasks-per-child INTEGER Maximum number of tasks a pool worker can
execute before it's terminated and replaced
by a new worker.
--max-memory-per-child INTEGER Maximum amount of resident memory, in KiB,
that may be consumed by a child process
before it will be replaced by a new one. If
a single task causes a child process to
exceed this limit, the task will be
completed and the child process will be
replaced afterwards. Default: no limit.
Queue Options:
--purge, --discard
-Q, --queues COMMA SEPARATED LIST
-X, --exclude-queues COMMA SEPARATED LIST
-I, --include COMMA SEPARATED LIST
Features:
--without-gossip
--without-mingle
--without-heartbeat
--heartbeat-interval INTEGER
--autoscale <MIN WORKERS>, <MAX WORKERS>
Embedded Beat Options:
-B, --beat
-s, --schedule-filename, --schedule TEXT
--scheduler TEXT
Daemonization Options:
-f, --logfile TEXT
--pidfile TEXT
--uid TEXT
--uid TEXT
--gid TEXT
--umask TEXT
--executable TEXT
Options:
--help Show this message and exit.
duffy admin --help
The admin
command lets you manage Duffy tenants.
Usage: duffy admin [OPTIONS] COMMAND [ARGS]...
Administrate Duffy tenants.
Options:
--help Show this message and exit.
Commands:
create-tenant Create a new tenant.
list-tenants List tenants.
retire-tenant Retire or unretire a tenant.
show-tenant Show a tenant.
update-tenant Update a tenant.
To understand how the config command makes use of a YAML-based configuration, please refer to the configuration documentation.
duffy config --help
Duffy allows spreading configuration over multiple configuration files and/or directories. This command lets you inspect and validate the resulting configuration structure.
Usage: duffy config [OPTIONS] COMMAND [ARGS]...
Check and dump configuration.
Options:
--help Show this message and exit.
Commands:
check Validate configuration structure.
dump Dump merged configuration.
duffy migration --help
This command encapsulates migrating between different versions of the Duffy database schema: creating of migration scripts/skeletons and applying them to upgrade/downgrade the database schema and contents.
Usage: duffy migration [OPTIONS] COMMAND [ARGS]...
Handle database migrations.
Options:
--help Show this message and exit.
Commands:
create Create a new database schema migration.
db-version Show the current version of the database schema.
downgrade Downgrade the database schema.
upgrade Upgrade the database schema.
duffy setup-db --help
This command sets up the Duffy database schema, tables etc., in the configured database. For development and testing, it can optionally fill the database with example tenants and node objects. The example tenants use fixed (deterministic) API keys, so don't use them in production!
Usage: duffy setup-db [OPTIONS]
Create tables from the database model.
Options:
--test-data / --no-test-data Initialized database with test data.
--help Show this message and exit.
duffy client --help
The client
command executes commonly used functions on the API from the command line or shell scripts. Results can be formatted as JSON (default), YAML or “flat“ which outputs shell statements to set variables which can be used with eval
.
Usage: duffy client [OPTIONS] COMMAND [ARGS]...
Command line client for the Duffy API.
Options:
--url TEXT The base URL of the Duffy API.
--auth-name TEXT The tenant name to authenticate with the Duffy
API.
--auth-key TEXT The tenant key to authenticate with the Duffy
API.
--format [json|yaml|flat] Format with which to print results.
--help Show this message and exit.
Commands:
list-pools List configured Duffy node pools.
list-sessions Query active sessions for this tenant on the Duffy API.
request-session Request a session with nodes from the Duffy API.
retire-session Retire an active Duffy session.
show-pool Show information about a Duffy node pool.
show-session Show one session identified by its id on the Duffy API.
duffy dev-shell --help
The Duffy development shell gives users easy interactive access to the Python objects and logic driving Duffy. The scope of the shell contains the objects necessary to inspect and manipulate database model objects, e.g. the SQLAlchemy classes themselves, database sessions and related SQLalchemy functions. When available (e.g. by installing the interactive
extra of Duffy), it will use the IPython shell which offers a better experience than the native Python shell, with tab-completion and the like.
Usage: duffy dev-shell [OPTIONS]
Run an interactive shell.
Options:
-t, --shell-type [python|ipython]
Type of interactive shell to use.
--help Show this message and exit.