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

Shorten error stacks #11

Open
liamhuber opened this issue Sep 21, 2023 · 2 comments
Open

Shorten error stacks #11

liamhuber opened this issue Sep 21, 2023 · 2 comments
Assignees

Comments

@liamhuber
Copy link
Member

From @JNmpi in pyiron/pyiron_contrib#855

Raising errors in nodes

wf = Workflow('simple_lammps_calculation')

structure = wf.create.atomistics.Bulk(cubic=True, name="Cu", label='structure')

lammps_job = wf.create.lammps.LammpsStaticNode(label='lammps_job')
lammps_job.inputs.structure = structure
lammps_job.inputs.potential = '1995--Angelo-J-E--Ni-Al-H--LAMMPS--ipr1'  # potential does not contain Cu

# out = wf.run()
potential starts

Issue: Running this script raises correctly an error. However, the error message is long. It would be great if we could directly give the error message thrown by the node without getting all the message from pyiron_workflows.

Agreed, and I think it should be possible without much headache.

@liamhuber liamhuber self-assigned this Sep 21, 2023
@niklassiemer
Copy link
Member

Should be as easy to raise Exception from None shouldn't it?

@liamhuber
Copy link
Member Author

Should be as easy to raise Exception from None shouldn't it?

Maybe, but probably not. For instance, in this toy example the context still goes all the way up to the bar call, which I think is the sort of thing we're hoping to ditch since for the workflows this context digs through some very deep code.

def bar(x):
    foo(x)

def foo(x):
    try:
        x + 5
    except Exception as e:
        raise e from None
        
bar(None)

I'm relatively confident it's possible, I just don't know the syntax yet for getting the exact behaviour we want.

@liamhuber liamhuber transferred this issue from pyiron/pyiron_contrib Oct 6, 2023
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