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

[BUG] Nodes fail to run in interactive sessions when using custom output names #397

Open
mb2055 opened this issue Mar 20, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@mb2055
Copy link
Contributor

mb2055 commented Mar 20, 2025

Describe the bug
Using the file_prefix argument in node.validate , then attempting to run the node within an interactive session with BSS.Node.run causes the following exeption: FileNotFoundError: [Errno 2] No such file or directory: 'output.yaml'.

This is due to the assumption here that the output file will always be called output.yaml, even if file_prefix is set to something different.

To Reproduce
Steps to reproduce the behavior:

  1. Create a basic node e.g.:
import BioSimSpace as BSS

node = BSS.Gateway.Node("A node.")

node.addInput("in", BSS.Gateway.Integer(help="in"))

node.addOutput("out", BSS.Gateway.Integer(help="out"))

node.setOutput("out", 1)

node.validate(file_prefix="test")
  1. Attempt to run the node in an interactive session:
In [1]: import BioSimSpace as BSS

INFO:numexpr.utils:Note: NumExpr detected 20 cores but "NUMEXPR_MAX_THREADS" not set, so enforcing safe limit of 16.
INFO:numexpr.utils:NumExpr defaulting to 16 threads.

In [2]: BSS.Node.setNodeDirectory(".")

In [3]: BSS.Node.run("null_node", {"in":1})
╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ in <module>:1                                                                                    │
│                                                                                                  │
│ /home/matt/code/biosimspace/python/BioSimSpace/Node/_node.py:160 in run                          │
│                                                                                                  │
│   157 │                                                                                          │
│   158if proc.returncode == 0:                                                               │
│   159 │   │   # Read the output YAML file into a dictionary.                                     │
│ ❱ 160 │   │   with open("output.yaml", "r") as file:                                             │
│   161 │   │   │   output = _yaml.safe_load(file)                                                 │
│   162 │   │                                                                                      │
│   163 │   │   # Delete the redundant YAML files.                                                 │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
FileNotFoundError: [Errno 2] No such file or directory: 'output.yaml'

(please complete the following information):

  • OS: Ubuntu 22.04.5 LTS
  • Version of Python: 3.11
  • Version of BioSimSpace: latest dev release
  • I confirm that I have checked this bug still exists in the latest released version of BioSimSpace: [yes]
@mb2055 mb2055 added the bug Something isn't working label Mar 20, 2025
@mb2055
Copy link
Contributor Author

mb2055 commented Mar 20, 2025

I've been trying to run multiple instances of a node simultaneously using dask, and I now see that this issue may be more difficult to solve than I initially thought.
In order for these to work robustly in parallel we need to be able to generate unique filenames for both input and output yaml files. This is easy enough with inputs, but with outputs it is more complex since the unique filename will likely need to be generated at runtime, meaning that the name isn't known until the node is run.

@lohedges
Copy link
Contributor

The easiest thing I can think of would be to use an input to define the name of the output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants