acoustic-library-86413
10/30/2023, 2:15 PMexecution_mode=venv
for PEXes ran inside Docker images? It's taking around 2 minutes to start inside the Docker image, and only a couple of seconds on my local machine. The Docker image is using Debian 10, and the host machine is running Ubuntu 22.04.wide-midnight-78598
10/30/2023, 2:56 PMacoustic-library-86413
10/30/2023, 2:57 PMacoustic-library-86413
10/30/2023, 2:59 PMprefect
as a PEX binary. Without execution_mode=venv
it fails with an error No module named uvicorn
since it's trying to use Uvicorn from my local interpreter instead of from the PEX.wide-midnight-78598
10/30/2023, 2:59 PMwide-midnight-78598
10/30/2023, 3:00 PMacoustic-library-86413
10/30/2023, 3:00 PMacoustic-library-86413
10/30/2023, 3:01 PMwide-midnight-78598
10/30/2023, 3:01 PMwide-midnight-78598
10/30/2023, 3:01 PMwide-midnight-78598
10/30/2023, 3:03 PMpex_binary(
name="apigateway",
entry_point="apigateway.main",
dependencies=[":libapigateway"],
output_path="apps/apigateway/apigateway.pex",
include_tools=True,
)
COPY apigateway.pex /apigateway.pex
RUN PEX_TOOLS=1 /apigateway.pex venv /app
WORKDIR /app
wide-midnight-78598
10/30/2023, 3:06 PMscie
to package up python interpreters and my pexes, and then on first-run, I take the slow first-boot hit, BUT, I guess you could also just eagerly run something like this (which is basically similar to what's on that PEX page)
pex_binary(
name="apigateway-pex",
dependencies=[
":libapigateway",
"//:reqs#uvicorn",
"//:reqs#gunicorn",
],
include_tools=True,
platforms=["linux-x86_64-cp-311-cp311", "macosx-13.3-arm64-cp-311-cp311",]
)
scie_binary( <-- This is my plugin, not in Pants
name="apigateway",
dependencies=[":apigateway-pex"],
platforms=["linux-x86_64", "macos-aarch64"],
lift="lift.toml",
)
[[lift.commands]]
exe = "{scie.bindings.venv}/venv/bin/uvicorn"
args = ["apigateway.main:app", "--port", "7999"]
[[lift.bindings]]
name = "venv"
description = "Installs the APIGateway into a venv and pre-compiles .pyc"
exe = "#{cpython:python}"
args = [
"{:apigateway-pex}",
"venv",
"--bin-path",
"prepend",
"--compile",
"--rm",
"all",
"{scie.bindings}/venv",
]
wide-midnight-78598
10/30/2023, 3:07 PMpex
documentation about running gunicorn, and running in Docker - you should be able to build up a pre-compiled image, which has the best of both worldsacoustic-library-86413
10/30/2023, 3:08 PMwide-midnight-78598
10/30/2023, 3:08 PMnginx unit
because it needed stuff in a certain location.acoustic-library-86413
10/30/2023, 3:16 PMwide-midnight-78598
10/30/2023, 3:20 PMwide-midnight-78598
10/30/2023, 3:21 PMacoustic-library-86413
10/30/2023, 3:21 PMwide-midnight-78598
10/30/2023, 3:22 PMacoustic-library-86413
10/30/2023, 3:30 PMwide-midnight-78598
10/30/2023, 3:33 PMacoustic-library-86413
10/30/2023, 3:33 PMacoustic-library-86413
10/30/2023, 5:36 PMacoustic-library-86413
10/30/2023, 5:37 PMbroad-processor-92400
10/30/2023, 7:32 PMwide-midnight-78598
10/30/2023, 9:15 PMwide-midnight-78598
10/30/2023, 9:16 PMacoustic-library-86413
10/31/2023, 8:03 AMacoustic-library-86413
10/31/2023, 9:57 AMfrom example_service.flows import example_flow
are not working either. Can anyone point me in the right direction here?broad-processor-92400
10/31/2023, 10:09 AMbroad-processor-92400
10/31/2023, 10:11 AMacoustic-library-86413
10/31/2023, 10:44 AMacoustic-library-86413
10/31/2023, 12:21 PMenough-analyst-54434
10/31/2023, 12:29 PMenough-analyst-54434
10/31/2023, 12:30 PMacoustic-library-86413
10/31/2023, 1:30 PMenough-analyst-54434
10/31/2023, 2:56 PM