Skip to content
Snippets Groups Projects
Commit 62124b3c authored by Nikolay Stanchev's avatar Nikolay Stanchev
Browse files

[Issue #73] - structure of the CLMC service

parent 94dbeaff
No related branches found
No related tags found
No related merge requests found
[run]
source = CLMCservice
omit = CLMCservice/tests.py
...@@ -5,3 +5,7 @@ ...@@ -5,3 +5,7 @@
*egg-info* *egg-info*
*git-commit-ref* *git-commit-ref*
ubuntu-xenial-16.04-cloudimg-console.log ubuntu-xenial-16.04-cloudimg-console.log
.idea/
*.egg
*.pyc
*$py.class
from pyramid.config import Configurator
def main(global_config, **settings):
""" This function returns a Pyramid WSGI application."""
config = Configurator(settings=settings)
config.add_route('home', '/')
config.scan()
return config.make_wsgi_app()
# Specific tests related to the CLMC service
\ No newline at end of file
from pyramid.view import view_config
from pyramid.response import Response
@view_config(route_name='home')
def my_view(request):
return Response("Hello world")
...@@ -119,4 +119,43 @@ If pytest is not installed, an easy solution is to use the Python Package Index ...@@ -119,4 +119,43 @@ If pytest is not installed, an easy solution is to use the Python Package Index
`sudo apt-get install python3-pip` `sudo apt-get install python3-pip`
`pip3 install pytest` `pip3 install pytest`
\ No newline at end of file
#### CLMC Service
The CLMC service is implemented using the Pyramid framework. (currently under development)
Before installing the CLMC service and its dependencies, it is recommended to use a virtual environment. To manage virtual
environments, **virtualenvwrapper** can be used.
```
pip install virtualenvwrapper
```
To create a virtual environment use the **mkvirtualenv** command:
```
mkvirtualenv CLMC
```
When created, you should already be set to use the new virtual environment, but to make sure of this use the **workon** command:
```
workon CLMC
```
Now, any installed libraries will be specificly installed in this environment only. To install and use the CLMC service
locally, the easiest thing to do is to use **pip** (make sure you are in the root folder of the project - ***flame-clmc***):
```
pip install -e .
```
Finally, start the service on localhost by using pyramid's **pserve**:
```
pserve development.ini --reload
```
You should now be able to see the 'Hello world' message when visiting **http://localhost:8080** in your browser.
\ No newline at end of file
###
# app configuration
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###
[app:main]
use = egg:CLMCservice
pyramid.reload_templates = true
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
pyramid.includes = pyramid_debugtoolbar
aggregator_running = false
# By default, the toolbar only appears for clients from IP addresses
# '127.0.0.1' and '::1'.
# debugtoolbar.hosts = 127.0.0.1 ::1
###
# wsgi server configuration
###
[server:main]
use = egg:waitress#main
listen = localhost:8080
###
# logging configuration
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###
[loggers]
keys = root, CLMCservice
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = INFO
handlers = console
[logger_CLMCservice]
level = DEBUG
handlers =
qualname = CLMCservice
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
###
# app configuration
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/environment.html
###
[app:main]
use = egg:CLMCservice
pyramid.reload_templates = false
pyramid.debug_authorization = false
pyramid.debug_notfound = false
pyramid.debug_routematch = false
pyramid.default_locale_name = en
###
# wsgi server configuration
###
[server:main]
use = egg:waitress#main
listen = *:8080
###
# logging configuration
# https://docs.pylonsproject.org/projects/pyramid/en/latest/narr/logging.html
###
[loggers]
keys = root, CLMCservice
[handlers]
keys = console
[formatters]
keys = generic
[logger_root]
level = WARN
handlers = console
[logger_CLMCservice]
level = WARN
handlers =
qualname = CLMCservice
[handler_console]
class = StreamHandler
args = (sys.stderr,)
level = NOTSET
formatter = generic
[formatter_generic]
format = %(asctime)s %(levelname)-5.5s [%(name)s:%(lineno)s][%(threadName)s] %(message)s
[pytest]
testpaths = CLMCservice
python_files = *.py
...@@ -21,27 +21,46 @@ ...@@ -21,27 +21,46 @@
// Created for Project : FLAME // Created for Project : FLAME
""" """
import os
from setuptools import setup, find_packages from setuptools import setup, find_packages
def read(fname): requires = [
return open(os.path.join(os.path.dirname(__file__), fname)).read() 'plaster_pastedeploy',
'pyramid',
'pyramid_debugtoolbar',
'waitress',
'influxdb',
]
tests_require = [
'WebTest >= 1.3.1', # py3 compat
'pytest',
'pytest-cov',
]
setup( setup(
name = "clmctest", name = "CLMCservice",
version = "SNAPSHOT", version = "SNAPSHOT",
author = "Michael Boniface", author = "Michael Boniface",
author_email = "mjb@it-innovation.soton.ac.uk", author_email = "mjb@it-innovation.soton.ac.uk",
description = "FLAME CLMC Testing Module", description = "FLAME CLMC Testing Module",
long_description="long description",
license = "license", license = "license",
keywords = "FLAME CLMC test", keywords = "FLAME CLMC service test",
packages=find_packages(exclude=["services"]), packages=find_packages(exclude=["services"]),
include_package_data=True, include_package_data=True,
package_data={'': ['git-commit-ref', '*.yml', '*.sh', '*.json', '*.conf']}, install_requires=requires,
long_description="long description", extras_require={
'testing': tests_require,
},
package_data={'': ['git-commit-ref', '*.yml', '*.sh', '*.json', '*.conf']},
classifiers=[ classifiers=[
"Development Status :: Alpha", "Development Status :: Alpha",
"Topic :: FLAME Tests", "Topic :: FLAME Tests",
"License :: ", "License :: ",
], ],
entry_points={
'paste.app_factory': [
'main = CLMCservice:main',
],
},
) )
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment