-
Notifications
You must be signed in to change notification settings - Fork 11
Building Achlys
Clone the Achlys repository using the following command :
$ git clone https://github.com/achlysproject/achlys.git && cd achlys && make
This should compile the framework and allow you to test it in a terminal.
Retrieve your current hostname using the following command :
$ hostname -s
And associate the result to your current IP address in the /etc/hosts
file :
$ sudo nano /etc/hosts
And add a line with the pair <current IP address> <current hostname>
, for example :
192.168.1.2 MyHostname ## This line has been added
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
NOTE : Make sure to declare it at the top of the file, since the first match will be used if any other addresses that are not currently available are declared, the Partisan communication layer will not be able to operate using the given hostname.
If your etc/hosts
file is set to resolve your local hostname to its address, that address can be directly provided to Partisan in config/test.config
so that booting into Achlys will immediately allow your application to have a working communication component.
This line should be edited such that peer_ip
matches your local IP address. In order to run multiple nodes on the same address, the peer_port
parameter can be modified as well so that multiple instances of Partisan can run on the same host.
Running a test shell can be done with the following command from the achlys root directory :
$ make shell
In the Erlang shell, run a simulated collection of sensor data with using the Pmod_NAV module :
(achlys@Hostname)1> achlys:venom(achlys_pmod_nav_worker).
This will store the mean aggregates of temperature and pressure raw measurements, in this case the simulated values. They will be stored in CRDTs with the following Lasp identifiers :
{<<"temperature">>, state_awset}
{<<"pressure">>, state_awset}
A simple function can be created and passed to the task model in order to read the results that are currently available :
> F = fun() -> S = lasp:query({<<"temperature">>, state_awset}), sets:to_list(S) end.
> Task = achlys:declare(task1, all, permanent, F).
> achlys:bite(Task).
This will add the function in the set of distributed tasks. It can be retrieved using :
MyTask = hd(achlys:get_all_tasks()).
#{function := MyFunction} = MyTask.
Then executed using :
MyFuntion().
This should display the list of all the temperature average records that have been computed based on raw measurements and propagated once the configured aggregation trigger has been reached.