Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to comply with flake8 3.8.0 #453

Merged
merged 1 commit into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion install/test_balsam_hworld.py
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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