Exemple #1
0
 def start_listening(self):
     """Start the gRPC server in a new thread."""
     self.server = grpc_server(futures.ThreadPoolExecutor(max_workers=1))
     add_SuperGSLCompilerServicer_to_server(self, self.server)
     self.server.add_insecure_port('[::]:50051')
     self.server.start()
     self.server.wait_for_termination()
Exemple #2
0
 def run(self):
     server = grpc_server(futures.ThreadPoolExecutor(max_workers=100))
     add_ServerServicer_to_server(Server(self.requests), server)
     server.add_insecure_port("0.0.0.0:" + self.port)
     server.start()
     try:
         print("I'm going sleep")
         while not self.stopEvent.isSet():
             sleep(timeToSleep)
     except KeyboardInterrupt:
         server.stop(0)
     self.stopEvent.clear()
     self.stopFinish.set()
Exemple #3
0
 def run(self):
     server = grpc_server(futures.ThreadPoolExecutor(max_workers=100))
     add_P2PServicer_to_server(self.chord, server)
     server.add_insecure_port("0.0.0.0:" + self.port)
     server.start()
     self.build_finger_table.start()
     try:
         print("I'm listen in chord!")
         while not self.stopEvent.isSet():
             sleep(timeToSleep)
     except KeyboardInterrupt:
         server.stop(0)
     self.stopEvent.clear()
     self.stopFinish.set()
Exemple #4
0
def run_server():
    """Run Artifact Manager gRPC server.

    Values like 'maxWorkers' and 'port' must be specified in a config file in .ini format.

    Config file path is specified by 'CONFIGURATION' environment variable.

    """
    max_workers: int = int(config["artifactManagerServer"]["maxWorkers"])
    server: grpc_server = grpc_server(ThreadPoolExecutor(max_workers=max_workers))

    add_BlueprintManagementServiceServicer_to_server(ArtifactManagerServicer(), server)
    port_number: int = int(config["artifactManagerServer"]["port"])
    server.add_insecure_port(f"[::]:{port_number}")

    click.echo(f"Server starts on port {port_number} using {max_workers} workers.")
    server.start()
    server.wait_for_termination()