alan-turing-institute / AIrsenal

Machine learning Fantasy Premier League team
MIT License
288 stars 86 forks source link

`airsenal_run_optimization` consistently fails to finish. #642

Open sam-cutter opened 12 months ago

sam-cutter commented 12 months ago

The airsenal_run_optimization command fails to finish, consistently halting execution at Total progress: 11%.

So far, I have run through the entire pipeline manually: airsenal_setup_initial_db, airsenal_check_data, airsenal_update_db, airsenal_run_prediction --weeks_ahead 3, airsenal_run_optimization --weeks_ahead 3. However, the airsenal_run_optimization command fails to finish.

My command output is below. Has the command, failed to finish executing, as the 11% suggests, or am I simply being misled by the command line output?

poetry run airsenal_run_optimization --weeks_ahead 3 --wildcard_week 8
Running optimization with fpl_team_id 9735281     

Would you like to login to the FPL API?
This is not necessary for most AIrsenal actions,  
but may improve accuracy of player sell values,   
and free transfers for your team, and will also   
enable AIrsenal to make transfers for you through 
the API. (y/n): n
/airsenal/airsenal/framework/data_fetcher.py:143: UserWarning: Skipping login which means AIrsenal may have out of date information for your team.
  warnings.warn(
/airsenal/airsenal/framework/optimization_utils.py:131: UserWarning: Failed to get current squad from API:
Unable to access FPL API: 403 Client Error: Forbidden for url: https://fantasy.premierleague.com/api/my-team/9735281/
Using DB instead, which may be out of date.
  warnings.warn(
Getting starting squad for 9735281
/airsenal/airsenal/framework/utils.py:419: UserWarning: Failed to get actual free transfers from a logged in API:
Unable to access FPL API: 403 Client Error: Forbidden for url: https://fantasy.premierleague.com/api/my-team/9735281/      
Will try to estimate it from the API without logging in, which will not include any transfers used in the current gameweek.
  warnings.warn(
  0%|                                                                                                                                                                                                                                                                                                                                    | 0/100 [00:00<?, ?it/s]  0%|                                                                                                                                                                                                                                                                                                                                    | 0/100 [00:00<?, ?it/sRunning optimisation without pygmo instead...                                                                                                                                                                                                                                                                                             | 0/100 [00:00<?, ?it/s]Total progress: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 9/9 [01:45<00:00, 11.75s/it]  0%|                                                                                                                                                                                                                                                                                                                                    | 0/100 [01:45<?, ?it/s]  0%|                                                                                                                                                                                                                                                                                                                                    | 0/100 [01:45<?, ?it/s]  0%|                                                                                                                                                                                                                                                                                                                                    | 0/100 [01:45<?, ?it/s]strategy: W-2-2: 100%|██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████▉| 99.99999999999976/100 [01:45<00:00,  1.06s/it]  0%|                                                                                                                                                                                                                                                                                                                                    | 0/100 [01:46<?, ?it/s]  0%|                                                                                                                                                                                                                                                                                                                                    | 0/100 [01:48<?, ?it/s]  0%|                                                                                                                                                                                                                                                                                                                                    | 0/100 [01:48<?, ?it/s]

====================================

Strategy for Team ID: 9735281
Baseline score: 160.81242508994208
Best score: 189.78030293358697
 ===============================================
 ========= Optimum strategy ====================
 ===============================================

 =========== Gameweek 8 ================

Chips played:  wildcard

Players in:                     Players out:
-----------                     ------------
Mohamed Salah                   Guglielmo Vicario
Pedro Porro                     Cristian Romero
Andrew Robertson                        Destiny Udogie
Eddie Nketiah                   Joachim Andersen
Raheem Sterling                 Matty Cash
Charlie Taylor                  Bryan Mbeumo
Joel Matip                      Jarrod Bowen
Phil Foden                      James Ward-Prowse
James Maddison                  Rodrigo Hernandez
Manor Solomon                   Pervis Estupiñán
Levi Colwill                    Solly March
Matt Turner                     Julián Álvarez

 =========== Gameweek 9 ================

Chips played:  None

Players in:                     Players out:
-----------                     ------------
Lucas Digne                     Levi Colwill

 =========== Gameweek 10 ================

Chips played:  None

Players in:                     Players out:
-----------                     ------------
Gabriel dos Santos Magalhães            Pedro Porro

==========================
 Total score: 189

Getting starting squad for 9735281

=== starting 11 ===

== GK ==

Alphonse Areola (WHU)

== DEF ==

Pedro Porro (TOT)
Andrew Robertson (LIV)
Levi Colwill (CHE)

== MID ==

Mohamed Salah (LIV)
Raheem Sterling (CHE)
Phil Foden (MCI)
James Maddison (TOT)(C)
Manor Solomon (TOT)

== FWD ==

Taiwo Awoniyi (NFO)
Erling Haaland (MCI)(VC)

=== subs ===

Joel Matip (LIV)
Eddie Nketiah (ARS)
Matt Turner (NFO)
Charlie Taylor (BUR)

Total progress:  11%|█████████████████████████████████▍ 
jack89roberts commented 12 months ago

I suspect this is a bug in displaying the output. The suggested strategy and lineup are only printed if the optimisation has finished, and you do also have a 100% progress message earlier in your output. It's weird though, we'll keep this open as something to look at.