Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
6a8b9b6
ENH: Add default_zmq_context
Debilski Jan 29, 2025
81006a4
BF: Do not crash tk when no team name is passed
Debilski Jun 9, 2025
8646bf7
BF: Keyboard interrupt should not cause a freeze
Debilski Jun 6, 2025
05aec98
ENH: Better bot repr
Debilski Jun 20, 2025
bba5358
RF: New network/subprocess protocol
Debilski Jun 20, 2025
037f20f
BF: Fix remote test
Debilski Jun 20, 2025
7397f86
RF: New error handling mechanism, errors renamed to timeouts
Debilski Jun 22, 2025
c949728
BF: Playing with bad rounds or no food should trigger FAILURE
Debilski Jun 22, 2025
19bf9c1
RF: Use game_phase in prepare_bot_state
Debilski Jun 22, 2025
ed66c4a
RF: Rename allow_exceptions → raise_bot_exceptions
Debilski Jun 22, 2025
1c523b4
ENH: When a UI controller exits in init, we go into failure mode
Debilski Jun 22, 2025
289a2b8
ENH: Rename Errors to Timeouts in Tk
Debilski Jun 23, 2025
5157fb7
RF: Remove timeout handling from apply_move
Debilski Jun 23, 2025
c57f72b
RF: Use more game_phases
Debilski Jun 23, 2025
f4b557e
BF: Fix timeout counting
Debilski Jul 2, 2025
78375e4
TST: Test that long team names are detected
Debilski Jul 3, 2025
cf17dbe
UI: Show failure
Debilski Jul 3, 2025
b42f710
RF: Cleanup superfluous functions
Debilski Jul 3, 2025
0f7cbcc
RF: Raise (if needed) from add_fatal_error
Debilski Jul 3, 2025
1941050
RF: Print the error before potential exceptions are raised
Debilski Jul 3, 2025
ac9ad35
TST: Add network protocol test
Debilski Jul 30, 2025
e7e3dec
ENH: Add 60*60 second timeout to pelita_player
Debilski Jul 30, 2025
6925dc0
ENH: Reorganise remote Team classes
Debilski Jul 30, 2025
4595c22
ENH: Remove xfail
Debilski Aug 26, 2025
a26625c
TST: Add test for --no-timeout cli option
Debilski Aug 26, 2025
0455642
BF: Fix --no-timeout
Debilski Aug 26, 2025
d4ce537
BF: Fix default_zmq_context
Debilski Aug 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/test_pytest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ jobs:
- name: Run Pelita CLI as a script
run: |
pelita --null --rounds 100 --size small
- name: Run Pelita CLI without timeouts
run: |
pelita --null --rounds 100 --size small --no-timeout
- name: Test Pelita template repo
run: |
# We must clone pelita_template to a location outside of the pelita repo
Expand Down
4 changes: 2 additions & 2 deletions contrib/ci_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
from rich.console import Console
from rich.table import Table

from pelita.network import ZMQClientError
from pelita.network import RemotePlayerFailure
from pelita.scripts.script_utils import start_logging
from pelita.tournament import call_pelita, check_team

Expand Down Expand Up @@ -126,7 +126,7 @@ def load_players(self):
_logger.debug('Querying team name for %s.' % pname)
team_name = check_team(player['path'])
self.dbwrapper.add_team_name(pname, team_name)
except ZMQClientError as e:
except RemotePlayerFailure as e:
e_type, e_msg = e.args
_logger.debug(f'Could not import {player} at path {path} ({e_type}): {e_msg}')
player['error'] = e.args
Expand Down
2 changes: 1 addition & 1 deletion demo/benchmark_game.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
layout = parse_layout(LAYOUT)

def run(teams, max_rounds):
return run_game(teams, max_rounds=max_rounds, layout_dict=layout, print_result=False, allow_exceptions=True, store_output=subprocess.DEVNULL)
return run_game(teams, max_rounds=max_rounds, layout_dict=layout, print_result=False, raise_bot_exceptions=True, store_output=subprocess.DEVNULL)

def parse_args():
parser = argparse.ArgumentParser(description='Benchmark pelita run_game')
Expand Down
6 changes: 6 additions & 0 deletions pelita/base_utils.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from random import Random

import zmq

def default_rng(seed=None):
"""Construct a new RNG from a given seed or return the same RNG.
Expand All @@ -12,3 +13,8 @@ def default_rng(seed=None):
if isinstance(seed, Random):
return seed
return Random(seed)

def default_zmq_context(zmq_context=None):
if zmq_context is None:
return zmq.Context()
return zmq_context
19 changes: 8 additions & 11 deletions pelita/exceptions.py
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@

class FatalException(Exception): # TODO rename to FatalGameException etc
pass

class NonFatalException(Exception):
class NoFoodWarning(Warning):
""" Warns when a layout has no food during setup. """
pass

class PlayerTimeout(NonFatalException):
class GameOverError(Exception):
""" raised from game when match is game over """
pass

class PlayerDisconnected(FatalException):
# unsure, if PlayerDisconnected should be fatal in the sense of that the team loses
# it could simply be a network error for both teams
# and it would be random who will be punished
class PelitaBotError(Exception):
""" Raised when raise_bot_exceptions is turned on """
pass

class NoFoodWarning(Warning):
""" Warns when a layout has no food during setup. """
class PelitaIllegalGameState(Exception):
""" Raised when there is something wrong with the game state """
pass
Loading