Skip to content
Snippets Groups Projects
Commit 25b245ce authored by Bartosz Ziemba's avatar Bartosz Ziemba Committed by Mateusz Gniewkowski
Browse files

Dev

parent 8424b51f
Branches
Tags
No related merge requests found
......@@ -13,10 +13,11 @@ build_deb:
- apt-get update -qq
- apt-get install -y -qq
sqlite3 wget locales locales-all libboost-all-dev libicu-dev
- wget https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v2.8.0.tar.gz
- tar -xvf v2.8.0.tar.gz
- cd AMQP-CPP-2.8.0
- make -j4 && make install && ldconfig && cd ..
- wget https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.10.tar.gz
- tar -xvf v4.3.10.tar.gz
- cd AMQP-CPP-4.3.10
- sed -i "5 a LD_FLAGS = -Wall -shared -Wl,--no-as-needed -ldl" ./src/Makefile
- make -j8 && make install && ldconfig
- cd build && cmake .. && cmake --build .
- cpack
artifacts:
......
cmake_minimum_required(VERSION 3.5.1)
cmake_policy(SET CMP0048 NEW)
project(wsnlp VERSION 1.0.0)
project(wsnlp VERSION 1.1.0)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/CMakeScripts)
SET(CMAKE_BUILD_TYPE Release)
......@@ -13,7 +13,7 @@ find_package(Boost COMPONENTS program_options system thread filesystem chrono at
link_directories(${Boost_LIBRARY_DIRS})
SET(LIBS ${LIBS} ${Boost_LIBRARIES})
find_package(amqpcpp 3.0 REQUIRED)
find_package(amqpcpp 4.0 REQUIRED)
SET(LIBS ${LIBS} amqpcpp)
get_filename_component(AMQP_DIR ${AMQP_LIBRARY} REALPATH)
......
################################################
# NLP Tools for Polish from G4.19 Group Wroclaw University of Science
# and Technology
#
# Contact: Tomasz.Walkowiak@pwr.edu.pl
#
# Morphodita service
###############################################
FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y \
apt-utils iputils-ping \
git subversion \
wget nano mc zip unzip \
vim ranger atool htop curl \
locales locales-all \
cmake g++ \
netcat libboost-all-dev \
libicu-dev
##################################
## UTF-8
##################################
RUN locale-gen en_US.UTF-8
ENV LANG en_US.UTF-8
ENV LC_ALL en_US.UTF-8
##################################
# Install morphodita service and dependencies
##################################
## AMQP-CPP
WORKDIR /home/install
RUN wget https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v2.8.0.tar.gz && \
tar -xvf v2.8.0.tar.gz && \
cd AMQP-CPP-2.8.0 && \
make -j4 && make install && ldconfig
WORKDIR /home/install/nlp_cpp
COPY src/ src/
COPY CMakeScripts/ CMakeScripts/
COPY CMakeLists.txt .
RUN mkdir build && \
cd build && \
cmake .. && \
make -j4 && \
make install && \
ldconfig
##INSTALLATION
Dependencies:
- AMQP-CPP 2.8.0 !!!
(https://github.com/CopernicaMarketingSoftware/AMQP-CPP/releases/tag/v2.8.0)
- Boost 1.58
- ICU 52.0
Installation:
mkdir build && \
cd build && \
cmake .. && \
make -j && \
sudo make install
##USAGE
To create service you have to include header:
> #include "nlpworker.h"
and implement class:
> class your_Worker: public NLPWorker
> {
> public:
> void process(string task_path, boost::property_tree::ptree &config, string output_path);
> void static_init(boost::property_tree::ptree config);
> void init(boost::property_tree::ptree config);
> };
add this main function to your file:
> int main(int argc, char* argv[])
> {
> run_workers<your_Worker>(argc,argv);
> }
Now you can compile your code with linked -wsnlp library.
To run worker you need to place config .ini file. Below there is a template, fill it properly and if needed add your own section.
> [service]
> tool = name_of_your_worker
>
> root = /samba/requests/
> rabbit_host =
> rabbit_user =
> rabbit_password =
>
> [tool]
> workers_number = number_of_workers
## INSTALLATION
### Dependencies:
- [AMQP-CPP 4.3.10](https://github.com/CopernicaMarketingSoftware/AMQP-CPP/releases/tag/v4.3.10)
- Note that it MUST be linked with `-Wl,--no-as-needed -ldl`. *Not sure why AMQP-CPP devs didn't include it*
- Easiest way to do this is changing the line in `AMQP-CPP 4.4.10/src/Makefile`
- While in `AMQP-CPP 4.3.10` you can run command:
- `sed -i "5 a LD_FLAGS = -Wall -shared -Wl,--no-as-needed -ldl" ./src/Makefile`
- Then you can install AMQP-CPP using make ```make -j8 && sudo make install && sudo ldconfig```
- If the library is linked incorrectly you will get a linker error in amqpcpp library while compiling your worker
- Boost, tested version 1.71
- ICU, tested version 66.1
### Installation using deb file [Recomended]
###### Creating deb file
```bash
mkdir build && \
cd build && \
cmake .. && \
cmake --build . && \
cpack
```
###### Deb file installation
```
dpkg -i ./wsnlp-1.1.0-Linux.deb
```
### Installation: [From orginal nlp-cpp]
```bash
mkdir build && \
cd build && \
cmake .. && \
make -j && \
sudo make install
```
## USAGE
To create service you have to include header:
```cpp
#include "nlpworker.h"
```
and implement class:
```cpp
class your_Worker: public NLPWorker
{
public:
void process(string task_path, boost::property_tree::ptree &config, string output_path);
void static_init(boost::property_tree::ptree config);
void init(boost::property_tree::ptree config);
};
```
add this main function to your file:
```cpp
int main(int argc, char* argv[])
{
run_workers<your_Worker>(argc,argv);
}
```
Now you can compile your code with linked -wsnlp library.
To run worker you need to place config .ini file. Below there is a template, fill it properly and if needed add your own section.
```ini
[service]
tool = name_of_your_worker
root = /samba/requests/
rabbit_host =
rabbit_user =
rabbit_password =
[tool]
workers_number = number_of_workers
```
......@@ -197,7 +197,7 @@ void AsioHandler::parseData()
}
}
void AsioHandler::onConnected(AMQP::Connection *connection)
void AsioHandler::onReady(AMQP::Connection *connection)
{
}
......
......@@ -15,7 +15,9 @@ private:
typedef std::deque<std::vector<char>> OutputBuffers;
virtual void onData(AMQP::Connection *connection, const char *data, size_t size);
virtual void onConnected(AMQP::Connection *connection);
//ConnectionHandler::onConnected has been renamed to ConnectionHandler::onReady
//https://github.com/CopernicaMarketingSoftware/AMQP-CPP#upgrading
virtual void onReady(AMQP::Connection *connection);
virtual void onError(AMQP::Connection *connection, const char *message);
virtual void onClosed(AMQP::Connection *connection);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment