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

Error in optimizer main can be obscured by TypeError #155

Open
mkeilman opened this issue Jun 20, 2023 · 1 comment
Open

Error in optimizer main can be obscured by TypeError #155

mkeilman opened this issue Jun 20, 2023 · 1 comment

Comments

@mkeilman
Copy link

In local_opt_generator.persistent_local_opt, local_opter.iterate can return an array or a ConvergedMsg. That is handled in the loop, but if something goes wrong right away, the initial step:

        x_new = local_opter.iterate(pass_to_local_opter)
        add_to_local_H(local_H, x_new, user_specs, local_flag=1, on_cube=True)

throws:

[0]  2023-06-09 19:21:57,964 libensemble.manager (ERROR): Message: TypeError: object of type 'ConvergedMsg' has no len()
[0]  2023-06-09 19:21:57,964 libensemble.manager (ERROR): Traceback (most recent call last):
  File "/home/vagrant/.pyenv/versions/3.9.15/envs/py3/lib/python3.9/site-packages/libensemble/worker.py", line 406, in run
    response = self._handle(Work)
  File "/home/vagrant/.pyenv/versions/3.9.15/envs/py3/lib/python3.9/site-packages/libensemble/worker.py", line 355, in _handle
    calc_out, persis_info, calc_status = self._handle_calc(Work, calc_in)
  File "/home/vagrant/.pyenv/versions/3.9.15/envs/py3/lib/python3.9/site-packages/libensemble/worker.py", line 275, in _handle_calc
    out = calc(calc_in, Work)
  File "/home/vagrant/.pyenv/versions/3.9.15/envs/py3/lib/python3.9/site-packages/libensemble/utils/runners.py", line 58, in run_gen
    return result(calc_in, Work["persis_info"], self.gen_specs, Work["libE_info"], self.gen_f, Work["tag"])
  File "/home/vagrant/.pyenv/versions/3.9.15/envs/py3/lib/python3.9/site-packages/libensemble/utils/runners.py", line 91, in _normal_result
    return user_f(*args)
  File "/home/vagrant/src/radiasoft/rsopt/rsopt/libe_tools/generator_functions/local_opt_generator.py", line 37, in persistent_local_opt
    add_to_local_H(local_H, x_new, user_specs, local_flag=1, on_cube=True)
  File "/home/vagrant/src/radiasoft/rsopt/rsopt/libe_tools/generator_functions/local_opt_generator.py", line 93, in add_to_local_H
    assert not local_flag or len(pts) == 1, "Can't > 1 local points"
TypeError: object of type 'ConvergedMsg' has no len()

This may hide the actual error depending on when it took place

@cchall
Copy link
Member

cchall commented Jun 22, 2023

@mkeilman do you have an example that shows this error?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants