Skip to content

Conversation

GeigerJ2
Copy link
Collaborator

No description provided.

- Add `scale_structure` task
- Prepend return dict keys of `generate_structures` with `s_`
- Add function to serialize return atoms dict to pure python data types
- Rename `name` -> `element` for `get_bulk_structure`, as `name` clashes
  with WG
@jan-janssen
Copy link
Member

@GeigerJ2 I adopted the changes to quantum_espresso_workflow.py in #12 and #13 , this helped me to update the jobflow and pyiron_base notebooks.

@jan-janssen
Copy link
Member

I tried the jupyter notebook universal_simple_to_aiida.ipynb and it seems to require an updated aiida-workgraph version, as I get the following error message:

---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
Cell In[2], line 1
----> 1 workgraph = load_workflow_json(filename='workflow_simple.json')

File [~/python_workflow_definition/src/python_workflow_definition/aiida.py:78](https://hub.2i2c.mybinder.org/user/geigerj2-python-flow-definition-t6m0v92n/python_workflow_definition/src/python_workflow_definition/aiida.py#line=77), in load_workflow_json(filename)
     75 # func = func_mapping[identifier]
     76 # I use the register_pickle_by_value, because the function is defined in a local file
     77 try:
---> 78     wg.add_task(func, register_pickle_by_value=True, name=m)
     79 except ValueError:
     80     if m in name_counter:

File [/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida_workgraph/workgraph.py:512](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida_workgraph/workgraph.py#line=511), in WorkGraph.add_task(self, identifier, name, **kwargs)
    508 def add_task(
    509     self, identifier: Union[str, callable], name: str = None, **kwargs
    510 ) -> Task:
    511     """Add a task to the workgraph."""
--> 512     node = self.tasks._new(identifier, name, **kwargs)
    513     return node

File [/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida_workgraph/collection.py:44](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/site-packages/aiida_workgraph/collection.py#line=43), in TaskCollection._new(self, identifier, name, uuid, **kwargs)
     42 if isinstance(identifier, WorkGraph):
     43     identifier = build_task_from_workgraph(identifier)
---> 44 return super()._new(identifier, name, uuid, **kwargs)

File [/srv/conda/envs/notebook/lib/python3.12/site-packages/node_graph/collection.py:200](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/site-packages/node_graph/collection.py#line=199), in decorator_check_identifier_name.<locals>.wrapper_func(*args, **kwargs)
    196 if kwargs.get("name", None) in args[0]._get_keys():
    197     raise ValueError(
    198         f"{kwargs.get('name')} already exists, please choose another name."
    199     )
--> 200 item = func(*args, **kwargs)
    201 return item

File [/srv/conda/envs/notebook/lib/python3.12/site-packages/node_graph/collection.py:246](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/site-packages/node_graph/collection.py#line=245), in NodeCollection._new(self, identifier, name, uuid, _metadata, _executor, **kwargs)
    237 item = ItemClass(
    238     list_index=list_index,
    239     name=name,
   (...)
    243     executor=_executor,
    244 )
    245 self._append(item)
--> 246 item.set(kwargs)
    247 # Execute post creation hooks
    248 self._execute_post_creation_hooks(item)

File [/srv/conda/envs/notebook/lib/python3.12/site-packages/node_graph/node.py:562](https://hub.2i2c.mybinder.org/srv/conda/envs/notebook/lib/python3.12/site-packages/node_graph/node.py#line=561), in Node.set(self, data)
    560     self.inputs[key]._set_socket_value(value)
    561 else:
--> 562     raise Exception(
    563         "No property named {}. Accept name are {}".format(
    564             key,
    565             list(self.get_property_names() + list(self.get_input_names())),
    566         )
    567     )

Exception: No property named register_pickle_by_value. Accept name are ['x', 'y', '_wait', 'computer', 'command_info', 'metadata', 'code', 'monitors', 'remote_folder', 'function_data', 'process_label', 'function_inputs', 'parent_folder', 'parent_folder_name', 'parent_output_folder', 'upload_files', 'copy_files', 'additional_retrieve_list']

@GeigerJ2
Copy link
Collaborator Author

GeigerJ2 commented Mar 15, 2025

Hi @jan-janssen, I just ran the universal_simple_to_aiida.ipynb notebook and couldn't reproduce your issue. Though, at this point, I also have editable installs of all the required packages (aiida-workgraph, node-graph, aiida-pythonjob) in my venv, as @superstar54 is actively developing them, so it might indeed just be that you have the released versions installed?

@jan-janssen
Copy link
Member

@GeigerJ2 I was able to fix the pyiron_base related errors, by updating the environment variable but there still seem to be issues with the exported workflows.

@jan-janssen jan-janssen marked this pull request as ready for review March 21, 2025 16:24
@jan-janssen
Copy link
Member

@GeigerJ2 From my perspective this is ready to be merged.

@jan-janssen jan-janssen merged commit a98f2eb into pythonworkflow:main Mar 21, 2025
5 checks passed
@GeigerJ2
Copy link
Collaborator Author

Thanks for the fix and merge, @jan-janssen!

"targetHandle": target_handle,
"source": connection_dict[output_name],
"sourceHandle": output._list_index, # check for list index
"sourceHandle": f"s_{output._list_index}", # check for list index
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this apply for all the tasks, rather than just the generate_structures one? 🤔

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, all lists

@GeigerJ2 GeigerJ2 deleted the aiida-pythonjob branch March 22, 2025 15:53
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

Successfully merging this pull request may close these issues.

3 participants