Skip to content

Issues with texts CLI when $HOME/.fireworks does not exist or LAUNCHPAD_LOC is None

The errors below occur if $HOME/.fireworks does not exist or launchpad not configured or not provided by clargs. It is masked by setup_resconfig() which also crashes (issue in vre-middleware).

Traceback (most recent call last):
  File "vre-language/src/virtmat/language/utilities/errors.py", line 223, in wrapper
    return func(*args, **kwargs)
  File "vre-language/src/virtmat/language/cli/run_session.py", line 60, in main
    config_dir = os.path.dirname(os.path.abspath(clargs.launchpad_file))
  File "/usr/lib/python3.10/posixpath.py", line 379, in abspath
    path = os.fspath(path)
TypeError: expected str, bytes or os.PathLike object, not NoneType

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "python-3.10.12/bin/texts", line 8, in <module>
    sys.exit(texts())
  File "vre-language/src/virtmat/language/cli/__init__.py", line 25, in texts
    clargs.func(clargs)
  File "vre-language/src/virtmat/language/utilities/errors.py", line 240, in wrapper
    raise RuntimeError('non-handled exception') from err
RuntimeError: non-handled exception

This is because clargs.launchpad_file is None (see below).

When the line

config_dir = os.path.dirname(os.path.abspath(clargs.launchpad_file))

is replaced by config_dir = '/tmp' (always a valid choice) then this error occurs:

Traceback (most recent call last):
  File "python-3.10.12/lib/python3.10/site-packages/fireworks/scripts/lpad_run.py", line 120, in get_lp
    args.loglvl = "CRITICAL" if args.silencer else args.loglvl
AttributeError: 'Namespace' object has no attribute 'silencer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "vre-language/src/virtmat/language/utilities/errors.py", line 223, in wrapper
    return func(*args, **kwargs)
  File "vre-language/src/virtmat/language/cli/run_session.py", line 63, in main
    mgr = SessionManager(get_lp(clargs), uuid=clargs.uuid, autorun=clargs.autorun,
  File "python-3.10.12/lib/python3.10/site-packages/fireworks/scripts/lpad_run.py", line 132, in get_lp
    f"FireWorks was not able to connect to MongoDB at {lp.host}:{lp.port}. Is the server running? "
UnboundLocalError: local variable 'lp' referenced before assignment

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "python-3.10.12/bin/texts", line 8, in <module>
    sys.exit(texts())
  File "vre-language/src/virtmat/language/cli/__init__.py", line 25, in texts
    clargs.func(clargs)
  File "vre-language/src/virtmat/language/utilities/errors.py", line 240, in wrapper
    raise RuntimeError('non-handled exception') from err
RuntimeError: non-handled exception

Also if the launchpad file is specified with a wrong path there is an (again non-optimally handled) exception:

Traceback (most recent call last):
  File "python-3.10.12/lib/python3.10/site-packages/fireworks/scripts/lpad_run.py", line 117, in get_lp
    lp = LaunchPad.from_file(args.launchpad_file)
  File "python-3.10.12/lib/python3.10/site-packages/fireworks/utilities/fw_serializers.py", line 290, in from_file
    with open(filename, "r", **ENCODING_PARAMS) as f:
FileNotFoundError: [Errno 2] No such file or directory: 'blah'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "vre-language/src/virtmat/language/utilities/errors.py", line 223, in wrapper
    return func(*args, **kwargs)
  File "vre-language/src/virtmat/language/cli/run_session.py", line 63, in main
    mgr = SessionManager(get_lp(clargs), uuid=clargs.uuid, autorun=clargs.autorun,
  File "python-3.10.12/lib/python3.10/site-packages/fireworks/scripts/lpad_run.py", line 132, in get_lp
    f"FireWorks was not able to connect to MongoDB at {lp.host}:{lp.port}. Is the server running? "
UnboundLocalError: local variable 'lp' referenced before assignment

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "python-3.10.12/bin/texts", line 8, in <module>
    sys.exit(texts())
  File "vre-language/src/virtmat/language/cli/__init__.py", line 25, in texts
    clargs.func(clargs)
  File "vre-language/src/virtmat/language/utilities/errors.py", line 240, in wrapper
    raise RuntimeError('non-handled exception') from err
RuntimeError: non-handled exception
Edited by Ivan Kondov