SMS Spam engine
First, create a new virtualenv for this engine in your python toolbox env
marvin engine-generateenv /your/path/to/sms_spam_engine_env
Now move to the new env and run tests to confirm everything is fine
workon sms-spam-engine-env marvin test
You are now ready to code.
Active your engine env
Start http server
Open the API doc page in your browser
You can send request directly from docs page to you engine server using “Try it out” and “Execute” buttons
It`s very important. All development dependencies should be added to
To run all tests use the following command
To run specific test
marvin test tests/test_file.py::TestClass::test_method
The project documentation is written using Jupyter notebooks. You can start the notebook server from the command line by running the following command
Use notebooks to demonstrate how to use the lib features. It can also be useful to show some use cases.
marvin pkg-bumpversion [patch|minor|major] git add . && git commit -m "Bump version"
marvin pkg-createtag git push origin master --follow-tags
The default log level is set to WARNING.
You can change the log level at runtime setting another value to one of the following environment variable:
LOG_LEVEL. The available values are CRITICAL, ERROR, WARNING, INFO and DEBUG.
Be careful using
LOG_LEVEL, it may affect another lib.
Use the Marvin toolbox to provision, deploy and start the remote HTTP server.
First, edit the
marvin.ini file, setting the options within the
host: the host IP address or name where the engine should be deployed. You can enable multi-host deployment using
,to separate hosts
port: the SSH connection port
user: the SSH connection username. Currently, only a single user is supported. This user should be capable of passwordless sudo, although it can use password for the SSH connection
Next, ensure that the remotes servers are provisioned (all required software are installed):
marvin engine-deploy --provision
Next, package your engine:
marvin engine-deploy --package
This will create a compressed archive containing your engine code under the
Next, deploy your engine to remotes servers:
By default, a dependency clean will be executed at each deploy. You can skip it using:
marvin engine-deploy --skip-clean
Next, you can start the HTTP server in the remotes servers:
marvin engine-httpserver-remote start
You can check if the HTTP server is running:
marvin engine-httpserver-remote status
And stop it:
marvin engine-httpserver-remote stop
After starting, you can test it by making a HTTP request to any endpoint, like:
curl -v http://example.com/predictor/health
Under the hood, this engine uses Fabric to define provisioning and deployment
process. Check the
fabfile.py for more information. You can add new tasks or
edit existing ones to match your provisioning and deployment pipeline.