agreeable-carpet-43488
06/04/2024, 9:31 AMtest.py
that looks like this:
with open("/tmp/A/file", "wt") as test_file:
test_file.write("pliz work")
Also in my pants.toml
i have this configured:
remote_execution = true
remote_cache_read = true
remote_cache_write = true
remote_store_address = "grpc://<remote_ip>:50051"
remote_execution_address = "grpc://<remote_ip>:50051"
remote_instance_name = ""
process_execution_remote_parallelism = 4
pants_version = "2.19.1"
pantsd=false
...
...
[environments-preview.names]
remote = "//:buildgrid_remote"
and in the relevant BUILD
file:
pex_binary(
name = "test",
entry_point="test.py",
environment="remote"
)
However when I run the command pants run :test
the file /tmp/A/file
is created on the local machine and not the remote server
A. is this happy flow?
and B. if so can i get pants to execute the code on the remote machine?happy-kitchen-89482
06/04/2024, 2:44 PMrun
are that it always runs locally, because the process you run can be interactive, and is allowed to create side-effects on the local system. Remote execution is for "sandboxed" processes. For example, if you put your code into a python_tests
target and run it with pants test
you should get remote exec.agreeable-carpet-43488
06/05/2024, 10:55 AMrun
target what you get is more "remote build" then "remote execution"
anyway thank you for the response it just saved me a lot of headaches lol
I ended up opting for a different solution i'll explain it here shortly in case anyone needs it in the future 🙂
I set it so that you can run the code from the remote manually buy it will automatically update the code to what's on the local machine every time before pants "runs" (pants runs it and executes it just very early on)
using rsync to get the file and running it from the .pants.bootstrap
file
if anyone is interested in more details and maybe an example feel free to reach out to me 🙂