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

Gameweek start day #651

Open
rohanday3 opened this issue Nov 3, 2023 · 3 comments
Open

Gameweek start day #651

rohanday3 opened this issue Nov 3, 2023 · 3 comments

Comments

@rohanday3
Copy link

Is there currently a way to check the start day of a given game week? I'm working on automating the transfer process to run the pipeline periodically but the game weeks don't start on the same day or time each week.

@nbarlowATI
Copy link
Member

We don't currently have a command-line way of doing this (though it could be an easy/fun thing for someone to put in), but it's possible via a couple of commands at the python prompt:

>>> from airsenal.framework.utils import *
>>> fixtures = get_fixtures_for_gameweek(get_next_gameweek())
>>> sorted([f.date for f in fixtures])

should hopefully give an ordered list of fixture times for the upcoming gameweek.

@rohanday3
Copy link
Author

rohanday3 commented Nov 3, 2023

Awesome, I didn't realize that the transfer deadline was always linked to the first match of the gameweek. This makes it alot easier, I was thinking of using crontab to schedule the task and then the task will update the cronjob for the following week. Do you have any advice or suggestions for me?

EDIT:
I was looking through the FPLDataFetcher and there is a function get_transfer_deadlines() that returns a list of deadlines, would it make sense to just set cron jobs for n time before all the deadlines to run a script to run the pipeline and do transfers and also update the future cron jobs in case there were any changes?

@nbarlowATI
Copy link
Member

Yep, that could make sense - would protect against being caught out by midweek or Friday deadlines! I'm not really an expert on crontab, but it seems a sensible tool for the job, as long as you have a machine that is online at the necessary times. The other alternative if that isn't the case could be some sort of cloud-based serverless compute (Amazon Lambda or Azure Functions)?

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

2 participants