async def launch_edge_async( pw_instance: "AsyncPlaywrightContextManager", h3: bool, endpoint: Endpoint, warmup: bool, qlog: bool, pcap: bool, expnt_id: int, run_id: int, ) -> json: edge_args = [] if (h3): edge_args = [ "--enable-quic", "--quic-version=h3-29", "--disable-http2" ] domain = endpoint.get_domain() port = endpoint.get_port() edge_args.append(f"--origin-to-force-quic-on={domain}:{port}") if qlog: qlog_dir = f"{os.getcwd()}/results/async-qlogs/{expnt_id}/edge/" edge_args.append(f"--log-net-log={qlog_dir}/{run_id}.netlog") # attempt to launch browser try: if pcap: pcap_file = f"{os.getcwd()}/results/packets/async-{expnt_id}/edge/{run_id}-{h3}.keys" return await pw_instance.chromium.launch( headless=True, executable_path='/opt/microsoft/msedge-dev/msedge', args=edge_args, env={"SSLKEYLOGFILE": pcap_file}) else: return await pw_instance.chromium.launch( headless=True, executable_path='/opt/microsoft/msedge-dev/msedge', args=edge_args, ) except Exception as e: # if browser fails to launch, stop this request and write to the database logger.error(str(e)) return None
async def launch_chromium_async( pw_instance: "AsyncPlaywrightContextManager", h3: bool, endpoint: Endpoint, warmup: bool, qlog: bool, pcap: bool, expnt_id: int, run_id: int, ) -> json: chromium_args = [] if h3: # set up chromium arguments for enabling h3, qlog, h3 version chromium_args = [ "--enable-quic", "--quic-version=h3-29", "--disable-http2" ] domain = endpoint.get_domain() port = endpoint.get_port() chromium_args.append(f"--origin-to-force-quic-on={domain}:{port}") if qlog: # set up a directory results/qlogs/chromium/[experimentID] to save qlog qlog_dir = f"{os.getcwd()}/results/qlogs/async-{expnt_id}/chromium/" chromium_args.append(f"--log-net-log={qlog_dir}/{run_id}.netlog") # attempt to launch browser try: if pcap: pcap_file = f"{os.getcwd()}/results/packets/async-{expnt_id}/chromium/{run_id}-{h3}.keys" return await pw_instance.chromium.launch( headless=True, args=chromium_args, env={"SSLKEYLOGFILE": pcap_file}) else: return await pw_instance.chromium.launch( headless=True, args=chromium_args, ) except Exception as e: # if browser fails to launch, stop this request and write to the database logger.error(str(e)) return None