Skip to content

Commit

Permalink
Fix run_sp test
Browse files Browse the repository at this point in the history
  • Loading branch information
shuds13 committed Jun 30, 2020
1 parent ab77a09 commit 812c432
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ before_script:

# Run test (-z show output)
script:
- ./libensemble/tests/run-tests.sh -rz -$COMMS_TYPE
#- ./libensemble/tests/run-tests.sh -rz -$COMMS_TYPE
- python run_sp.py

# Track code coverage
Expand All @@ -120,6 +120,6 @@ after_success:
after_failure:
- cat libensemble/tests/regression_tests/log.err

after_script:
- cat libensemble/tests/regression_tests/ensemble.log
- cat libensemble/tests/regression_tests/machinefile*
#after_script:
#- cat libensemble/tests/regression_tests/ensemble.log
#- cat libensemble/tests/regression_tests/machinefile*
11 changes: 7 additions & 4 deletions run_sp.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ def abbrev_nodenames(node_list):
newlist = [s.split(".", 1)[0] for s in node_list]
return newlist

def write_mach(mfile):
def write_mach(mfile, hostname=socket.gethostname()):
with open(mfile, 'w') as f:
f.write(socket.gethostname() + '\n')
f.write(hostname + '\n')

def print_mach(mfile):
print('{} contains:'.format(mfile))
Expand All @@ -32,11 +32,12 @@ def print_mach(mfile):
with open(mfile, 'r') as f:
for line in f:
nodelist.append(line.rstrip())
nodelist = abbrev_nodenames(nodelist)[0]
nodelist = abbrev_nodenames(nodelist)
print('new nodelist:',nodelist)

mfile = 'mach2'
write_mach(mfile)
#import pdb;pdb.set_trace()
write_mach(mfile, hostname=nodelist[0])
print_mach(mfile)
cmd='mpirun -machinefile mach2 -np 1 --ppn 1 ./my_simtask.x sleep 1'
print(cmd)
Expand All @@ -45,6 +46,8 @@ def print_mach(mfile):

#Test definitly wrong
mfile = 'mach3'
write_mach(mfile, hostname='defwrong')

with open(mfile, 'w') as f:
f.write('defwrong' + '\n')
print_mach(mfile)
Expand Down

0 comments on commit 812c432

Please sign in to comment.