Esempio n. 1
0
 def get_workload(cls) -> Workload:
     """Get all Workloads.
     Returns the running Workloads.
     """
     response = cls._send_message_to_gen(
         Request(header=Header(message="get workload"), body={}), )
     return Workload(**response["body"]["workload"])
Esempio n. 2
0
 def get_status(cls) -> List[Status]:
     """Close worker pool."""
     response = cls._send_message_to_dbm(
         Request(header=Header(message="status"), body={}))
     return [
         Status(**interface) for interface in response["body"]["status"]
     ]
Esempio n. 3
0
    def get_databases(cls) -> List[DetailedDatabase]:
        """Get all Databases.

        Returns a list of all databases with detailed information.
        """
        response = cls._send_message_to_dbm(
            Request(header=Header(message="get databases"), body={}))
        return [
            DetailedDatabase(**interface)
            for interface in response["body"]["databases"]
        ]
Esempio n. 4
0
 def get_metric(cls) -> Dict:
     _ = cls._send_message_to_dbm(
         Request(header=Header(message="get metric"), body={}))
     fake_metric_information = {
         "customer": {
             "size": 10000,
             "number_columns": 2
         },
         "supplier": {
             "size": 400,
             "number_columns": 1
         },
         "throughput": 42,
         "latency": 42,
     }
     return {"id": "foo", "results": fake_metric_information}
def run_clinet(runs):
    context = Context()
    socket = context.socket(REQ)
    socket.connect(f"tcp://{DB_MANAGER_HOST}:{DB_MANAGER_PORT}")
    latency = []
    start_benchmark = time_ns()
    for _ in range(runs):
        start_ts = time_ns()
        socket.send_json(Request(header=Header(message="get metric"), body={}))
        _ = socket.recv_json()
        end_ts = time_ns()
        latency.append(end_ts - start_ts)
    end_benchmark = time_ns()
    return {
        "latency": latency,
        "run_time": (end_benchmark - start_benchmark),
        "runs": runs,
    }
Esempio n. 6
0
 def close_worker_pool(cls) -> int:
     """Close worker pool."""
     response = cls._send_message_to_dbm(
         Request(header=Header(message="close worker"), body={}))
     return response["header"]["status"]
Esempio n. 7
0
 def deregister_database(cls, interface: DatabaseInterface) -> int:
     """Remove database from manager."""
     response = cls._send_message_to_dbm(
         Request(header=Header(message="delete database"),
                 body=dict(interface)))
     return response["header"]["status"]
Esempio n. 8
0
 def register_database(cls, interface: DetailedDatabaseInterface) -> int:
     """Add a database to the manager."""
     response = cls._send_message_to_dbm(
         Request(header=Header(message="add database"),
                 body=dict(interface)))
     return response["header"]["status"]
Esempio n. 9
0
 def delete(cls) -> int:
     """Stop a Workload."""
     response = cls._send_message_to_gen(
         Request(header=Header(message="stop workload"), body={}), )
     return response["header"]["status"]
Esempio n. 10
0
 def create(cls, interface: WorkloadInterface) -> int:
     """Create a Workload."""
     response = cls._send_message_to_gen(
         Request(header=Header(message="start workload"),
                 body=dict(interface)), )
     return response["header"]["status"]