Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/jobflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: jobflow

on:
push:
branches: [ main ]
pull_request:

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
auto-update-conda: true
python-version: "3.12"
environment-file: environment.yml
auto-activate-base: false
- name: Tests
shell: bash -l {0}
run: |
pip install -e adis_tools
pip install -e python_workflow_definition
conda install -c conda-forge jupyter papermill
export ESPRESSO_PSEUDO=$(pwd)/espresso/pseudo
papermill universal_qe_to_jobflow.ipynb universal_qe_to_jobflow_out.ipynb -k "python3"
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json
from importlib import import_module
from inspect import isfunction

from jobflow import job, Flow
Expand Down Expand Up @@ -186,6 +188,30 @@ def get_source_handles(edges_lst):
}


def find_root_node(nodes_dict, edges_lst):
source_count_dict = {k: sum([ed["source"] == k for ed in edges_lst]) for k in nodes_dict.keys()}
return min(source_count_dict, key=source_count_dict.get)
def load_workflow_json(file_name):
with open(file_name, "r") as f:
content = json.load(f)

edges_new_lst = content["edges"]
nodes_new_dict = {}
for k, v in content["nodes"].items():
if isinstance(v, str) and "." in v:
p, m = v.rsplit('.', 1)
if p == "python_workflow_definition.pyiron_base":
p = "python_workflow_definition.jobflow"
mod = import_module(p)
nodes_new_dict[int(k)] = getattr(mod, m)
else:
nodes_new_dict[int(k)] = v

source_handles_dict = get_source_handles(edges_lst=edges_new_lst)
total_dict = group_edges(edges_lst=edges_new_lst)
input_dict = get_input_dict(nodes_dict=nodes_new_dict)
new_total_dict = resort_total_lst(total_dict=total_dict, nodes_dict=nodes_new_dict)
task_lst = get_workflow(
nodes_dict=nodes_new_dict,
input_dict=input_dict,
total_dict=new_total_dict,
source_handles_dict=source_handles_dict,
)
return Flow(task_lst)
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def load_workflow_json(project, file_name):
for k, v in content["nodes"].items():
if isinstance(v, str) and "." in v:
p, m = v.rsplit('.', 1)
if p == "python_workflow_definition.jobflow":
p = "python_workflow_definition.pyiron_base"
mod = import_module(p)
nodes_new_dict[int(k)] = getattr(mod, m)
else:
Expand Down
1 change: 1 addition & 0 deletions universal_qe_to_jobflow.ipynb

Large diffs are not rendered by default.

Loading