Skip to main content

Tool to build CLI like web application

Project description

Index

Concepts

Action

Represent an action:

  • When an action is created, request field stores the context on what is action is about. It is a JSON object.
  • When an action is completed -- either successfully or failed, the response field store the action result. It is a JSON object
  • Once an action is created, before it is completed, you can update the progress information, it is stored in progress field. It is a JSON field.

APIs

ActionHandler

  • The can_handler method tells if a handler can handle an action or not
  • The handle method actually handles the action

CLIHandler

NameAsyncDescription
async_start_actionYES Create an action. It returns a tuple of status and action being created. If action is created successfully, status will be CLIHandlerStatus.OK, and the newly created action will be returned, the returned action has already been saved to database.

CLIHandler will find the first action handler which can handle the action to handler it, or it will fail with NO_HANDLER.

Once an action is created, the handler's handle method has been scheduled in a threadpool. The action handler's handle method is suppose to take care of the execution of the action

Here is a list of possible status based on status
Status Reason
OK The action has been created, the Action object is returned. The customer action handler's handle method has been scheduled in a thread pool
SHUTDOWN_IN_PROGRESS This means the CLIHandler is in the progress of shutdown and does not serve creating new actions.
NO_HANDLER Cannot find a handler that can handle this action. You need to make sure when you create CLIHandler, action_handlers is set properly
DB_FAILED Cannot save the action to database, probably check your DB configuration and connectivity
async_update_actionYES Update an ation's progress, wake up all monitoring client against this action.

Here is a list of possible status based on status
Status Reason
OK The action has been updated, all monitoring client against this action has been woken up
NOT_FOUND The action is not found based on the action ID caller provided.
ACTION_COMPLETED The action has already been completed
DB_FAILED Cannot save the progress for the action to database, probably check your DB configuration and connectivity
async_complete_action YES Complete an ation and set it's result, wake up all monitoring client against this action.

Here is a list of possible status based on status
Status Reason
OK The action has been completed, all monitoring client against this action has been woken up
NOT_FOUND The action is not found based on the action ID caller provided.
ACTION_COMPLETED The action has already been completed
DB_FAILED Cannot save the progress for the action to database, probably check your DB configuration and connectivity
async_wait_for_action_updateYES wait for an action to be updated or completed

Here is a list of possible status based on status
Status Reason
OK The action has been updated or completed
NOT_FOUND The action is not found based on the action ID caller provided.
ACTION_COMPLETED The action has already been completed
TIMEDOUT The action has not been updated or completed within the timeout caller specified
start_actionNonon-async version of async_start_action
update_actionNonon-async version of async_update_action
complete_actionNonon-async version of async_complete_action

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

webcli2-0.0.8.tar.gz (68.6 kB view details)

Uploaded Source

Built Distribution

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

webcli2-0.0.8-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file webcli2-0.0.8.tar.gz.

File metadata

  • Download URL: webcli2-0.0.8.tar.gz
  • Upload date:
  • Size: 68.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for webcli2-0.0.8.tar.gz
Algorithm Hash digest
SHA256 a6ef5126093d18b9093a8dc202c7866aa49e48b5fe477d22c8ede25a83aae3a9
MD5 d08ea25b02e93ed54ea7307e54f5a329
BLAKE2b-256 6c66c99601482aae69b01903db37652e9a6032034fc4c0662a7c349391598606

See more details on using hashes here.

File details

Details for the file webcli2-0.0.8-py3-none-any.whl.

File metadata

  • Download URL: webcli2-0.0.8-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.10.12

File hashes

Hashes for webcli2-0.0.8-py3-none-any.whl
Algorithm Hash digest
SHA256 fa2dad1c0689bfa4050ce3141231c92eb6a036e162e9cb191d531f3a3821ca79
MD5 0f5b16b36f460006c127dc080f035f5e
BLAKE2b-256 3cddd2f492c26fc8f51f677ec81bf1d57c5522f9ab999bbddba7be6b1f3b41a9

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