StoneT2000 / Dimensions

A Generalized Artificial Intelligence Competition Framework. And yes, its in Typescript for good reason
MIT License
74 stars 7 forks source link

Example(rock-paper-scissors) run error #62

Open ziyeZzz opened 4 years ago

ziyeZzz commented 4 years ago

Hello,

I tried to run the "rock-paper-scissors" example in a Linux machine, but it returns some error like:

[ERROR] (match_87VWpRGIWOt4) - agent 1 - 'agent_1' timed out after 1000 ms

The full messages are: ` [zhouzy@login05 rock-paper-scissors]$ node rps.js [ERROR] (Rock Paper Scissors Log) - WARNING: Running in non-secure mode. You will not be protected against malicious bots [INFO] (Rock Paper Scissors Log) - Created Dimension - ID: hwuJOc, Name: Rock Paper Scissors

-=-=-=-=-=-=-=-=-=-=-=-| [INFO] match_9I00TvMd2GKs |-=-=-=-=-=-=-=-=-=-=-=-

[INFO] (match_9I00TvMd2GKs) - Design: RPS! | Initializing match - ID: 9I00TvMd2GKs, Name: match_9I00TvMd2GKs [INFO] (RPS Best of 101 Tournament) - Created Tournament - ID: 4VnCfZ, Name: RPS Best of 101 Tournament [INFO] (RPS Best of 101 Tournament) - Initialized Ladder Tournament

-=-=-=-=-=-=-=-=-=-=-=-| [INFO] Station Log |-=-=-=-=-=-=-=-=-=-=-=-

[INFO] (Station Log) - Running 'Station' API at port 9000 [INFO] (Station Log) - Observing dimensions: Rock Paper Scissors [ERROR] (match_9I00TvMd2GKs) - agent 1 - 'agent_1' timed out after 1000 ms { scores: { '0': 0, '1': 0 }, ties: 0, winner: 'agent_0', loser: 'agent_1', winnerID: 0, terminated: { '1': 'terminated' } } ` The shell did not exit, it got stuck there. I do not know if there is something wrong.

my steps are as followings: 1) git clone from this repo 2) install npm 3) cd Dimensions directory 4) npm install P.S. if I cd the Dimensions directory, and run "npm install dimensions-ai", it will says that I can not install it in the same name's directory. If I run the "npm install dimensions-ai" outside of the Dimensions directory, it will says that I miss some json file. So I tried to "npm install" in Dimensions directory directly. It seems to updates some packages successfully. 5) node rpm.js 6) Error here: "Dimension.Tournament.rankSystem.TRUESKILL " this line(around line 326 in rpm.js file) reports that "rankSystem does not have TRUESKILL", so I checked the source code, and found that "RankSystem" might be misspelled as "rankSystem". I changed line 326 in rpm.js from "Dimension.Tournament.rankSystem.TRUESKILL " to "Dimension.Tournament.RankSystem.TRUESKILL " It seems to work. 7) node rpm.js 8) error as I reported in the beginning.

I have no idea where is wrong. Could you please help me to check this example? Thanks a lot.

Wish you have a nice day. Best regards, Ziye

StoneT2000 commented 4 years ago

Oh yeah, sorry that's a typo, good catch!

Also, the reason why it doesn't exit is because it starts a local server served at localhost:9000, allowing you to see whats happening in the tournament.

Also just noticed, the example code doesn't run the tournament, you will have to add tourney.run() to see it happen on the terminal

ziyeZzz commented 4 years ago

Hello,

@StoneT2000 Thanks for your reply. I added tourney.run() in the last line, it looks closer to the right answer now. :+1:

But it reports that it "cannot find uptime from /proc/uptime".
Do you know how can I fix this error?

`-=-=-=-=-=-=-=-=-=-=-=-| [INFO] match_QqPl80lerkOK |-=-=-=-=-=-=-=-=-=-=-=-

[INFO] (match_QqPl80lerkOK) - Design: RPS! | Initializing match - ID: QqPl80lerkOK, Name: match_QqPl80lerkOK [pidusage] We couldn't find uptime from /proc/uptime, using os.uptime() value [pidusage] We couldn't find uptime from /proc/uptime, using os.uptime() value [pidusage] We couldn't find uptime from /proc/uptime, using os.uptime() value [pidusage] We couldn't find uptime from /proc/uptime, using os.uptime() value [pidusage] We couldn't find uptime from /proc/uptime, using os.uptime() value [pidusage] We couldn't find uptime from /proc/uptime, using os.uptime() value [pidusage] We couldn't find uptime from /proc/uptime, using os.uptime() value [pidusage] We couldn't find uptime from /proc/uptime, using os.uptime() value [ERROR] (match_QqPl80lerkOK) - agent 1 - 'player-op8QE5qjvAFz' timed out after 1000 ms events.js:287 throw er; // Unhandled 'error' event ^

Error: spawn ps EMFILE at Process.ChildProcess._handle.onexit (internal/child_process.js:267:19) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) Emitted 'error' event on ChildProcess instance at: at Process.ChildProcess._handle.onexit (internal/child_process.js:273:12) at onErrorNT (internal/child_process.js:469:16) at processTicksAndRejections (internal/process/task_queues.js:84:21) { errno: 'EMFILE', code: 'EMFILE', syscall: 'spawn ps', path: 'ps', spawnargs: [ '-o', 'pid', '--no-headers', '--ppid', 10837 ] }`

Thank you. Wish you have a nice day. Best regards, Ziye

StoneT2000 commented 4 years ago

is this running the example file with the provided bot files in the example folder?

ziyeZzz commented 4 years ago

Yes

StoneT2000 commented 4 years ago

Can you try adding the following configuration to the design?

Try this instead:

let RPSDesign = new RockPaperScissorsDesign('RPS!', {
  engineOptions: {
    memory: {
      active: false
    }
  }
});

Replace the old design initialization with that. I'm currently looking into a possible issue with the pidusage package on some systems. Most likely its something wrong with the framework causing pidusage to error out.

This will disable the memory check on bots

ziyeZzz commented 4 years ago

Hi, thanks for your comments. I changed the design initialization and it works now.

But it flashed with the message"[ERROR] (match_QqPl80lerkOK) - agent 1 - 'player-op8QE5qjvAFz' timed out after 1000 ms"

Is this error message OK? I do not know if it is designed that some player will time out?

Thanks.

StoneT2000 commented 4 years ago

Whats the bot.js file for that player? If it timed out it means that it didn't respond correctly or in time to the match engine

ziyeZzz commented 4 years ago

I have no idea. Could you please tell me how to check which bot.js file is for that player? I used the bots under rock-paper-scissors, and changed nothing with those js files.

StoneT2000 commented 4 years ago

might be the python bot that crashed, to figure out which bot is which, give them a name as so

myDimension.runMatch(
  [{file: './bots/js/smarter.js', name: 'js'}, {file: './bots/python/rock.py', name:'py'}],
  {
    bestOf: 5
  }
).then((results) => {
  console.log(results);
});

the

[{file: './bots/js/smarter.js', name: 'js'}, {file: './bots/python/rock.py', name:'py'}]

is a bot list. By specifying the name, on error logs that name will show up instead of player-<random id> You can do the same with the tournament runner as well.

Could you test this without the tournament.run, just runMatch?

ziyeZzz commented 4 years ago

Hi, It seems to be the 'py' The error message is as following:

[ERROR] (match_lI8V3fe6NQ0r) - agent 1 - 'py' timed out after 1000 ms

StoneT2000 commented 4 years ago

Ok if you want, don’t use the python bot for now. To debug it, in the engine options add noStdErr: false

Any error output to stderr from bots will show up. I believe most likely your python version might not work or something

ziyeZzz commented 4 years ago

Thanks a lot.