Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG #221

Open
evanraalte opened this issue Sep 28, 2023 · 1 comment
Open

BUG #221

evanraalte opened this issue Sep 28, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@evanraalte
Copy link

Describe the bug
I'm trying to run the example described here.

It seems that the do_things function is not executed, when running the example

The expected behaviour is

To Reproduce
I modified the example a bit, so that files are touched and hence I can verify that the function do_things is run correctly.

main.py:

from rocketry import Rocketry
from pathlib import Path
app = Rocketry()

@app.task()
def do_things():
    Path("getting_here").touch()
if __name__ == "__main__":
    Path("getting_here_too").touch()
    app.session.run(do_things)

pyproject.toml:

[tool.poetry]
name = "rocketry_playground"
version = "0.1.0"
description = ""
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"
rocketry = "^2.5.1"
pydantic = "^1.10"
sqlalchemy = "1.4.41"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

Run:

poetry install
poetry run python main.py

Expected behavior
I expect there to be two files added after the script runs:

  • getting_here_too generated in the main loop
  • getting_here generated in the do_things function

Actual behavior

image

(note that the getting_here file is not generated.

@evanraalte evanraalte added the bug Something isn't working label Sep 28, 2023
@evanraalte
Copy link
Author

Just fixed it by checking out the run method from app.session. It should be:

from rocketry import Rocketry
app = Rocketry()

@app.task()
def do_things():
    print("Getting here")

if __name__ == "__main__":
    app.session.run("do_things",)

Could you confirm that this is indeed the correct way to call it? If so, I can make a PR to update the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant