python script works but heroku crashs
up vote
0
down vote
favorite
I am building an app for my dad which scraps the lotto results (beautifulsoup) and send them via email (sendgrid). I use heroku to run the script github repo on a scheduled basis. If I run it, it will work fine. The emails will be sent but the process crash's which restarts them because of the dyno restart policy. The crash isn't that bad because the script will do its job but the problem is the restart of the dyno, which leads to many emails sent. You will find the script in my repo.
My guess is the asynchronicity with beautiful soup and/or sendgrid. Do you know how to get better log information in heroku? If I comment out the actual email sending part and start the scheduler on ten minutes then it works but the worker doesn't.
My Procfile looks like:
worker: python lotto_mailer.py
Here is the server log.
Nov 19 05:56:36 lotto-mailer heroku/scheduler.2285: Starting process with command `if [ "$(date +%u)" = 1 ]; then python lotto_mailer.py; fi`
Nov 19 05:56:37 lotto-mailer heroku/scheduler.2285: State changed from starting to up
Nov 19 05:56:40 lotto-mailer heroku/scheduler.2285: State changed from up to complete
Nov 19 05:56:40 lotto-mailer heroku/scheduler.2285: Process exited with status 0
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: Ziehung vom Samstag, 17.11.2018
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: Gewinnzahlen: [3, 6, 18, 31, 39, 40] SZ: 5
... App OUTPUT ...
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: UTC Hour: 13
Don't get distracted by the command which the scheduler runs. It's just to run it only on mondays. It seems that only the worker crashs not the scheduler.
Nov 19 06:04:24 lotto-mailer heroku/worker.1: State changed from crashed to starting
Nov 19 06:04:29 lotto-mailer heroku/worker.1: Starting process with command `python lotto_mailer.py`
Nov 19 06:04:29 lotto-mailer heroku/worker.1: State changed from starting to up
Nov 19 06:04:29 lotto-mailer heroku/worker.1: State changed from crashed to starting
Nov 19 06:04:32 lotto-mailer heroku/worker.1: State changed from up to crashed
Nov 19 06:04:33 lotto-mailer heroku/worker.1: Process exited with status 0
Nov 19 06:04:33 lotto-mailer app/worker.1: Ziehung vom Samstag, 17.11.2018
Nov 19 06:04:33 lotto-mailer app/worker.1: Gewinnzahlen: [3, 6, 18, 31, 39, 40] SZ: 5
... APP OUTPUT ...
Why does the worker run at all? If you need further information, just let me now. Thank you for your help.
solution: I have recognized that I can deactivate the worker
here
and just let the scheduler run but the question remains, why does the worker crash.
python heroku beautifulsoup sendgrid
add a comment |
up vote
0
down vote
favorite
I am building an app for my dad which scraps the lotto results (beautifulsoup) and send them via email (sendgrid). I use heroku to run the script github repo on a scheduled basis. If I run it, it will work fine. The emails will be sent but the process crash's which restarts them because of the dyno restart policy. The crash isn't that bad because the script will do its job but the problem is the restart of the dyno, which leads to many emails sent. You will find the script in my repo.
My guess is the asynchronicity with beautiful soup and/or sendgrid. Do you know how to get better log information in heroku? If I comment out the actual email sending part and start the scheduler on ten minutes then it works but the worker doesn't.
My Procfile looks like:
worker: python lotto_mailer.py
Here is the server log.
Nov 19 05:56:36 lotto-mailer heroku/scheduler.2285: Starting process with command `if [ "$(date +%u)" = 1 ]; then python lotto_mailer.py; fi`
Nov 19 05:56:37 lotto-mailer heroku/scheduler.2285: State changed from starting to up
Nov 19 05:56:40 lotto-mailer heroku/scheduler.2285: State changed from up to complete
Nov 19 05:56:40 lotto-mailer heroku/scheduler.2285: Process exited with status 0
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: Ziehung vom Samstag, 17.11.2018
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: Gewinnzahlen: [3, 6, 18, 31, 39, 40] SZ: 5
... App OUTPUT ...
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: UTC Hour: 13
Don't get distracted by the command which the scheduler runs. It's just to run it only on mondays. It seems that only the worker crashs not the scheduler.
Nov 19 06:04:24 lotto-mailer heroku/worker.1: State changed from crashed to starting
Nov 19 06:04:29 lotto-mailer heroku/worker.1: Starting process with command `python lotto_mailer.py`
Nov 19 06:04:29 lotto-mailer heroku/worker.1: State changed from starting to up
Nov 19 06:04:29 lotto-mailer heroku/worker.1: State changed from crashed to starting
Nov 19 06:04:32 lotto-mailer heroku/worker.1: State changed from up to crashed
Nov 19 06:04:33 lotto-mailer heroku/worker.1: Process exited with status 0
Nov 19 06:04:33 lotto-mailer app/worker.1: Ziehung vom Samstag, 17.11.2018
Nov 19 06:04:33 lotto-mailer app/worker.1: Gewinnzahlen: [3, 6, 18, 31, 39, 40] SZ: 5
... APP OUTPUT ...
Why does the worker run at all? If you need further information, just let me now. Thank you for your help.
solution: I have recognized that I can deactivate the worker
here
and just let the scheduler run but the question remains, why does the worker crash.
python heroku beautifulsoup sendgrid
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am building an app for my dad which scraps the lotto results (beautifulsoup) and send them via email (sendgrid). I use heroku to run the script github repo on a scheduled basis. If I run it, it will work fine. The emails will be sent but the process crash's which restarts them because of the dyno restart policy. The crash isn't that bad because the script will do its job but the problem is the restart of the dyno, which leads to many emails sent. You will find the script in my repo.
My guess is the asynchronicity with beautiful soup and/or sendgrid. Do you know how to get better log information in heroku? If I comment out the actual email sending part and start the scheduler on ten minutes then it works but the worker doesn't.
My Procfile looks like:
worker: python lotto_mailer.py
Here is the server log.
Nov 19 05:56:36 lotto-mailer heroku/scheduler.2285: Starting process with command `if [ "$(date +%u)" = 1 ]; then python lotto_mailer.py; fi`
Nov 19 05:56:37 lotto-mailer heroku/scheduler.2285: State changed from starting to up
Nov 19 05:56:40 lotto-mailer heroku/scheduler.2285: State changed from up to complete
Nov 19 05:56:40 lotto-mailer heroku/scheduler.2285: Process exited with status 0
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: Ziehung vom Samstag, 17.11.2018
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: Gewinnzahlen: [3, 6, 18, 31, 39, 40] SZ: 5
... App OUTPUT ...
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: UTC Hour: 13
Don't get distracted by the command which the scheduler runs. It's just to run it only on mondays. It seems that only the worker crashs not the scheduler.
Nov 19 06:04:24 lotto-mailer heroku/worker.1: State changed from crashed to starting
Nov 19 06:04:29 lotto-mailer heroku/worker.1: Starting process with command `python lotto_mailer.py`
Nov 19 06:04:29 lotto-mailer heroku/worker.1: State changed from starting to up
Nov 19 06:04:29 lotto-mailer heroku/worker.1: State changed from crashed to starting
Nov 19 06:04:32 lotto-mailer heroku/worker.1: State changed from up to crashed
Nov 19 06:04:33 lotto-mailer heroku/worker.1: Process exited with status 0
Nov 19 06:04:33 lotto-mailer app/worker.1: Ziehung vom Samstag, 17.11.2018
Nov 19 06:04:33 lotto-mailer app/worker.1: Gewinnzahlen: [3, 6, 18, 31, 39, 40] SZ: 5
... APP OUTPUT ...
Why does the worker run at all? If you need further information, just let me now. Thank you for your help.
solution: I have recognized that I can deactivate the worker
here
and just let the scheduler run but the question remains, why does the worker crash.
python heroku beautifulsoup sendgrid
I am building an app for my dad which scraps the lotto results (beautifulsoup) and send them via email (sendgrid). I use heroku to run the script github repo on a scheduled basis. If I run it, it will work fine. The emails will be sent but the process crash's which restarts them because of the dyno restart policy. The crash isn't that bad because the script will do its job but the problem is the restart of the dyno, which leads to many emails sent. You will find the script in my repo.
My guess is the asynchronicity with beautiful soup and/or sendgrid. Do you know how to get better log information in heroku? If I comment out the actual email sending part and start the scheduler on ten minutes then it works but the worker doesn't.
My Procfile looks like:
worker: python lotto_mailer.py
Here is the server log.
Nov 19 05:56:36 lotto-mailer heroku/scheduler.2285: Starting process with command `if [ "$(date +%u)" = 1 ]; then python lotto_mailer.py; fi`
Nov 19 05:56:37 lotto-mailer heroku/scheduler.2285: State changed from starting to up
Nov 19 05:56:40 lotto-mailer heroku/scheduler.2285: State changed from up to complete
Nov 19 05:56:40 lotto-mailer heroku/scheduler.2285: Process exited with status 0
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: Ziehung vom Samstag, 17.11.2018
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: Gewinnzahlen: [3, 6, 18, 31, 39, 40] SZ: 5
... App OUTPUT ...
Nov 19 05:56:41 lotto-mailer app/scheduler.2285: UTC Hour: 13
Don't get distracted by the command which the scheduler runs. It's just to run it only on mondays. It seems that only the worker crashs not the scheduler.
Nov 19 06:04:24 lotto-mailer heroku/worker.1: State changed from crashed to starting
Nov 19 06:04:29 lotto-mailer heroku/worker.1: Starting process with command `python lotto_mailer.py`
Nov 19 06:04:29 lotto-mailer heroku/worker.1: State changed from starting to up
Nov 19 06:04:29 lotto-mailer heroku/worker.1: State changed from crashed to starting
Nov 19 06:04:32 lotto-mailer heroku/worker.1: State changed from up to crashed
Nov 19 06:04:33 lotto-mailer heroku/worker.1: Process exited with status 0
Nov 19 06:04:33 lotto-mailer app/worker.1: Ziehung vom Samstag, 17.11.2018
Nov 19 06:04:33 lotto-mailer app/worker.1: Gewinnzahlen: [3, 6, 18, 31, 39, 40] SZ: 5
... APP OUTPUT ...
Why does the worker run at all? If you need further information, just let me now. Thank you for your help.
solution: I have recognized that I can deactivate the worker
here
and just let the scheduler run but the question remains, why does the worker crash.
python heroku beautifulsoup sendgrid
python heroku beautifulsoup sendgrid
edited Nov 19 at 14:29
asked Nov 19 at 14:21
Algore87
87
87
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
worker is for web service/server not CLI app this is why it crash and you receive many email because it will auto restart if crash. worker is not required you can delete Procfile
or maybe create dummy server that actually scheduler using while
and sleep
.
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
worker is for web service/server not CLI app this is why it crash and you receive many email because it will auto restart if crash. worker is not required you can delete Procfile
or maybe create dummy server that actually scheduler using while
and sleep
.
add a comment |
up vote
0
down vote
worker is for web service/server not CLI app this is why it crash and you receive many email because it will auto restart if crash. worker is not required you can delete Procfile
or maybe create dummy server that actually scheduler using while
and sleep
.
add a comment |
up vote
0
down vote
up vote
0
down vote
worker is for web service/server not CLI app this is why it crash and you receive many email because it will auto restart if crash. worker is not required you can delete Procfile
or maybe create dummy server that actually scheduler using while
and sleep
.
worker is for web service/server not CLI app this is why it crash and you receive many email because it will auto restart if crash. worker is not required you can delete Procfile
or maybe create dummy server that actually scheduler using while
and sleep
.
answered Nov 19 at 16:44
ewwink
6,50122233
6,50122233
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53376621%2fpython-script-works-but-heroku-crashs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown