#1 by Trontatuma
I have this very strange problem that players are waiting for another player even though all players have joined the game (see attachment).
I am assigning players randomly to one of three markets (see below). The error must be there but I have no idea why. Anybody has had similar problems?
def creating_session(subsession: Subsession):
players_in_all_groups = []
for group in subsession.get_groups():
players_in_all_groups.extend(group.get_players())
# group matrix numbers are based on player.id_in_subsession
players_in_large_market_1 = [p.id_in_subsession for p in players_in_all_groups if
p.participant.vars['large_market_1'] is True or p.participant.vars[
'large_market_1'] is None]
players_in_large_market_2 = [p.id_in_subsession for p in players_in_all_groups if
p.participant.vars['large_market_2'] is True or p.participant.vars[
'large_market_2'] is None]
players_in_small_market = [p.id_in_subsession for p in players_in_all_groups if
p.participant.vars['large_market'] is False]
matrix = []
if players_in_large_market_1 is not []:
matrix.append(players_in_large_market_1)
if players_in_large_market_2 is not []:
matrix.append(players_in_large_market_2)
if players_in_small_market is not []:
matrix.append(players_in_small_market)
#print(matrix)
subsession.set_group_matrix(matrix)
print(subsession.get_group_matrix())
session = subsession.session
for group in subsession.get_groups():
if group.get_players()[0].participant.vars['large_market_1'] is True:
group.marketID = 1
group.large_market = True
group.large_market_1 = True
group.large_market_2 = False
group.players_in_group = session.config['size_large_market']
group.employers_in_group = session.config['num_employers_large_market']
group.num_unmatched_workers = group.players_in_group - session.config['num_employers_large_market']
group.num_unmatched_jobs = session.config['num_employers_large_market'] * 2
elif group.get_players()[0].participant.vars['large_market_2'] is True:
group.marketID = 2
group.large_market = True
group.large_market_1 = False
group.large_market_2 = True
group.players_in_group = session.config['size_large_market']
group.employers_in_group = session.config['num_employers_large_market']
group.num_unmatched_workers = group.players_in_group - session.config['num_employers_large_market']
group.num_unmatched_jobs = session.config['num_employers_large_market'] * 2
else:
group.marketID = 3
group.large_market = False
group.large_market_1 = False
group.large_market_2 = False
group.players_in_group = session.config['size_small_market']
group.employers_in_group = session.config['num_employers_small_market']
group.num_unmatched_workers = group.players_in_group - session.config['num_employers_small_market']
group.num_unmatched_jobs = session.config['num_employers_small_market'] * 2
#2 by Trontatuma
I am catching this error in Senty but am not sure why.
Stack Trace
ProgrammingError
(psycopg2.errors.DuplicateTable) relation "otree_chatmessage" already exists
[SQL:
CREATE TABLE otree_chatmessage (
id SERIAL NOT NULL,
channel VARCHAR(255),
participant_id INTEGER,
nickname VARCHAR(255),
body TEXT,
timestamp FLOAT,
PRIMARY KEY (id),
FOREIGN KEY(participant_id) REFERENCES otree_participant (id) ON DELETE CASCADE
)
]
(Background on this error at: http://sqlalche.me/e/13/f405)
mechanismexcepthook
handledfalse
Crashed in non-app:
sqlalchemy/engine/default.py in do_execute
otree in <module> at line 8
In App
import re
import sys
from otree.main import execute_from_command_line
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0])
sys.exit(execute_from_command_line())
Add the GitHub or GitLab integration to jump straight to your source code
__annotations__
{}
__builtins__
<module 'builtins' (built-in)>
__cached__
None
__doc__
None
__file__
'/app/.heroku/python/bin/otree'
__loader__
<_frozen_importlib_external.SourceFileLoader object at 0x7fb402859c10>
__name__
'__main__'
__package__
None
__spec__
None
re
<module 're' from '/app/.heroku/python/lib/python3.9/re.py'>
DuplicateTable
relation "otree_chatmessage" already exists
#3 by Trontatuma
And in papertail, I am now seeing a lot of these kind of error messages Sep 19 05:20:15 gefinal app/postgres.9200 [DATABASE] [47-1] sql_error_code = 00000 time_ms = "2023-09-19 12:20:14.511 UTC" pid="895" proc_start_time="2023-09-19 12:20:13 UTC" session_id="650991fd.37f" vtid="10/868" tid="2597" log_line="40" database="dc8m2uftlqpn12" connection_source="52.211.112.45(53300)" user="u54gqrd9soer07" application_name="[unknown]" LOG: statement: Sep 19 05:20:15 gefinal app/postgres.9200 [DATABASE] [47-2] CREATE TABLE otree_taskqueuemessage ( Sep 19 05:20:15 gefinal app/postgres.9200 [DATABASE] [47-3] id SERIAL NOT NULL, Sep 19 05:20:15 gefinal app/postgres.9200 [DATABASE] [47-4] method VARCHAR(50), Sep 19 05:20:15 gefinal app/postgres.9200 [DATABASE] [47-5] kwargs_json TEXT, Sep 19 05:20:15 gefinal app/postgres.9200 [DATABASE] [47-6] epoch_time INTEGER, Sep 19 05:20:15 gefinal app/postgres.9200 [DATABASE] [47-7] PRIMARY KEY (id) Sep 19 05:20:15 gefinal app/postgres.9200 [DATABASE] [47-8] )
#4
by
Trontatuma
This only happens when deploying on Heroku it seems