Command Line Interface¶
The recommended way to interface with bots is to use the command line interface. This should have been installed when you installed pyqalx
. If this has worked correctly, you should be able to type qalx
and get a response like:
Usage: qalx [OPTIONS] COMMAND1 [ARGS]... [COMMAND2 [ARGS]...]...
Command line interface to qalx.
Options:
-u, --user-profile TEXT User profile name in .qalx.
-b, --bot-profile TEXT Bot profile name in .bots.
--version Show the version and exit.
--help Show this message and exit.
Commands:
bot-info Print info about the bot named NAME.
bot-resume Resume the bot named NAME.
bot-start Start the bot at TARGET This is the import path with...
bot-stop Stop the bot named NAME.
bot-terminate Shutdown the bot named NAME
configure Configures the .qalx and .bots config files.
download Downloads a file for the specified entity type and...
factory-build Build a factory
factory-demolish Demolish a factory.
factory-info Get info about a factory
factory-pack Pack a factory
factory-validate Validate a factory
generate-encryption Generates an encryption key file for the user prints...
workers-terminate Terminate NUMBER of workers on bot named BOT_NAME.
Calling qalx COMMAND --help
for any command will show the help for that command.
Examples¶
User Profiles and Bot Profiles¶
All commands accept an optional –bot-profile (short code -b) and –user-profile (short code -u) arguments. These arguments can be used if you with to perform any command using a different profile from your .qalx or .bots profile configuration files
$ qalx --user-profile=dev --bot-profile=prod <command>
Misc¶
Configure:¶
You wish to configure a new profile in your .qalx or .bots profile. The configure command will ask various questions when setting up new configs. You can supply extra config options to write to your config files.
Warning
You cannot use the configure command to change the configuration of an existing profile
$ qalx --user-profile=new --bot-profile=new configure
$ qalx --user-profile=new --bot-profile=new configure LOGGING_LEVEL=DEBUG MSG_BLACKOUTSECONDS=50
Download:¶
You wish to download a file directly to disk. The download directory can be specified by the DOWNLOAD_DIR config option or via the –directory argument
$ qalx download a0deb618-8464-4869-bd72-85d34d414142
Generate Encryption:¶
You wish to generate a new encryption key to use when uploading files. This encryption key will remain on your local filesystem and will not be uploaded to qalx. It enables any upload to qalx to be encrypted before upload and then decrypted transparently after download. Any user wishing to decrypt files that have been encrypted will need to have access to the encryption key. The command will ask various questions when generating the encryption key
$ qalx generate-encryption
Bots¶
Commands for interacting with bots. See bots documentation for more info on bots
Start a bot:¶
You have written a bot and wish to start running it.
$ qalx bot-start --queue-name "beam calcs" examples.docs-quickstart.stress_bot:bot
Starting Beam stress calculator d2a089 reading from beam calcs with 1 workers.
Stop a bot:¶
You wish to temporarily stop your bot from reading messages from the queue. The bot will finish any jobs that it is currently working on, but not take any more messages off the queue until it is resumed.
$ qalx bot-stop "Beam stress calculator d2a089"
Stopping Beam stress calculator d2a089.
Resume a bot:¶
You want your bot to resume reading messages from the queue.
$ qalx bot-resume "Beam stress calculator d2a089"
Resuming Beam stress calculator d2a089.
Terminate a bot:¶
You are finished with your bot and want to stop it from ever processing messages from the queue.
$ qalx bot-terminate "Beam stress calculator d2a089"
Terminated Beam stress calculator d2a089
Get info on a bot:¶
Prints out information about the named bot including its name, it’s current status, the number of workers and where it is running
$ qalx bot-info "Beam stress calculator d2a089"
Index Name Status Platform Node No. Workers Created On (UTC) Created By
----- ----------------------------- -------- ------------------------- ----------- ------------- ------------------- --------------------
1 Beam stress calculator d2a089 Windows-10-10.0.14393-SP0 DN-98ABC123 94 23/07/2019 17:40:28 fredsmith@company.com
2 Beam stress calculator d2a089 Windows-10-10.0.14393-SP0 AB-IKWAW928 12 25/09/2019 17:40:28 janedoe@company.com
Terminate a number of workers:¶
You want to terminate a specific number of workers on this bot. This is useful if you wish to downsize the bot to use fewer resources. Termination of workers will occur immediately - even if they are still working on jobs
$ qalx workers-terminate "Beam stress calculator d2a089" 5
Terminated worker 1
Terminated worker 2
Terminated worker 3
Terminated worker 4
Terminated worker 5
Factories¶
Commands for interacting with factories. See factories documentation for more info on factories
Validate a factory plan¶
Validates that the given factory plan is formatted correctly
$ qalx factory-validate --plan /path/to/factory-plan.yaml
[2020-10-06 15:20:57] pyqalx: Starting Factory Validation
[2020-10-06 15:20:57] pyqalx: Factory Validation Successful
Pack a factory¶
Downloads all bot sources on a factory to validate that they are all accessible before building
$ qalx factory-pack --plan /path/to/factory-plan.yaml
[2020-10-06 15:22:56] pyqalx: Starting Factory Pack
[2020-10-06 15:22:56] pyqalx: Starting Factory Validation
[2020-10-06 15:22:56] pyqalx: Factory Validation Successful
....lots of information about the sources that are being packed
[2020-10-06 15:58:56] pyqalx: Factory Pack Successful
Build a factory¶
Builds a factory and starts running all the bots
$ qalx factory-build --plan /path/to/factory-plan.yaml --stage=dev
[2020-10-06 15:22:56] pyqalx: Starting Factory Build
[2020-10-06 15:22:56] pyqalx: Starting Factory Validation
[2020-10-06 15:22:56] pyqalx: Factory Validation Successful
[2020-10-06 15:22:56] pyqalx: Starting Factory Pack
....lots of information about the sources that are being packed
[2020-10-06 15:58:56] pyqalx: Factory Pack Successful
....lots of information about the factory that is being built
[2020-10-06 15:59:56] pyqalx: Factory Build Successful
Demolish a factory¶
Demolishes a factory, terminating all bots and deleting all resources. Any data created by bots that were running on the factory will remain
$ qalx factory-demolish --name="my-factory"
Are you sure you want to demolish factory: test b2c4626d-c97f-424a-950f-dd6970be6fc2? [y/N]: y
[2020-10-06 15:29:49] pyqalx: Starting Factory Demolish
...lots of information about the resources getting deleted
[2020-10-06 15:35:49] pyqalx: Factory Demolish Successful