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.6.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.6-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: webcli2-0.0.6.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.6.tar.gz
Algorithm Hash digest
SHA256 48f6132841f05b4963c305adc367593b78e2b7baa99c5b8e53aff712f240bad5
MD5 5036ea770a7f98a4034b5baab468ce6b
BLAKE2b-256 20a8f690551da52d10427b168c478697075cdbc5fc71af60e934c594172ffce7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: webcli2-0.0.6-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.6-py3-none-any.whl
Algorithm Hash digest
SHA256 370c5a538fd136c14db29cf26124dec60e70c72778a542c7b71c4207b8a28a46
MD5 b3ac856b93cc2e38508ba6fb782b4004
BLAKE2b-256 14787d0d2a9604cbff0ab76a02dc4558c4f98d47f9bc12b03b6b1f9df929d6ed

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