-
Notifications
You must be signed in to change notification settings - Fork 0
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
Some issues with latest pyiron_nodes and pyiron_workflows libraries #68
Comments
@JNmpi, super! I deleted
I checked out your branch and copied this into a notebook, but I'm afraid I can't reproduce the error. First, I had to manually create the directory After that I tried un/commenting different combinations, cleaning the test directory and restarting my kernel each time:
Works
Works
Works
Doesn't work -- For readability, I would also suggest in
Sort of. The nodes capture the docstring of the functions they decorate (try tab-completing a node from the standard library to see). I like the idea of additionally capturing the annotations, although we will need to be careful to do it in a way that users see the function annotation in addition to the node annotation. Since user-facing nodes should anyhow have docstrings, implementing this is low-priority for me.
We do:
If I follow, you're suggesting that all changes to the data object be passed by passing an entire new data object? AFAIK this will work, but I don't think it's a reasonable expectation to put on users (or devs). In general we can avoid it by just not using dataclass instances (or any other mutable object) as defaults. Demo of dataclasses as a default being problematic: from dataclasses import dataclass, field
@dataclass
class Data:
immutable_data: int = 42
mutable_data: list[int] = field(default_factory=lambda: [1, 2, 3])
class Foo:
def __init__(self, data = Data()):
self.data = data
f1 = Foo()
print(f1.data)
# Data(immutable_data=42, mutable_data=[1, 2, 3])
f2 = Foo()
f2.data.immutable_data = "Not an int"
f2.data.mutable_data = "Not a list"
print(f1.data)
# Data(immutable_data='Not an int', mutable_data='Not a list') |
Thanks @liamhuber for the quick response.
I rebooted my computer and it is now also running for me. I have no idea what went wrong before.
For working with the nodes, I really miss this handy feature, so it has a high priority for me. Since all I had to do to get the annotations was to add that single line in nodes, adding it should be straightforward. For me, the in addition aspect has a low priority because I want to set the arguments in the function, not in the node class. So just having the function arguments would be fine with me.
An important design feature in pyiron is factoring, i.e. we put a lot of emphasis on the fact that the same functionality in different classes can be accessed by the same commands. This design feature lowers the entry barrier for users, but also makes the development of a GUI etc. easier to implement and read. I would therefore strongly advocate having a generic keyword for the same functionality, independent of the specific class. Besides the generic keyword, we can also keep class-specific keywords, but I do not see any real advantage.
When designing the pyiron_node library, I found it extremely helpful and elegant to use the dataclass object as a default for function input. An example is the InputCalcMD dataclass, which contains all the default parameters. To change them, the user just has to provide |
Do you mean I'm anyhow not comfortable with anything that uniformly override node documentation/completion with stuff from the underlying function. The node is always a node, and especially at instantiation it is critical that users be able to see the node input as well. Therefore any function documentation/signature captured at the node initialization stage can only be in addition to existing node info. I fully agree we need to do more scraping of decorated object signature data and to display it more aggressively in tab-completion and docstrings, but I just don't think this is trivially straightforward (at least not getting it to reliably play nicely with Jupyter) and so I am not going to be able to get it done promptly.
I fully agree there is room for an abstraction here. However, it's not immediately clear to me what that abstraction should be or how to implement it. What nodes get a "source"? What nodes don't? How do we signify the availability/requirement of such a source, by inheritance from some Naively function, macro, and dataclass nodes should have this, at a minimum. However, each of these already make the necessary data available on a case-by-case basis, and the different variable names make it obvious why each of these nodes holds this data for their use case. Without some underlying reasoning, I'm loathe to introduce "abstractions" that are arbitrary special behaviour, as in the long run I think this makes things more rather than less complicated. Since the desired data is anyways accessible, I'd rather not rush into something.
I cannot recommend going down this path. You're right that to provide an entirely new import pyiron_nodes as pn
n1 = pn.atomistic.engine.lammps.CalcMD()
n2 = pn.atomistic.engine.lammps.CalcMD()
print(n2.inputs.calculator_input.value.temperature)
# 300
n1.inputs.calculator_input.value.temperature = 0
print(n2.inputs.calculator_input.value.temperature)
# 0 At the end of the day, I feel the minor convenience we get for instantiating the default right in the signature instead of waiting for the function body to say |
Thanks @liamhuber for the updated version of pyiron_nodes. I have used main to create dev_joerg_from_main and made their some changes. Most of the issues when updating to this version were easy to resolve and most of the tools such as elastic_constants or phonons are nicely working.
The following workflow gives an error (AttributeError: 'str' object has no attribute 'working_directory'):
A few other issues:
The text was updated successfully, but these errors were encountered: