Hello! I’ve been trying to play with `restartable`...
# general
m
Hello! I’ve been trying to play with
restartable
concept, but it seems that I misconfigure something or it’s not that powerful as I thought it is, because it restarts the app on every change in the repo not inputs only. Details in the thread 🧵.
I have the following layout:
Copy code
another
  b.py
  BUILD
src
  a.py
  main.py
  BUILD
where
main.py
has the following contents:
Copy code
from a import foo


def app():
    foo()
    while True:
        pass


if __name__ == "__main__":
    app()
and
BUILD
in src is
Copy code
python_sources()
pex_binary(
    name="app",
    entry_point="main.py",
    restartable=True,
)
I run
./pants run src:app
and get my output. After that I update
a.py
and it expectedly re-runs. Then I change
b.py
, which isn’t connected to my app target in any ways, but the app still restarts. Do I misunderstand something? Shouldn’t only the changes in inputs of the running target affect the app restart?
h
You're correct about what should happen
It is surprising that it is not what is happening in practice
What does
./pants dependencies --transitive src:app
show?
That will help establish if Pants is seeing a dep on
b
for some reason
m
Copy code
╰─ ./pants dependencies --transitive src:app
src/a.py
src/main.py
h
What about if you
./pants run src/main.py
?
m
As it runs
python_source
target, it’s not possible to make it restartable (as of 2.14.0), so it doesn’t react to any changes.
There is a project (with some run logs as well), maybe you can check if it reproduces for you?