Web Service and Demonstration Applications¶
Included in SMQTK are a few web-based service and demonstration applications, providing a view into the functionality provided by SMQTK algorithms and utilities.
runApplication¶
This script can be used to run any conforming (derived from SmqtkWebApp) SMQTK web based application.
Web services should be runnable via the bin/runApplication.py
script.
Runs conforming SMQTK Web Applications.
usage: runApplication [-h] [-v] [-c PATH] [-g PATH] [-l] [-a APPLICATION] [-r]
[-t] [--host HOST] [--port PORT] [--use-basic-auth]
[--use-simple-cors] [--debug-server] [--debug-smqtk]
[--debug-app] [--debug-ns DEBUG_NS]
Named Arguments¶
-v, --verbose | Output additional debug logging. Default: False |
Configuration¶
-c, --config | Path to the JSON configuration file. |
-g, --generate-config | |
Optionally generate a default configuration file at the specified path. If a configuration file was provided, we update the default configuration with the contents of the given configuration. |
Application Selection¶
-l, --list | List currently available applications for running. More description is included if SMQTK verbosity is increased (-v | –debug-smqtk) Default: False |
-a, --application | |
Label of the web application to run. |
Server options¶
-r, --reload | Turn on server reloading. Default: False |
-t, --threaded | Turn on server multi-threading. Default: False |
--host | Run host address specification override. This will override all other configuration method specifications. |
--port | Run port specification override. This will override all other configuration method specifications. |
--use-basic-auth | |
Use global basic authentication as configured. Default: False | |
--use-simple-cors | |
Allow CORS for all domains on all routes. This follows the “Simple Usage” of flask-cors: https://flask-cors.readthedocs.io/en/latest/#simple-usage Default: False |
Other options¶
--debug-server | Turn on server debugging messages ONLY. This is implied when -v|–verbose is enabled. Default: False |
--debug-smqtk | Turn on SMQTK debugging messages ONLY. This is implied when -v|–verbose is enabled. Default: False |
--debug-app | Turn on flask app logger namespace debugging messages ONLY. This is effectively enabled if the flask app is provided with SMQTK and “–debug-smqtk” is passed. This is also implied if -v|–verbose is enabled. Default: False |
--debug-ns | Specify additional python module namespaces to enable debug logging for. Default: [] |
SmqtkWebApp¶
This is the base class for all web applications and services in SMQTK.
-
class
smqtk.web.
SmqtkWebApp
(json_config)[source]¶ Base class for SMQTK web applications
-
classmethod
from_config
(config_dict, merge_default=True)[source]¶ Override to just pass the configuration dictionary to constructor
-
get_config
()[source]¶ Return a JSON-compliant dictionary that could be passed to this class’s
from_config
method to produce an instance with identical configuration.In the most cases, this involves naming the keys of the dictionary based on the initialization argument names as if it were to be passed to the constructor via dictionary expansion. In some cases, where it doesn’t make sense to store some object constructor parameters are expected to be supplied at as configuration values (i.e. must be supplied at runtime), this method’s returned dictionary may leave those parameters out. In such cases, the object’s
from_config
class-method would also take additional positional arguments to fill in for the parameters that this returned configuration lacks.Returns: JSON type compliant configuration dictionary. Return type: dict
-
classmethod
get_default_config
()[source]¶ Generate and return a default configuration dictionary for this class. This will be primarily used for generating what the configuration dictionary would look like for this class without instantiating it.
This should be overridden in each implemented application class to add appropriate configuration.
Returns: Default configuration dictionary for the class. Return type: dict
-
classmethod