Closed JnBrymn closed 3 years ago
I'm checking on my QA to see if it works:
from background_task.models import Task
print('\n'.join([f'{t.task_name}: {t.task_params}' for t in Task.objects.all()]))
# this is correct:
# matchmaking.tasks._request_matches_task: [[], {"slack_team_id": "TNJ631DFU"}]
#so we run it
from matchmaking.tasks import _request_matches_task
_request_matches_task.now(**{"slack_team_id": "TNJ631DFU"})
# and it worked and everyone requested a match
# So we check and then run the matches
print('\n'.join([f'{t.task_name}: {t.task_params}' for t in Task.objects.all()]))
# matchmaking.tasks._make_matches_task: [[], {"slack_team_id": "TNJ631DFU"}]
# correct - running it manually
from matchmaking.tasks import _make_matches_task
_make_matches_task.now(**{"slack_team_id": "TNJ631DFU"})
# logged: "make_matches for TNJ631DFU"
Two more steps to go.
If you'll recall, before the break I set up my QA environment to do automated tests and we saw that _request_matches_task
worked because Colin, Sydney, Nick and I were able to sign up to meet in a few different channels.
Today I made a couple of small changes and deployed to QA and ran this test there:
>>> from matchmaking.tasks import _make_matches_task, _remind_matches_task
>>> _make_matches_task.now('TNJ631DFU') # this is me manually calling the the next step which makes the matches
# here's the output
make_matches for TNJ631DFU: ['colin@cpdev.me', 'jfberryman@gmail.com'] in penny-university
make_matches for TNJ631DFU: ['nick.chouard@gmail.com', 'sydneycnoh@gmail.com'] in general
set up _remind_matches_task for TNJ631DFU
I looked in slack and it sent me this message
Then I ran the next step:
>>> _remind_matches_task.now('TNJ631DFU')
remind_matches for TNJ631DFU
And I received this message in slack
I think I'll deploy it!
what
connects
to the django background_tasks task_failed signal. If a task fails then the request matches is restarted. This is janky, but it seems like the best thing we have so that we don't have to restart everything by hand if there is a failurewhy
closes https://github.com/penny-university/penny_university/issues/299