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 #!/usr/bin/env python
# encoding: utf-8 # encoding: utf-8
from __future__ import print_function
import subprocess, os, time, numpy, sys import subprocess, os, time, numpy, sys
# Global list of all/essential running processes # Global list of all/essential running processes
processes, necProcesses = [], [] 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' 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' MONITOR_BIN = 'soccerwindow2'
def launch(cmd, name = 'Unknown', necessary = True, supressOutput = True): def launch(cmd, name = 'Unknown', necessary = True, suppressOutput = True):
"""Launch a process. """Launch a process.
Appends to list of processes and (optionally) necProcesses if Appends to list of processes and (optionally) necProcesses if
...@@ -19,10 +21,14 @@ def launch(cmd, name = 'Unknown', necessary = True, supressOutput = True): ...@@ -19,10 +21,14 @@ def launch(cmd, name = 'Unknown', necessary = True, supressOutput = True):
Returns: The launched process. Returns: The launched process.
""" """
kwargs = {} kwargs = {}
if supressOutput: if suppressOutput:
kwargs = {'stdout': open('/dev/null', 'w'), kwargs = {'stdout': open('/dev/null', 'w'),
'stderr': open('/dev/null', 'w')} 'stderr': open('/dev/null', 'w')}
try:
p = subprocess.Popen(cmd.split(' '), shell = False, **kwargs) 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) processes.append(p)
if necessary: if necessary:
necProcesses.append([p,name]) necProcesses.append([p,name])
...@@ -66,7 +72,7 @@ def main(args): ...@@ -66,7 +72,7 @@ def main(args):
try: try:
# Launch the Server # Launch the Server
server = launch(serverCommand + serverOptions, name='server', server = launch(serverCommand + serverOptions, name='server',
supressOutput=not args.verbose) suppressOutput=not args.verbose)
time.sleep(0.2) time.sleep(0.2)
assert server.poll() is None,\ assert server.poll() is None,\
'[start.py] Failed to launch Server with command: \"%s\"' \ '[start.py] Failed to launch Server with command: \"%s\"' \
......
...@@ -2,9 +2,10 @@ ...@@ -2,9 +2,10 @@
./bin/HFO --offense-agents=2 --defense-npcs=3 --offense-npcs=1 --trials 20 --headless & ./bin/HFO --offense-agents=2 --defense-npcs=3 --offense-npcs=1 --trials 20 --headless &
sleep 5 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 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 # The magic line
# $$ holds the PID for this script # $$ holds the PID for this script
......
...@@ -26,8 +26,16 @@ setup(name = 'hfo', ...@@ -26,8 +26,16 @@ setup(name = 'hfo',
'Development Status :: 4 - Beta', 'Development Status :: 4 - Beta',
'Intended Audience :: Science/Research', 'Intended Audience :: Science/Research',
'License :: OSI Approved :: MIT License', '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=find_packages(),
packages=['hfo'], packages=['hfo'],
package_dir={'hfo': '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