https://pantsbuild.org/ logo
w

worried-painter-31382

09/01/2022, 1:42 PM
Been trying to wrap
pants
invocations in pythons
subprocess
. So far it had worked ok, but using
Copy code
[python-repos]
indexes = [
    '<https://aws>:%(env.CODE_ARTIFACT_TOKEN)s@<our-python-repo>/simple
]
and adding the appropriate platform to the
pex_binary
causes
Copy code
subprocess.run(f'./pants package {dockerfile} --dynamic-ui=False', shell=True, text=True, env=os.environ)
to hang. Running
./pants package <the-dockerfile>
works, so it's something specific to
subprocess
I have confirmed that not using the
python-repos
section causes everything to work ok, and also that using the
python-repos
section outside of
subprocess
works ok.
Disabling
pantsd
seem to help, am I hitting some resource contention?
b

bitter-ability-32190

09/01/2022, 1:51 PM
Are you running your script through Pants itself? By default Pants doesnt support dsaemonized concurrent runs, and the subsequent runs "wait their turn"
w

worried-painter-31382

09/01/2022, 1:55 PM
No, the script that fires off the subprocess is the aws cdk
b

bitter-ability-32190

09/01/2022, 1:55 PM
Ah, worth a shot 🙂
w

worried-painter-31382

09/01/2022, 2:08 PM
Maybe I have an XY problem.. Is there a way to programmatically get a hold of the docker image ID:s after a
./pants package
run? Right now I use
image_sha = result.split('Docker image ID:')[1].strip()
from the subprocess run.
b

bitter-ability-32190

09/01/2022, 3:15 PM
I think parsing the output should be sufficient.
w

worried-painter-31382

09/01/2022, 3:24 PM
Right, the approach works minus that for some reason python subprocess cant seem to download via custom index in python-repos, its just epolling until the end of time 😢
b

bitter-ability-32190

09/01/2022, 3:25 PM
I'll leave those more experienced in that specific slice of Pants to answer. I couldn't tell you what's going on there 😞
3 Views