Skip to content

Commit

Permalink
Changes to comply with flake8 3.8.0
Browse files Browse the repository at this point in the history
  • Loading branch information
shuds13 committed May 12, 2020
1 parent 0a84681 commit d9cc26b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion install/test_balsam_hworld.py
Expand Up @@ -25,7 +25,7 @@ def wait_for_job_dir(basedb):
time.sleep(1)
sleeptime += 1

print('Waiting for Job Directory'.format(sleeptime))
print('Waiting for Job Directory {}'.format(sleeptime))
while len(os.listdir(basedb)) == 0 and sleeptime < 15:
print(sleeptime, end=" ", flush=True)
time.sleep(1)
Expand Down
20 changes: 10 additions & 10 deletions libensemble/history.py
Expand Up @@ -129,26 +129,26 @@ def update_history_x_out(self, q_inds, sim_worker):
else:
self.given_count += len(q_inds)

def update_history_x_in(self, gen_worker, O):
def update_history_x_in(self, gen_worker, D):
"""
Updates the history (in place) when new points have been returned from a gen
Parameters
----------
gen_worker: integer
The worker who generated these points
O: numpy array
D: numpy array
Output from gen_func
"""

if len(O) == 0:
if len(D) == 0:
return

rows_remaining = len(self.H)-self.index

if 'sim_id' not in O.dtype.names:
if 'sim_id' not in D.dtype.names:
# gen method must not be adjusting sim_id, just append to self.H
num_new = len(O)
num_new = len(D)

if num_new > rows_remaining:
self.grow_H(num_new-rows_remaining)
Expand All @@ -159,18 +159,18 @@ def update_history_x_in(self, gen_worker, O):
# gen method is building sim_id or adjusting values in existing sim_id rows.

# Ensure there aren't any gaps in the generated sim_id values:
assert np.all(np.in1d(np.arange(self.index, np.max(O['sim_id'])+1), O['sim_id'])),\
assert np.all(np.in1d(np.arange(self.index, np.max(D['sim_id'])+1), D['sim_id'])),\
"The generator function has produced sim_id that are not in order."

num_new = len(np.setdiff1d(O['sim_id'], self.H['sim_id']))
num_new = len(np.setdiff1d(D['sim_id'], self.H['sim_id']))

if num_new > rows_remaining:
self.grow_H(num_new-rows_remaining)

update_inds = O['sim_id']
update_inds = D['sim_id']

for field in O.dtype.names:
self.H[field][update_inds] = O[field]
for field in D.dtype.names:
self.H[field][update_inds] = D[field]

self.H['gen_time'][update_inds] = time.time()
self.H['gen_worker'][update_inds] = gen_worker
Expand Down
8 changes: 4 additions & 4 deletions libensemble/tools/gen_support.py
@@ -1,17 +1,17 @@
from libensemble.message_numbers import STOP_TAG, PERSIS_STOP, UNSET_TAG, EVAL_GEN_TAG


def sendrecv_mgr_worker_msg(comm, O, status=None):
def sendrecv_mgr_worker_msg(comm, output, status=None):
"""Send message from worker to manager and receive response.
"""
send_mgr_worker_msg(comm, O)
send_mgr_worker_msg(comm, output)
return get_mgr_worker_msg(comm, status=status)


def send_mgr_worker_msg(comm, O):
def send_mgr_worker_msg(comm, output):
"""Send message from worker to manager.
"""
D = {'calc_out': O,
D = {'calc_out': output,
'libE_info': {'persistent': True},
'calc_status': UNSET_TAG,
'calc_type': EVAL_GEN_TAG
Expand Down

0 comments on commit d9cc26b

Please sign in to comment.