# subscribe to the websocket channel.
taskNamespace = socket.define(TasksNamespace, "/tasks")
taskNamespace.emit("join_room", f"collaboration_{collaboration_id}")

# input for the dsummary Docker image (algorithm)
input_ = {
    "master": "true",
    "method": "master",
    "args": [],
    "kwargs": {
        #"functions": ["min", "max"],
        "columns": [{
            "variable": "age",
            "table": "records",
            "functions": ["min", "max"]
        }, {
            "variable": "weight",
            "table": "records"
        }]
    }
}

# post the task to the server
task = client.post_task(name="summary",
                        image="pcmateus/v6-summary-rdb:1.0.0",
                        collaboration_id=collaboration_id,
                        input_=input_)

socket.wait(seconds=100)
Exemplo n.º 2
0
        #"functions": ["min", "max"],
        "columns": [{
            "variable": "age",
            "table": "records",
            "functions": ["min", "max"]
        }, {
            "variable": "weight",
            "table": "records"
        }]
    }
}

# 3. post the task to the server
task = client.post_task(
    name="summary",
    image="pcmateus/v6-summary-rdb:1.0.0",
    collaboration_id=3,
    organization_ids=[3],  # specify where the central container should run!
    input_=input_)

# 4. poll if central container is finished
task_id = task.get("id")
print(f"task id={task_id}")

task = client.request(f"task/{task_id}")
while not task.get("complete"):
    task = client.request(f"task/{task_id}")
    print("Waiting for results...")
    time.sleep(1)

# 5. obtain the finished results
results = client.get_results(task_id=task.get("id"))
Exemplo n.º 3
0
        "seperator": ";",
        "columns": {
            "patient_id": "Int64",
            "age": "Int64",
            "weight": "float64",
            "stage": "category",
            "cat": "category",
            "hot_encoded": "Int64"
        }
    }
}
#
# # 3. post the task to the server
task = client.post_task(
    name="summary",
    image="docker-registry.distributedlearning.ai/dsummary",
    collaboration_id=3,
    # organization_ids=[3],  # specify where the central container should run!
    input_=input_)
#
# # 4. poll if central container is finished
# task_id = task.get("id")
# print(f"task id={task_id}")
#
# task = client.request(f"task/{task_id}")
# while not task.get("complete"):
#     task = client.request(f"task/{task_id}")
#     print("Waiting for results...")
#     time.sleep(1)
#
# # 5. obtain the finished results
results = client.get_results(task_id=task.get("id"))
Exemplo n.º 4
0
from vantage6.client import Client
from pathlib import Path
import time

print("Attempt login to Vantage6 API")
client = Client("http://localhost", 5000, "/api")
client.authenticate("johan", "1234")

client.setup_encryption(None)

input_ = {"master": "true", "method": "master", "args": [], "kwargs": {}}

print("Requesting to execute summary algorithm")

task = client.post_task(name="testing",
                        image="docker.io/username/imagename",
                        collaboration_id=1,
                        input_=input_,
                        organization_ids=[1])

print("Wait and fetch results")
res = client.result.get(id_=task.get("results")[0]['id'])
attempts = 1
while ((res["result"] == None) and attempts < 7):
    print("waiting...")
    time.sleep(5)
    res = client.result.get(id_=task.get("results")[0]['id'])
    attempts += 1

print(res)
# subscribe to the websocket channel.
taskNamespace = socket.define(TasksNamespace, "/tasks")
taskNamespace.emit("join_room", f"collaboration_{collaboration_id}")

# input for the dsummary Docker image (algorithm)
input_ = {
    "method": "summary",
    "args": [],
    "kwargs": {
        "decimal": ",",
        "seperator": ";",
        "columns": {
            "patient_id": "Int64",
            "age": "Int64",
            "weight": "float64",
            "stage": "category",
            "cat": "category",
            "hot_encoded": "Int64"
        }
    }
}

# post the task to the server
task = client.post_task(name="summary",
                        image="harbor.vantage6.ai/algorithms/summary",
                        collaboration_id=collaboration_id,
                        input_=input_)

socket.wait(seconds=100)