Multi process argument error

Hello, there was a problem trying to expand and deploy the Boke server to multi-process.

this is simple code

server = Server({
num_proces = 5 # 5 process

if __name__ == ''__main__":

class ServiceHandler(RequestHandler):
    def get(self, deploymentID):
        args = self.request.arguments
        host_endpoint =
        model_history_id = args.get('modelHistoryID')[0].decode('utf8')
        start_time = args.get('startTime')[0].decode('utf8')
        end_time = args.get('endTime')[0].decode('utf8')

        if args.get('targetMetric') is not None:
            target_metric = args.get('targetMetric')[0].decode('utf8')
            target_metric = ""

        arg = {
            "inference_name": deploymentID,
            "model_history_id": model_history_id,
            "start_time": start_time,
            "end_time": end_time,
            "target_metric": target_metric

        template = env.get_template('embed.html')
        script = server_document(
            f"http://{host_endpoint}/api/v1/deployments/graph-svr/{deploymentID}/servicehealth", arguments=arg)
        temp = template.render(script=script, template="Tornado")

After running the template, the function of the path registered in server_document operates twice, with the value registered in the argument during the first operation, but the argument is empty during the second operation. I think it’s a problem that occurs because it’s a different process, is that right? Is there a solution?

@tp7019 you need to provide more information, specifically what version of Bokeh you are using.

bokeh == 2.4.2
tornado == 6.1

When requesting a graph in a multi-process state, the browser requests the first time
print(os.getpid()) == 55369 At this time, doc.session_context.request.arguments contains a value.

After that, the browser’s second request is print(os.getpid()) == 55370, and doc.session_context.request.arguments has no value.

first request

second reqeust

This is [BUG] Processing of HTTP request arguments (server_document) and num-procs > 1 · Issue #10183 · bokeh/bokeh · GitHub which was fixed in Bryanv/10183 token arguments by bryevdv · Pull Request #12222 · bokeh/bokeh · GitHub However, the fix is only available in Bokeh 3.0 (released today)

Thank you very much for your answer @Bryan
I will update to 3.0.0 now.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.