Setting up your local test environment can be done as follows:
Running the vantage6 server and gui:
docker-compose up -dIn order to add and use a v6 node you will have to do some administation. You can do this in the gui.
- In your browser, go to
http://localhost:8080and log in with usernamerootand passwordroot. - Go to the page "organization"
- Create two new organizations. One for the v6 user and one for the node.
- Create a new collaboration and add your organizations to it. Disable encryption since it's a local test setup anyway.
- View your collaboration on the collaboration page, unfold it
- Press
Register node for YOUR_ORGANIZATIONfor one of your organizations - A window will pop up providing you with an api key. Copy it to somewhere safe
- Next, go to the
userspage. - Create a new user and assign it to the other organization, give it the role of "researcher"
You will have to install, register and set up a node as well. Installing the node is as follows:
pip install vantage6==3.11.0We are installing version 3.9.0 because this is the same version that is running in docker compose.
Set up a node with the command:
vnode newYou will need you api key. This is the key that will let the vantage6 server know the identity of this node.
To set up a node you will have to follow the instructions from
the vantage6 documentation. You can use
the command vnode new to follow the wizard.
Fill in the wizard as follows:
? Please enter a configuration-name: test
? Please select the environment you want to configure: application
? Enter given api-key: YOUR API KEY
? The base-URL of the server: `http://host.docker.internal` (win/mac) or http://172.17.0.1 (linux)
? Enter port to which the server listens: 5001
? Path of the api: /api
? Task directory path: /HOMEDIR/.local/share/vantage6/node/test
? Default database path: ABSOLUTE_PATH_TO_PROJECT/nodes/whas500.csv
? Do you want to add another database? No
? Which level of logging would you like? DEBUG
? Do you want to connect to a VPN server? No
? Enable encryption? false The config file will be saved at /HOMEDIR/.config/vantage6/node/test.yaml
vnode start
# Select the node you want to startThe docker compose includes a jupyter notebook environment where you can play around with the
vantage6 client.
Check the jupyter log by running the following in the root project directory:
docker-compose logs -f jupyter
You will find the link (including authentication token) in the logs.
Open the link in the browser and create a new notebook.
Your jupyter environment probably doesn't have the vantage6 client installed yet, so first off, run the following in a cell:
!pip install vantage6-client==3.11.0
You will log in to your vantage6 server as follows.
Import the v6 client class:
from vantage6.client import ClientConnect to the server:
# Host can be http://host.docker.internal or http://172.17.0.1 depending on your system.
v6_client = Client("http://172.17.0.1",
5001) v6_client.authenticate('your_username', 'Your_password123')
v6_client.setup_encryption(None) # We aren't using encryptionWe're in!
One way to get the organization ids of your nodes is to list the nodes that are online within your organization.
nodes = v6_client.node.list(is_online=True)
nodes = nodes['data']
org_ids = [n['organization']['id'] for n in nodes]Let's retrieve the column names of our dataset from a collection
of vantage6 test algorithms.
The docker image can be found
at harbor.carrier-mu.src.surf-hosted.nl/carrier/vantage6-test-algorithms.
# image = 'harbor.carrier-mu.src.surf-hosted.nl/carrier/vantage6-test-algorithms'
task = v6_client.post_task('column_names', image=image,
collaboration_id=1,
organization_ids=[2],
input_={'method': 'column_names', 'output_format':'json'})It will take a moment to execute the algorithm. Then you can retrieve the result:
result = client.get_results(task_id=task['id'])
print(result)If that worked you can also try the methods correlation_matrix and count.
For development purposes you might want to run your own local docker registry:
# Run docker registry separately. Node tasks are run in a network separate from the node itself. By making the registry
# available from the host network it will be accessable by all docker containers
docker run -d --name registry --network host registry:2