Commit 08e66aa8 authored by drallensmith's avatar drallensmith

setup.py clarifications (will put in README.md next); reliability fix in HFO;...

setup.py clarifications (will put in README.md next); reliability fix in HFO; python_agents_3v3.sh for version compatibility testing
parent d56ba025
#!/usr/bin/env python
# encoding: utf-8
from __future__ import print_function
import subprocess, os, time, numpy, sys
# Global list of all/essential running processes
processes, necProcesses = [], []
# Command to run the rcssserver. Edit as needed.
# Command to run the rcssserver. Edit as needed; the below assumes running in the same directory as HFO
SERVER_BIN = 'rcssserver'
# Command to run the monitor. Edit as needed.
# Command to run the monitor. Edit as needed; ditto to the above re directories.
MONITOR_BIN = 'soccerwindow2'
def launch(cmd, name = 'Unknown', necessary = True, supressOutput = True):
def launch(cmd, name = 'Unknown', necessary = True, suppressOutput = True):
"""Launch a process.
Appends to list of processes and (optionally) necProcesses if
......@@ -19,10 +21,14 @@ def launch(cmd, name = 'Unknown', necessary = True, supressOutput = True):
Returns: The launched process.
"""
kwargs = {}
if supressOutput:
if suppressOutput:
kwargs = {'stdout': open('/dev/null', 'w'),
'stderr': open('/dev/null', 'w')}
try:
p = subprocess.Popen(cmd.split(' '), shell = False, **kwargs)
except (IOError, OSError):
print("ERROR: Unsuccessful launch of process {!r}".format(cmd), file=sys.stderr)
raise
processes.append(p)
if necessary:
necProcesses.append([p,name])
......@@ -66,7 +72,7 @@ def main(args):
try:
# Launch the Server
server = launch(serverCommand + serverOptions, name='server',
supressOutput=not args.verbose)
suppressOutput=not args.verbose)
time.sleep(0.2)
assert server.poll() is None,\
'[start.py] Failed to launch Server with command: \"%s\"' \
......
......@@ -2,9 +2,10 @@
./bin/HFO --offense-agents=2 --defense-npcs=3 --offense-npcs=1 --trials 20 --headless &
sleep 5
/usr/bin/python2.7 ./example/high_level_custom_agent.py --numTeammates=2 --numOpponents=3 --port 6000 &> agent1.txt &
# -x is needed to skip first line - otherwise whatever default python version is will run
python2.7 -x ./example/high_level_custom_agent.py --numTeammates=2 --numOpponents=3 --port 6000 &> agent1.txt &
sleep 5
/usr/bin/python3 ./example/high_level_custom_agent.py --numTeammates=2 --numOpponents=3 --port 6000 &> agent2.txt &
python3 -x ./example/high_level_custom_agent.py --numTeammates=2 --numOpponents=3 --port 6000 &> agent2.txt &
# The magic line
# $$ holds the PID for this script
......
......@@ -26,8 +26,16 @@ setup(name = 'hfo',
'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License',
'Operating System :: OS Independent',
'Operating System :: OS Independent', # except for shell scripts
'Programming Language :: C++',
'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3.2', # not tested
'Programming Language :: Python :: 3.3', # not tested
'Programming Language :: Python :: 3.4', # not tested
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6', # not tested
],
requires=['numpy'],
# packages=find_packages(),
packages=['hfo'],
package_dir={'hfo': 'hfo'},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment