| |
| |
| <!DOCTYPE html> |
| <html lang="en"> |
| <head> |
| <meta charset="utf-8"> |
| <title>Starter Guilde</title> |
| <meta name="description" content="Project Community Page"> |
| <meta name="author" content=""> |
| |
| <!-- Enable responsive viewport --> |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> |
| |
| <!-- Le styles --> |
| <link href="/assets/themes/apache/bootstrap/css/bootstrap.css" rel="stylesheet"> |
| <link href="/assets/themes/apache/css/style.css?body=1" rel="stylesheet" type="text/css"> |
| <link href="/assets/themes/apache/css/syntax.css" rel="stylesheet" type="text/css" media="screen" /> |
| <!-- Le fav and touch icons --> |
| <link rel="shortcut icon" href="/assets/themes/apache/img/icon.png"> |
| <!-- Update these with your own images |
| <link rel="apple-touch-icon" href="images/apple-touch-icon.png"> |
| <link rel="apple-touch-icon" sizes="72x72" href="images/apple-touch-icon-72x72.png"> |
| <link rel="apple-touch-icon" sizes="114x114" href="images/apple-touch-icon-114x114.png"> |
| --> |
| |
| </head> |
| |
| <body> |
| |
| |
| <div class="navbar navbar-inverse navbar-fixed-top" role="navigation"> |
| <div class="container"> |
| <div class="navbar-header"> |
| <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> |
| <span class="sr-only">Toggle navigation</span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| <span class="icon-bar"></span> |
| </button> |
| <a class="navbar-brand" href="/"> |
| <img src="/assets/themes/apache/img/logo_white.png" width="80"> |
| </a> |
| </div> |
| <nav class="navbar-collapse collapse" role="navigation"> |
| <ul class="nav navbar-nav navbar-right"> |
| <li id="community"> |
| <a href="#" data-toggle="dropdown" class="dropdown-toggle">Community<b class="caret"></b></a> |
| <ul class="dropdown-menu"> |
| <li><a href="/community">Get Involved</a></li> |
| <li><a href="/community-members">Who we are</a></li> |
| </ul> |
| </li> |
| <li><a href="/news">News</a></li> |
| <li><a href="/marvin-platform-book/SUMMARY">Document</a></li> |
| <li><a href="https://github.com/apache/incubator-marvin">GitHub</a></li> |
| <li id="apache"> |
| <a href="#" data-toggle="dropdown" class="dropdown-toggle">Apache<b class="caret"></b></a> |
| <ul class="dropdown-menu"> |
| <li><a href="http://www.apache.org/foundation/how-it-works.html">Apache Software Foundation</a></li> |
| <li><a href="http://www.apache.org/licenses/">Apache License</a></li> |
| <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li> |
| <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li> |
| </ul> |
| </li> |
| </ul> |
| </nav> |
| </div> |
| </div> |
| |
| |
| |
| |
| <div class="container"> |
| |
| |
| |
| <div class="row"> |
| <div class="col-md-12"> |
| <!-- |
| |
| --> |
| |
| <h1 id="sms-engine">SMS Engine</h1> |
| |
| <h2 id="overview">Overview</h2> |
| |
| <p>SMS Spam engine</p> |
| |
| <h2 id="requirements">Requirements</h2> |
| |
| <ul> |
| <li>Python 2.7.9 or higher</li> |
| <li>Pandas 0.20.3 or higher</li> |
| <li>Sklearn 0.18.2 or higher</li> |
| </ul> |
| |
| <h2 id="development">Development</h2> |
| |
| <h3 id="getting-started">Getting started</h3> |
| |
| <p>First, create a new virtualenv for this engine in your python toolbox env</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin engine-generateenv /your/path/to/sms_spam_engine_env |
| </code></pre></div></div> |
| |
| <p>Now move to the new env and run tests to confirm everything is fine</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>workon sms-spam-engine-env |
| marvin test |
| </code></pre></div></div> |
| |
| <p>You are now ready to code.</p> |
| |
| <h3 id="api-docs">API docs</h3> |
| |
| <p>Active your engine env</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>workon sms-spam-engine-env |
| </code></pre></div></div> |
| |
| <p>Start http server</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin engine-httpserver |
| </code></pre></div></div> |
| |
| <p>Open the API doc page in your browser</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>localhost:8000/docs/ |
| </code></pre></div></div> |
| |
| <p>You can send request directly from docs page to you engine server using “Try it out” and “Execute” buttons</p> |
| |
| <h3 id="adding-new-dependencies">Adding new dependencies</h3> |
| |
| <p>It`s very important. All development dependencies should be added to <code class="highlighter-rouge">setup.py</code>.</p> |
| |
| <h3 id="running-tests">Running tests</h3> |
| |
| <p>This project uses <em><a href="http://pytest.org/">py.test</a></em> as test runner and <em><a href="https://tox.readthedocs.io">Tox</a></em> to manage virtualenvs.</p> |
| |
| <p>To run all tests use the following command</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin test |
| </code></pre></div></div> |
| |
| <p>To run specific test</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin test tests/test_file.py::TestClass::test_method |
| </code></pre></div></div> |
| |
| <h3 id="writting-documentation">Writting documentation</h3> |
| |
| <p>The project documentation is written using <em><a href="http://jupyter.readthedocs.io/">Jupyter</a></em> notebooks. |
| You can start the notebook server from the command line by running the following command</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin notebook |
| </code></pre></div></div> |
| |
| <p>Use notebooks to demonstrate how to use the lib features. It can also be useful to show some use cases.</p> |
| |
| <h3 id="bumping-version">Bumping version</h3> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin pkg-bumpversion [patch|minor|major] |
| git add . && git commit -m "Bump version" |
| </code></pre></div></div> |
| |
| <h3 id="tagging-version">Tagging version</h3> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin pkg-createtag |
| git push origin master --follow-tags |
| </code></pre></div></div> |
| |
| <h3 id="logging">Logging</h3> |
| |
| <p>The default log level is set to <em>WARNING</em>. |
| You can change the log level at runtime setting another value to one of the following environment variable: |
| <code class="highlighter-rouge">MARVIN_SMS_SPAM_ENGINE_LOG_LEVEL</code> or <code class="highlighter-rouge">LOG_LEVEL</code>. The available values are <em>CRITICAL</em>, <em>ERROR</em>, <em>WARNING</em>, <em>INFO</em> and <em>DEBUG</em>.</p> |
| |
| <p>Be careful using <code class="highlighter-rouge">LOG_LEVEL</code>, it may affect another lib.</p> |
| |
| <h2 id="installation">Installation</h2> |
| |
| <p>Use the Marvin toolbox to provision, deploy and start the remote HTTP server.</p> |
| |
| <p>First, edit the <code class="highlighter-rouge">marvin.ini</code> file, setting the options within the |
| <code class="highlighter-rouge">ssh_deployment</code> section:</p> |
| |
| <ol> |
| <li><code class="highlighter-rouge">host</code>: the host IP address or name where the engine should be deployed. You |
| can enable multi-host deployment using <code class="highlighter-rouge">,</code> to separate hosts</li> |
| <li><code class="highlighter-rouge">port</code>: the SSH connection port</li> |
| <li><code class="highlighter-rouge">user</code>: the SSH connection username. Currently, only a single user is |
| supported. This user should be capable of <em>passwordless sudo</em>, although it can |
| use password for the SSH connection</li> |
| </ol> |
| |
| <p>Next, ensure that the remotes servers are provisioned (all required software |
| are installed):</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin engine-deploy --provision |
| </code></pre></div></div> |
| |
| <p>Next, package your engine:</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin engine-deploy --package |
| </code></pre></div></div> |
| |
| <p>This will create a compressed archive containing your engine code under the |
| <code class="highlighter-rouge">.packages</code> directory.</p> |
| |
| <p>Next, deploy your engine to remotes servers:</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin engine-deploy |
| </code></pre></div></div> |
| |
| <p>By default, a dependency clean will be executed at each deploy. You can skip it |
| using:</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin engine-deploy --skip-clean |
| </code></pre></div></div> |
| |
| <p>Next, you can start the HTTP server in the remotes servers:</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin engine-httpserver-remote start |
| </code></pre></div></div> |
| |
| <p>You can check if the HTTP server is running:</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin engine-httpserver-remote status |
| </code></pre></div></div> |
| |
| <p>And stop it:</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>marvin engine-httpserver-remote stop |
| </code></pre></div></div> |
| |
| <p>After starting, you can test it by making a HTTP request to any endpoint, like:</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl -v http://example.com/predictor/health |
| </code></pre></div></div> |
| |
| <p>Under the hood, this engine uses Fabric to define provisioning and deployment |
| process. Check the <code class="highlighter-rouge">fabfile.py</code> for more information. You can add new tasks or |
| edit existing ones to match your provisioning and deployment pipeline.</p> |
| |
| <hr /> |
| |
| <ul> |
| <li><a href="/marvin-platform-book/ch3_get_started/overview">Get Started</a></li> |
| </ul> |
| |
| </div> |
| </div> |
| |
| |
| <hr> |
| <footer> |
| <footer class="site-footer"> |
| <div class="wrapper"> |
| <div class="footer-col-wrapper"> |
| |
| Apache Marvin-AI is an effort undergoing <a href="https://incubator.apache.org/index.html">Incubation</a> |
| at The Apache Software Foundation (ASF), sponsored by the Incubator. Incubation is required of all newly |
| accepted projects until a further review indicates that the infrastructure, communications, and decision |
| making process have stabilized in a manner consistent with other successful ASF projects. While incubation |
| status is not necessarily a reflection of the completeness or stability of the code, it does indicate that |
| the project has yet to be fully endorsed by the ASF. |
| <hr> |
| |
| <div style="text-align:center;"> |
| |
| <div style="margin-top: 20px; margin-bottom: 20px;"> |
| <a href="http://incubator.apache.org"><img src="/assets/themes/apache/img/egg-logo.png" |
| alt="Apache Incubator"/></a> |
| </div> |
| |
| <div> |
| Copyright © 2016 <a href="http://www.apache.org">The Apache Software Foundation</a>. |
| Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version |
| 2.0</a>. |
| <br> |
| |
| Apache, the Apache Feather logo, and the Apache Incubator project logo are trademarks of The Apache |
| Software Foundation. |
| |
| </div> |
| </div> |
| </div> |
| </div> |
| </footer> |
| |
| </footer> |
| </div> |
| |
| |
| <script src="/assets/themes/apache/jquery/jquery-2.1.1.min.js"></script> |
| |
| <script src="/assets/themes/apache/bootstrap/js/bootstrap.min.js"></script> |
| |
| |
| </body> |
| </html> |
| |