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

on_event('startup') not registering #307

Closed
bpeake-illuscio opened this issue Feb 21, 2019 · 9 comments
Closed

on_event('startup') not registering #307

bpeake-illuscio opened this issue Feb 21, 2019 · 9 comments

Comments

@bpeake-illuscio
Copy link

bpeake-illuscio commented Feb 21, 2019

Hello,

I cannot seem to get the startup event to fire. Consider the following:

import responder


api = responder.API()


@api.on_event('startup')
async def phone_home():
    print("ALL SYSTEMS NOMINAL")


if __name__ == '__main__':
    api.run()

When run, I get the following output:

INFO: Started server process [61074]
INFO: Waiting for application startup.
INFO: Uvicorn running on http://127.0.0.1:5042 (Press CTRL+C to quit)

I've tried installing various versions of starlette. Including 9.0.0. Is there a pinned dependency somewhere pip might not be catching? I'd like to have a startup process that boots up some process executors and connects to a database. Let me know if there is anything else I can supply! This is a really cool library and I love writing services with it.

Here is a pip freeze of my environment.

aiofiles==0.4.0
alabaster==0.7.12
aniso8601==3.0.2
apispec==1.0.0
apistar==0.6.0
appdirs==1.4.3
asgiref==2.3.2
async-timeout==3.0.1
atomicwrites==1.3.0
attrs==18.2.0
autopep8==1.4.3
Babel==2.6.0
black==18.9b0
bumpversion==0.5.3
certifi==2018.11.29
chardet==3.0.4
Click==7.0
coverage==4.5.2
dacite-isle==0.0.1
dataclasses==0.6
docopt==0.6.2
docutils==0.14
entrypoints==0.3
flake8==3.7.6
gemma==1.0.4
grahamcracker==0.0.9
graphene==2.1.3
graphql-core==2.1
graphql-relay==0.4.5
graphql-server-core==1.1.1
h11==0.8.1
httptools==0.0.11
idna==2.8
imagesize==1.1.0
isleservice-objects==0.0.2
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.0
marshmallow==3.0.0rc4
mccabe==0.6.1
more-itertools==6.0.0
motor==2.0.0
mypy==0.670
mypy-extensions==0.4.1
packaging==19.0
parse==1.11.1
pluggy==0.8.1
promise==2.2.1
py==1.7.0
pycodestyle==2.5.0
pydicom==1.2.2
pyflakes==2.1.0
Pygments==2.3.1
pymongo==3.7.2
pyparsing==2.3.1
pytest==4.3.0
pytest-cov==2.6.1
pytest-html==1.20.0
pytest-metadata==1.8.0
pytest-sugar==0.9.2
python-dateutil==2.8.0
python-multipart==0.0.5
pytz==2018.9
PyYAML==3.13
requests==2.21.0
requests-toolbelt==0.9.1
responder==1.2.0
rfc3986==1.2.0
Rx==1.6.1
six==1.12.0
snowballstemmer==1.2.1
spanreed==0.0.9
Sphinx==1.8.4
sphinx-autodoc-typehints==1.6.0
sphinx-rtd-theme==0.4.3
sphinxcontrib-websupport==1.1.0
starlette==0.9.11
termcolor==1.1.0
toml==0.10.0
typed-ast==1.3.1
typing==3.6.6
typing-extensions==3.7.2
typing-inspect-isle==0.0.5
urllib3==1.24.1
uvicorn==0.4.5
uvloop==0.12.1
websockets==7.0
whitenoise==4.1.2
@taoufik07
Copy link
Collaborator

working for me

@taoufik07
Copy link
Collaborator

Make sure to have the last release of responder

@bpeake-illuscio
Copy link
Author

bpeake-illuscio commented Feb 21, 2019

Still having the same issue in a fresh venv (python 3.7.0 on OSX 10.14.1 - Mojave)

python -m venv ~/venvs/responder_test
souce ~/venvs/responder_test/bin/activate
pip install responder
python /Users/user/Documents/Source_Code/scratch/scratch1.py

pip freeze:

aiofiles==0.4.0
aniso8601==3.0.2
apispec==1.0.0
apistar==0.6.0
asgiref==2.3.2
async-timeout==3.0.1
certifi==2018.11.29
chardet==3.0.4
Click==7.0
docopt==0.6.2
graphene==2.1.3
graphql-core==2.1
graphql-relay==0.4.5
graphql-server-core==1.1.1
h11==0.8.1
httptools==0.0.11
idna==2.8
itsdangerous==1.1.0
Jinja2==2.10
MarkupSafe==1.1.0
marshmallow==2.18.1
parse==1.11.1
promise==2.2.1
python-multipart==0.0.5
PyYAML==3.13
requests==2.21.0
requests-toolbelt==0.9.1
responder==1.2.0
rfc3986==1.2.0
Rx==1.6.1
six==1.12.0
starlette==0.11.2
urllib3==1.24.1
uvicorn==0.4.5
uvloop==0.12.1
websockets==7.0
whitenoise==4.1.2

@taoufik07
Copy link
Collaborator

This was fixed but not yet released, for now try to work with the master branch

@bpeake-illuscio
Copy link
Author

Copy, thanks for the tip! Do you know when that release will be available via pip? It's always cumbersome pulling from github in a CI/CD setting.

@taoufik07
Copy link
Collaborator

Soon ;)

@bpeake-illuscio
Copy link
Author

(™) ;)

Thanks!

@timofurrer
Copy link
Contributor

I've just released v1.3.0 🎉

@bpeake-illuscio
Copy link
Author

Whoo! Thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants